Change subdivision and Resolution level

semidieusemidieu Posts: 26

Two more things... I searched in the documentation, but I can't find it. I searched also in the forum (also the old forum) with no luck...

How do you get (and modify) the subdivision level and the resolution level from a figure ?

Comments

  • SzarkSzark Posts: 10,634
    edited December 1969

    Sorry I am unsure what you mean so I will start at the begining. :)


    If a figure as in the case of Genesis is subdivided then the resolution details can be found under the Parameters Pane when the figure/prop is selected.


    Let us know if this is not what you are asking for or have futher questions about this.

  • semidieusemidieu Posts: 26
    edited December 1969

    Hi :)
    I could have been more precise. I mean how to get these two properties using scripting :)

    Forgot that it is not a scripting forum, but the dev forum :)

  • Richard HaseltineRichard Haseltine Posts: 100,882
    edited August 2012

    I'm not sure, but looking at the DS3 scripting docs try (with errror checking added)

    oShape = oNode.getObject().getCurrentShape();

    which should be some derivative of DzSubDBase, but then I run into a brick wall as the scripting docs are talking about settings from the older implementation when there was a render level setting - but you could check the members of whatever type of object you get for possibilities.

    Post edited by Richard Haseltine on
  • semidieusemidieu Posts: 26
    edited December 1969

    but you could check the members of whatever type of object you get for possibilities.

    How ? Is it possible to check this directly in the Scripting IDE ?

  • semidieusemidieu Posts: 26
    edited December 1969

    Another question - is it possible to get and set the values from the 'Property' object ? Here is a code (taken from Node Property.dsa in the samples and a little bit edited).

    This script will identify and display the Subdivision and Resolution level property. But I can't find a way to get it's value or set it's value!?!!

    
    /*********************************************************************/
    // Array :
    function getGroupProperties( oGroup, bTraverse, bRecurse )
    {
     // Declare an array to hold properties
     var aProperties = [];
     
     // If a group isn't passed in
     if( !oGroup ){
      // We're done, return an empty array
      return aProperties;
     // If a group is passed in
     } else {
      // Get the number of proeprties in the group
      var nProperties = oGroup.getNumProperties();
      // Pre-size the properties array
      aProperties = new Array( nProperties );
      // Iterate over the properties, setting each element in the array
      for( var i = 0; i < nProperties; i += 1 ){
       aProperties[ i ] = oGroup.getProperty( i );
      }
      
      // If we are recursing
      if( bRecurse ){
       // Concatenate the properties array from child groups
       aProperties = aProperties.concat( getGroupProperties( oGroup.getFirstChild(), bTraverse, bRecurse ) );
      }
      
      // If we are traversing
      if( bTraverse ){
       // Concatenate the properties array from sibling groups
       aProperties = aProperties.concat( getGroupProperties( oGroup.getNextSibling(), bTraverse, bRecurse ) );
      }
     }
     
     // Return the array of properties
     return aProperties;
    }
    
    /*********************************************************************/
    // Array :
    function getNodeProperties( oNode, bTraverse, bRecurse )
    {
     // Get the property group tree for the node
     var oPropertyGroupTree = oNode.getPropertyGroups();
     // Get the first group in the tree
     var oPropertyGroup = oPropertyGroupTree.getFirstChild();
     // Get the properties for the node
     return getGroupProperties( oPropertyGroup, bTraverse, bRecurse );
    }
    
    /*********************************************************************/
    // Get the primary selection
    var oNode = Scene.getPrimarySelection();
    // If something is selected
    if( oNode ){
     // Get the properties available to the user by way of the selected node
     var aProperties = getNodeProperties( oNode, true, true );
     // Declare variables we'll be using as we iterate
     var oProperty, oOwner, oPresentation;
     // Iterate over all properties
     for( var i = 0; i < aProperties.length; i += 1 ){
      // Get the "current" property
      oProperty = aProperties[ i ];
      // Get the owner of the property
      oOwner = oProperty.getOwner();
      
      // Get the property's presentation
      oPresentation = oProperty.getPresentation();
      // If the property doesn't have a presentation, skip it
      if (oProperty.getLabel()=="SubDivision Level"){
       print(oProperty.getLabel());
       print(oProperty.getName());
      } else if(oProperty.getLabel()=="Resolution Level"){
       print(oProperty.getLabel());
       print(oProperty.getName());
      }
     }
    }
  • Richard HaseltineRichard Haseltine Posts: 100,882
    edited December 1969

    Find out what type of property it is with className(), but you will probably want getValueChannel.

    As for getting the members of an object, the trick Rob showed was to use:

    var itemToCheck = DzNode() ;
    
    for ( var member in itemToCheck ) {
     print ( member );
    }
  • ketthroveketthrove Posts: 63
    edited December 1969

    semidieu said:
    Another question - is it possible to get and set the values from the 'Property' object ? Here is a code (taken from Node Property.dsa in the samples and a little bit edited).

    This script will identify and display the Subdivision and Resolution level property. But I can't find a way to get it's value or set it's value!?!!

    
    /*********************************************************************/
    // Array :
    function getGroupProperties( oGroup, bTraverse, bRecurse )
    {
     // Declare an array to hold properties
     var aProperties = [];
     
     // If a group isn't passed in
     if( !oGroup ){
      // We're done, return an empty array
      return aProperties;
     // If a group is passed in
     } else {
      // Get the number of proeprties in the group
      var nProperties = oGroup.getNumProperties();
      // Pre-size the properties array
      aProperties = new Array( nProperties );
      // Iterate over the properties, setting each element in the array
      for( var i = 0; i < nProperties; i += 1 ){
       aProperties[ i ] = oGroup.getProperty( i );
      }
      
      // If we are recursing
      if( bRecurse ){
       // Concatenate the properties array from child groups
       aProperties = aProperties.concat( getGroupProperties( oGroup.getFirstChild(), bTraverse, bRecurse ) );
      }
      
      // If we are traversing
      if( bTraverse ){
       // Concatenate the properties array from sibling groups
       aProperties = aProperties.concat( getGroupProperties( oGroup.getNextSibling(), bTraverse, bRecurse ) );
      }
     }
     
     // Return the array of properties
     return aProperties;
    }
    
    /*********************************************************************/
    // Array :
    function getNodeProperties( oNode, bTraverse, bRecurse )
    {
     // Get the property group tree for the node
     var oPropertyGroupTree = oNode.getPropertyGroups();
     // Get the first group in the tree
     var oPropertyGroup = oPropertyGroupTree.getFirstChild();
     // Get the properties for the node
     return getGroupProperties( oPropertyGroup, bTraverse, bRecurse );
    }
    
    /*********************************************************************/
    // Get the primary selection
    var oNode = Scene.getPrimarySelection();
    // If something is selected
    if( oNode ){
     // Get the properties available to the user by way of the selected node
     var aProperties = getNodeProperties( oNode, true, true );
     // Declare variables we'll be using as we iterate
     var oProperty, oOwner, oPresentation;
     // Iterate over all properties
     for( var i = 0; i < aProperties.length; i += 1 ){
      // Get the "current" property
      oProperty = aProperties[ i ];
      // Get the owner of the property
      oOwner = oProperty.getOwner();
      
      // Get the property's presentation
      oPresentation = oProperty.getPresentation();
      // If the property doesn't have a presentation, skip it
      if (oProperty.getLabel()=="SubDivision Level"){
       print(oProperty.getLabel());
       print(oProperty.getName());
      } else if(oProperty.getLabel()=="Resolution Level"){
       print(oProperty.getLabel());
       print(oProperty.getName());
      }
     }
    }

    Int properties and Enum properties, which what the properties you are looking for are, have setValue, getValue functions.

Sign In or Register to comment.