Loading image file layer
meipe
Posts: 101
I was trying to apply a line of code by 3dcheapskate (http://www.daz3d.com/forums/discussion/30157/daz-script-2-getting-standard-surface-parameters-using-layered-images-almost-done-now#latest) about creating a layered image, but I get stuck by a bug:
var l1 = new DzImageFileLayer;
...
l1.getImageData().load( [image-1-file] );
Changing [image-1-file] with the path of an image file (whatever it is) gets me the following error:
images\dzimagemgr.cpp(319): Empty filename passed to DzImageMgr::loadImage()
The argument for load() should be a Qstring... Any Idea about what's going on?
Comments
there should at least be empty parenthese after the object name in the new line, assuming ti allows expicit contstruction and doesn't require parameters:
var l1 = new DzImageFileLayer() ;
you should always error-trap - check that you have a valid object after creating or getting one, quitting the operation (and in the initial stages writing an error to the log with print ( "oopsie of soem kind" );) if not.
Hum the same error is still here with the empty parenthese... and the object passes the error-check with or without empty parenthese.
The following code works, but Image is of course a different object:
var im = new Image();
im.load(anyPath);
Hmm, I'm not sure what you should be doing - sorry.
Looks to me like there shouldn't be square brackets there. It was a confusing convention inside of code to do that. As you mentioned it should be accepting a string, so try passing the filename in without the square brackets.