Script to set mesh resolution?
Causam3D
Posts: 212
Hi everyone,
I currently have a script that will allow me to toggle visibility on a node. This script uses
var oSomething1 = Scene.findNodeByLabel("Some Node In The Scene");
oSomething1.setVisible( !oSomething1.isVisible() );
I'd like to adapt this to set resolution from Base to High, and back again. Obviously "setVisible" won't work. But I can't (out of brute ignorance) find the -- method, function, what-have-you -- to replace ".setVisible". I am not a coder by any stretch, so please if you take the time to answer, talk to me like I'm five.
Thanks in advance!
Comments
Couldn't you just use a Properties preset? If you do need to do it via script, see http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/properties/node_properties/start where Mesh Resolution is one of the examples used
Similar script that I wrote with checking Content Type as well, in this thread - https://forum.daz3d.com/forums/discussion/668781/is-there-a-script-that-can-change-all-wearable-resolution
Maybe you can give it a check and change the content type accordingly as you want.
Nodes may have more than two levels of detail, so this switches through each value instead of just "Base" and "High Resolution"...
If you know the two values you want to work with are always named "Base" and "High", you can check if getStringValue() == 'Base' and then use setValueFromString() as appropriate instead, and skip any other values the node has. These methods are on the DzEnumProperty, oLODControl in this example.
@Omniflux That's great ! Thank you for the instruction !
Thanks for the help everyone, as always the answer is to be found here if nowhere else.