Reading/Changing an objects enum
lucky101man
Posts: 0
Hi everyone,
I don't know how to read the current value out of an objects enumerations. How can I tell what an enum is set to.
For example I can create an object which (surely!) contains the enum RenderImgTarget { ActiveView = 0, NewWindow = 1, DirectToFile = 2 }
But how do I read this enum value, and my next question would be how to set it to something new?
var oRenderOptions = oRenderMgr.getRenderOptions();
gets me the object and surely the enum is in this and set to a value, (NewWindow = 1), but I can't figure out the syntax.
I thought it would be
oRenderOptions.RenerImgTarget.valueOf();
or something like that, but I can't figure it out.
Thanks!
Comments
I thought there might have been a different, mysterious way to access enums, but I just read the property name wrong :roll:
renderImgToId (Uppercase i) looks alot like
renderImgTold (Lowercase L)
obviously to id makes more sense than 'told' but still!
oRenderOptions.renderImgToId = 1;
oRenderOptions.applyChanges();
Anyway, this is just me talking to myself and it's probably not useful to anyone, so feel free to delete thread mod.
Thanks
check out the Scripting samples on the dokuWiki page(s)
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start
For your specific question, there is a sample in the Rendering section at the bottom of the page with that exact setting, (along with numerous others.)
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/rendering/render_to_rib/start
It's a long and comprehensive Script, so your answer isn't in the first couple lines ;) but is definitely in there. Pretty close to the bottom, and in the last defined function. (Assuming the Script doesn't get updated between the time I post this, and someone reads it.)
...and when read as code text, the I vs l (big-eye vs little-ell,) is WAY more obvious! ;)