Poser Python and Material Nodes



  • Quick question: Is there a way to distinguish selected nodes in Python? If not, it's not the end of the world, but it would be really convenient if I could identify which nodes were selected and just work with those.



  • @kobaltkween it doesn't appear so. The material method "Selected()" relates to which selections of materials the User has made in a SaveSelectedMaterials dialog, and not on which material is currently visible in the Material Room, let alone which node is currently selected.

    The only other relevant method relates to which output of a multi-output node is selected to determine which preview should be displayed in Compound Nodes and any other node type (usually Cycles) which has multiple outputs.



  • @kobaltkween on second thought, if you were prepared to move your selected nodes into a compound node and then extract them later, they would become nodes within the ShaderTree of the compound node itself, and thus immediately distinguishable from those nodes not previously selected.

    There doesn't seem to be a Python method to collapse selected nodes from within a script, but if you had the script record the positions of all the nodes in all the materials of the current actor, you could subsequently restore them if the collapse and expand manual processes had not done so. All very kludgey, as are so many things related to Poser's Python API. [Still thankful for what we already have, though]



  • How do you access the shader tree of a compound node, anyway? How do you handle them in general? I notice that the documentation says that CompoundData() returns an object that gives you access to specific methods, but then doesn't seem to list those methods anywhere.



  • @kobaltkween Chapter 16 of the reference manual . Page 465. Expanding compound nodes.



  • @eclark1849 Sorry, I wasn't clear. I know how to do it in the interface. I specifically meant through the Python API. You see, there's no ShaderTree() method for nodes. So my guess would be that you do it through one of the methods described in the explanation of the CompoundData() node method (Page 181 of the Poser Python Manual):
    "Get a data object providing access to compound-node-specific methods. If this is not a compound node, the return value will be None."

    The problem is that I can find absolutely no record of those "compound-node-specific methods." I can get the object, but without knowing how to access it's methods, I'd have to write some sort of script to just get the object to explain/describe its interface to me. Which is a PITA I'd like to avoid if I can.



  • Just in case someone else searches for this, these are the methods I'm finding so far:
    AttachTreeNodes
    ContainedNodes
    CreateNode
    DeleteNode
    DetachTreeNode
    ExposeInput
    ExposeOutput
    ExposedInputs
    ExposedInputsLocation
    ExposedOutputs
    ExposedOutputsLocation
    SetExposedInputsLocation
    SetExposedOutputsLocation

    I'm still not sure how one would use these methods to duplicate a compound node, but it seems I'm going to have to work on it.



  • Some more undocumented methods, for the NodeOutput object
    ConnectToInput
    InternalName
    ItsNode
    Name
    SetName