Relative paths for images? (SOLVED)
Soto
Posts: 1,440
Hi.
I am including an image inside a dialog, it works fine with an absolute path but I can`t seem to find anywhere how to set a relative path for distribution purposes. This is what I have:
var wDlg = new DzDialog;var Label=new DzLabel(wDlg)var Image = new Pixmap("/Users/Soto/Documents/DAZ 3D/Studio/My Library/Scripts/Soto/image.png");Label.pixmap = new Pixmap(Image);var size = Image; wDlg.setFixedSize( size.width, size.height ); wDlg.exec()
I would appreciate a hint, I`m really not having any luck :/
Post edited by Soto on
Comments
You use getAbsolutePath() on the Content Manager object. So you provide the path relative to the DAZ Library path and it will give you the absolute path on your computer. Thus:
var oContentMgr = App.getContentMgr();
var sPath = oContentMgr.getAbsolutePath( "/Scripts/Soto/image.png", true );
Thank you very, very much!
I tried getRelativePath out of confusion at some point. This worked perfect :)