Select a strand based hair object

Causam3DCausam3D Posts: 212

Forgive the noob question.
I am trying to find a script or at least a function that will select a strand based hair object so that I can set its subd level.  I tried a script I use to set visibility on nodes with a given tag.  It finds the object with that tag and then sets visibility.  Right away though, I get an error with the SBH object that the object doesn't exist.  I take that to mean that SBH is not considered an object.  So I'm stuck at the first task, which is to find the object.  I want people to be able to do this without finding the object in the scene tab, to make it easier.

Error:
 

Script Error: Line 34

TypeError: Result of expression 'oBtn1' [null] is not an object.

Can someone please point me in the right direction?

Thanks for any help.

 

Post edited by Causam3D on

Comments

  • Causam3DCausam3D Posts: 212

    Nevermind, found findNodebyLabel.  That works.

  • Richard HaseltineRichard Haseltine Posts: 100,961

    That does assume that the label includes "dForce", which is not guaranteed. You might want to search for

    site:docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples "DzLineTessellationModifier"

    to see a more reliable way to handle this using the modifier.

  • OmnifluxOmniflux Posts: 377

    I tend to avoid findNodebyLabel (and related methods) and prefer findNode when possible because while both name and label can be changed by the user, label is more likely to be changed due to being the visible portion.

    This said, however, label is more likely to be unique, as an item imported multiple times in a scene will automatically be assigned unique labels '(1), (2), ...', while the name will remain the same.

  • Thanks Richard, but I get a 404 error on that.  I'm picking this project back up again after having dropped it back then.  I did find a function for setting subd, however, it relies on if the node class name is "DzBone" which strand based hair must not be, since the script executes without error but doesn't actually do anything.  This DzLine might be what I need, though, I'll check into it. 

    Richard Haseltine said:

    That does assume that the label includes "dForce", which is not guaranteed. You might want to search for

    site:docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples "DzLineTessellationModifier"

    to see a more reliable way to handle this using the modifier.

  • OmnifluxOmniflux Posts: 377
    edited September 2022

    Strand based hair is DzStrandHairNode  (which is a subclass of DzFigure) which gives you access to node.getObject().getCurrentShape().getSubDRenderLevelControl().setValue(...). Not sure if that is what you are looking for...

    Edit: was looking at wrong node

    Post edited by Omniflux on
  • Based on this post: Strand Based Hair Vertex Info?

    I think you may be looking for DzStrandHairNode.setRenderLineTessellationSides(...)

     

    Methods for this undocumented (and therefore subject to change) class (excluding those for DzNode) in 4.20.0.17 are

    • getApplyTransformation()
    • getApplyTransformationControl()
    • getPreviewPreRenderHairs()
    • getPreviewRenderHairsControl()
    • getPrimBucketExpandPercentage()
    • getPrimBucketExpandPercentageControl()
    • getPrimBucketMaxDivisions()
    • getPrimBucketMaxDivisionsControl()
    • getPrimBucketMaxSize()
    • getPrimBucketMaxSizeControl()
    • getRenderLineTessellationSides()
    • getRenderLineTessellationSidesControl()
    • getRenderMethod()
    • getRenderMethodControl()
    • getRenderPercent()
    • getRenderPercentControl()
    • getTargetNode()
    • getTargetNodeControl()
    • getUnparentOnLoad()
    • getUnparentOnLoadControl()
    • launchEditor()
    • launchEditor(EditorMode)
    • markRenderGeometryChanged()
    • renderLineTessellationSidesChanged()
    • requestUpdateCurves()
    • setApplyTransformation(bool)
    • setPreviewPreRenderHairs(bool)
    • setPrimBucketExpandPercentage(float)
    • setPrimBucketMaxDivisions(int)
    • setPrimBucketMaxSize(float)
    • setRenderLineTessellationSides(int)
    • setRenderMethod(RenderMethod)
    • setRenderPercent(float)
    • setTargetNode(DzNode*)
    • setUnparentOnLoad(bool)
    • syncShapeMaterialsWithSystem()
    • syncShapeMaterialsWithSystem(DzMaterialList*)

     

Sign In or Register to comment.