You could save a proeprty preset with a specific value; I just had a poke around and couldn't figure out how to access the SubD modifier, though I'm sure it's possible.
// oRootNode is a DzNode that has non-null getObject().getCurrentShape(),// e.g. the DzSkeleton of a Figure:// Test if the mesh of oRootNode is Sub-Divided (via the "Level of Detail" property):// i.e. Parameters > General > Mesh Resolution > Resolution Level// 0 = Base// 1 = High Resolutionvar Property = oRootNode.getObject().getCurrentShape().findProperty( 'lodlevel' );if( Property ) { // DzEnumProperty if( Property.getNumItems() > 1 ) { // The mesh is Sub-Divided. // Both the 0 and 1 values are available on the Property } else { // The mesh is not Sub-Divided. // The only value available on the Property is 0 = Base }}// Sub-Divide the Mesh of oRootNode:// DzSubDAction acts on the currently-Selected Node:Scene.selectAllNodes( false );oRootNode.select( true );MainWindow.getActionMgr().findAction( 'DzSubDAction' ).trigger();// Get the Sub-Division Level:var nLevel = oRootNode.getObject().getCurrentShape().getLODControl().getValue();// Set the Sub-Division Level:oRootNode.getObject().getCurrentShape().getLODControl().setValue( nMyNewValue );
Are you sure? Level of detail is the name of an older feature, not supported by the DSON format though it still works in DS.
Edit: yes, that tries to run Convert to SubD on my (already SubD) target, so I'm pretty sure you are looking for old-style LoDs (explicit alternative geometries with reduced polygon counts but the existing vertices matching the base item's) rather than SubD. Edit 2: but the Mesh Resolution property on the object is named lodlevel, so I'm not sure why the script fails for me. Final edit for now - you need to put the code running the Convert to SubD action inside the conditional else block.
Are you sure? Level of detail is the name of an older feature, not supported by the DSON format though it still works in DS.
Edit: yes, that tries to run Convert to SubD on my (already SubD) target, so I'm pretty sure you are looking for old-style LoDs (explicit alternative geometries with reduced polygon counts but the existing vertices matching the base item's) rather than SubD. Edit 2: but the Mesh Resolution property on the object is named lodlevel, so I'm not sure why the script fails for me. Final edit for now - you need to put the code running the Convert to SubD action inside the conditional else block.
If it's the set that is failing, could the property be locked?
Are you sure? Level of detail is the name of an older feature, not supported by the DSON format though it still works in DS.
Edit: yes, that tries to run Convert to SubD on my (already SubD) target, so I'm pretty sure you are looking for old-style LoDs (explicit alternative geometries with reduced polygon counts but the existing vertices matching the base item's) rather than SubD. Edit 2: but the Mesh Resolution property on the object is named lodlevel, so I'm not sure why the script fails for me. Final edit for now - you need to put the code running the Convert to SubD action inside the conditional else block.
If it's the set that is failing, could the property be locked?
I wouldn't think so, it was a newly created primitive with SubD applied - I didn't save, though, so can't check.
Comments
In a script or in general use? What do you mean by an apply?
Well, either of the two would serve me ...
You could save a proeprty preset with a specific value; I just had a poke around and couldn't figure out how to access the SubD modifier, though I'm sure it's possible.
I have not been able to access the SubD either
Try these:
Are you sure? Level of detail is the name of an older feature, not supported by the DSON format though it still works in DS.
Edit: yes, that tries to run Convert to SubD on my (already SubD) target, so I'm pretty sure you are looking for old-style LoDs (explicit alternative geometries with reduced polygon counts but the existing vertices matching the base item's) rather than SubD. Edit 2: but the Mesh Resolution property on the object is named lodlevel, so I'm not sure why the script fails for me. Final edit for now - you need to put the code running the Convert to SubD action inside the conditional else block.
Yup - I just tested it on a Cube primitive, and it worked as expected.
(Using DS v4.12.2.6 Beta)
If it's the set that is failing, could the property be locked?
I wouldn't think so, it was a newly created primitive with SubD applied - I didn't save, though, so can't check.