How to list all the properties of a group ?

hello,

I'm looking to list all the properties of a group name "ZBrush" but I can't figure out how to do

I can get the list of all pathes using :

const oNODE = Scene.getPrimarySelection(); 
if( oNODE ){
    const aGROUPS = oNODE.getPropertyGroups();
    const paths = aGROUPS.getAllPaths();
    var oProperty;
    for( var i = 0; i < paths.length; i++ ){
        oProperty = paths[ i ];
        print( oProperty );
    }
}

But what method can list all the properties (morphs) of a group ?

Thanks

Post edited by ratus69_c6741fefbf on

Comments

  • Richard HaseltineRichard Haseltine Posts: 96,849
    edited September 2016

    You need to get the actual PropertyGroups, using getDefaultgroup and getFirstChild, thenthen once you have that you can use getNextSibling on that to go through the top level groups, and recurse on get FirstChild on each group to go through their children. In each group use oGroup.getNumProperties() and then use a loop to get the properties with oGroup.getProperty( n ).

    Post edited by Richard Haseltine on
  • thanks Richard

    I have found a usefull script from Rob "Getting the properties associated with a node" here http://docs.daz3d.com/doku.php/artzone/wiki/user/rbtwhiz/technotes/daz_script/node_properties/start

    It lists all the Dzmorph in a recursive way that is useful

    but I can't achieve using getDefaultgroup with oNODE (const oNODE = Scene.getPrimarySelection();)

    when I try oNODE.getDefaultgroup () I get a oNODE.getDefaultgroup[Undefined] is not a function

  • You get the PropertyTree for the node, then the groups from that.

  • ratus69_c6741fefbfratus69_c6741fefbf Posts: 32
    edited September 2016

    ok I finally found out how to get a list of all the morphs present in a specific group, I just change the end of Rob's script to do so :

    /*********************************************************************/
    // Array<DzProperty> :
    function getGroupProperties( oGROUP, bTRAVERSE, bRECURSE ){
    	var aProperties = new Array();
    	if( !oGROUP ){ return aProperties; }
    	else{
    		const nPROPERTIES = oGROUP.getNumProperties();
    		for( var i = 0; i < nPROPERTIES; i++ ){
    			aProperties.push( oGROUP.getProperty( i ) );
    		}
     
    		if( bRECURSE ){ aProperties = aProperties.concat( getGroupProperties( oGROUP.getFirstChild(), bTRAVERSE, bRECURSE ) ); }
    		if( bTRAVERSE ){ aProperties = aProperties.concat( getGroupProperties( oGROUP.getNextSibling(), bTRAVERSE, bRECURSE ) ); }
    	}
     
    	return aProperties;
    }
     
    /*********************************************************************/
    // Array<DzProperty> :
    function getNodeProperties( oNODE, bTRAVERSE, bRECURSE ){
    	const oPROPERTY_GROUP_TREE = oNODE.getPropertyGroups();
    	const oPROPERTY_GROUP = oPROPERTY_GROUP_TREE.getFirstChild();
     
    	return getGroupProperties( oPROPERTY_GROUP, bTRAVERSE, bRECURSE );
    }
     
    /*********************************************************************/
    const oNODE = Scene.getPrimarySelection();
    if( oNODE ){
    	const aPROPERTIES = getNodeProperties( oNODE, true, true );
    	var oProperty, oOwner;
     
    	for( var i = 0; i < aPROPERTIES.length; i++ ){
    		oProperty = aPROPERTIES[ i ];
    		oOwner = oProperty.getOwner();

    oGroup = oProperty.getGroup()

    if( oGroup.name == "ZBrush" ){

    print( String( "%1 - %2 - %3").arg( oOwner.className() ).arg( oGroup.name ).arg( oOwner.name ) );

    oOwner.getValueChannel().setValue( .5 )

    oOwner.getValueChannel().setMin( 0 )

    }

    }

    }

    and here I get the name of the group with oGroup = oProperty.getGroup()

    and I set the channel value to a minimum of 0 for all the morphs with oOwner.getValueChannel().setMin( 0 )

    thanks for your help Richard

    Post edited by ratus69_c6741fefbf on
  •        ah, just to refine my script, is there a way to know which group is curently selected in the viewport ?

  • I'm not sure - it would probably be a pane method if so (use paneMgr to find the Parameters pane and then go through gettings its proeprties - there is at least one thread discussing that in this forum).

  • thanks Richard, I've found a script from Rob where I can get the selected morph

    here : http://www.daz3d.com/forums/discussion/37769/how-do-you-set-the-property-value-slider-in-the-parameters-tab

  • I had forgotten that discussion.

Sign In or Register to comment.