Relative paths for images? (SO…
Daz 3D Forums > Software > Daz Studio Discussion > Daz Script Developer Discussion>Relative paths for images? (SO…
Relative paths for images? (SOLVED)

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 :)
var wDlg = new DzDialog;//Image with relative pathvar oContentMgr = App.getContentMgr();var sPath = oContentMgr.getAbsolutePath( "/Scripts/image.png", true );var Label = new DzLabel(wDlg);var Image = new Pixmap(sPath);Label.pixmap = new Pixmap(Image);//Dialog size is fixed to imagevar size = Image;wDlg.setFixedSize( size.width, size.height ); wDlg.exec()