adjust property "Use Limits" in script [SOLVED]

Hi Everyone,

This is probably a really easy answer but I have been looking through the API and several pages trying to find out how to set a control property to not "use limits" I will in turn be writing another script that turns the limits back on and then sets each of the mins and maxes to a certain integer. I know I can easily go to figure and then click on enable limits but I would really like to include it in my script.

How can I change the Set Limits of a property to on or off using a script?

Here is what I have so far that is of course not working

var limit = nodes[n].findPropertyByLabel( "limits" );	if(limit){		print("found it");		limit.setValue(true);	}

Thanks in advance for any help.

Post edited by jerickson_jel on

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,842
    edited January 2018

    use limit.setMin( value ), limit.setMax( Value ), and limit.setIsClamped( true or false ).

    Post edited by Richard Haseltine on
  • Syrus_DanteSyrus_Dante Posts: 983
    edited January 2018

    I can't recall if maybe someone else already done this in a script. Anybody know something about such a script?

    if((var limit = nodes[n].findPropertyByLabel( "limits" )) == true){}; //without an comparison in the if condition you get syntax errors
    How can I change the Set Limits of a property to on or off using a script?

    Oh as I read this - suddenly I understand what you want to do - you dont want to change the joint limits of the selected figure bone joints as I first thougth - but you want to change the Property limits of multible selected sliders / parameters / morphs / maybe Aliases also.

    I always start to think of this where can I find the options in the DazStudio Interface - if you want to do it manualy - you would start like this: switch to edit mode in the Parameters pane - then select multible Properties at once - and then right-click choose "Enable Limits of Selected". See the attached screenshot.

    You have to deal with the current Scene Selection with maybe props and figures and other nodes selected by iterating over them to fill the nodes[n] array.

    Next you need to search and find the properties you would like to change on the current Scene Selection in node[i] with a second for loop.

    Not an easy task but good luck.

     

    With my test object Null 1 I had Shift+selected all Properties under Transforms to change the limits on them.

    I checked the Parameters Settings for my selection and I saw they are all "ofType: Modifier/Pose".

    I think you would need to tell the script what sliders to pick from the selection and where to change the limits on them.

    ParametersPane_EditMode_MultiblePropertiesSelected_LimitsOnOff_1.png 584 x 584 - 67K

     

     

    ParametersPane_EditMode_MultiblePropertiesSelected_LimitsOnOff_1.png
    584 x 584 - 67K
    Post edited by Syrus_Dante on
  • use limit.setMin( value ), limit.setMax( Value ), and limit.setIsClamped( true or false ).

    Thanks Richard,  I just needed to the setIsClamped.  I already had the min and max figured out.  Here is my result

    nodes[ n ].getXRotControl().setMin(-3.0);nodes[ n ].getXRotControl().setMax(-2.0);	nodes[n].getXRotControl().setIsClamped(true);

     

    I will of course expand on this but this gets me going in the right direction.  Can you tell me what documentation page I missed that would have revealed the setIsClamped?  Either way thank you very much for the information.

  • http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/numericproperty_dz

    Clamping is the same for numeric properties and float properties, but the setMax and setMin functions have to differe (at least in the SDK) as one (DzNumericProperty) takes integers and the other (DzFloatProperty) takes floats, so you will find the min/max methods in DzFloatProperty but no the setIsClampable.

  • wonderful.  Thank you very much again You are an amazing wealth of information.

  • MariaTortilliaMariaTortillia Posts: 47
    edited January 2018

    is it possibe for a script to turn off limits on all surface parrameter settings in iray shaders?

    Post edited by MariaTortillia on
  • is it possibe for a script to turn off limits on all surface parrameter settings in iray shaders?

    It should be, but the consequences may not be desirable (certainly in the case of morphs and transforms a universal emoval of limits can have undesirable consequences). By one of your other posts you are not yourself a scripter, so you would do better to post in product Suggestions if you are hoping someone else will try to write such a script.

Sign In or Register to comment.