Author Topic: Get and Set Node Output Size Mode  (Read 298 times)

Is it possible to get and set the output size mode for a given node? The $outputsize seems to imply that 0,0 is relative, but I don't know to what (the graph or the input).

My goal, is to iterate over all or selected bitmaps, and set them to "relative to parent"

Here's a rough snippet that shows how to change the inheritance of a property.

Code: [Select]
        pkg = aContext.getSDApplication().getPackageMgr().getUserPackages()[0]  # Target first package only.
        graph = pkg.getChildrenResources(False)[0]  # Target first graph only.
       
        # Create bmp node.
        bmp_node = graph.newNode('sbs::compositing::bitmap')
       

        ##### CODE CONTAINED BELOW IS RELEVANT TO YOUR QUESTION #####
        # Get property object and inheritance value.
        out_size_prp = graph.getPropertyFromId('$outputsize', sdproperty.SDPropertyCategory.Input)
        out_size_inheritance = bmp_node.getPropertyInheritanceMethod(out_size_prp)   # Get inheritance.
       
        # Change inheritance value.
        bmp_node.setPropertyInheritanceMethod(out_size_prp, sdproperty.SDPropertyInheritanceMethod.RelativeToParent)  # Set inheritance.
        #####

        # Show result.
        # In my case both before and after values will be "RelativeToParent" since I'm creating the bmp node and its default inheritance is "RelativeToParent".
        # In your case it should show the value changing from "Absolute" to "RelativeToParent".
        print ('Output size: {before} > {after}'.format(before=out_size_inheritance,
                                                        after=bmp_node.getPropertyInheritanceMethod(out_size_prp)))


Beautiful! Thanks a lot NevTD.