""Although I would strongly recommend managing the bounding box through the merge node itself most of the time."

I was about to say just that. There are very few occasions where a Crop node after a Merge makes sense. Most of the time adjusting the bbox knob in the Merge node instead will make sure a much tidier and efficient node tree.


On 18/04/15 4:39 am, Erwan Leroy wrote:

Everybody answered while I was writing and testing mine, now I feel like my code is quite long compared to Bruno-Pierre's.

Although I would strongly recommend managing the bounding box through the merge node itself most of the time.

def cropAfterMerge(nodes):
    listOfMerges = []
    for node in nodes:
        node.knob("selected").setValue(False)
        if node.Class() == "Merge2":
            listOfMerges.append(node)
    for merge in listOfMerges:
        merge.knob("selected").setValue(True)
        crop = nuke.createNode("Crop")
        merge.knob("selected").setValue(False)
        crop.knob("selected").setValue(False)

cropAfterMerge(nuke.selectedNodes())

On 18 Apr 2015 19:30, "Bruno-Pierre Jobin" <[email protected] <mailto:[email protected]>> wrote:

    Forgot the capital S at selected.

    for i in nuke.allNodes('Merge2'):
    i.setSelected(True)
    nuke.createNode('Crop')

    On Saturday, April 18, 2015, Bruno-Pierre Jobin <[email protected]
    <mailto:[email protected]>> wrote:

        I would do something like this :


        For i in nuke.allNodes('Merge2'):
            i.setselected(True)
            nuke.createNode('Crop')

        On Saturday, April 18, 2015, Tejas Kantharia
        <[email protected]> wrote:

            hi,
            i want to create a crop node for the selected merge nodes
            but the problem i'm having is all crop nodes are created
            when the first merge node is found. is there any way to
            solve it ? to create a crop node after every merge node .
            Thanks,
            Tejas



-- Bruno-Pierre Jobin



-- Bruno-Pierre Jobin


    _______________________________________________
    Nuke-python mailing list
    [email protected]
    <mailto:[email protected]>,
    http://forums.thefoundry.co.uk/
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python



_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

--

Vfx Supervisor | Lumen
o: 747-200-2063
c: 818-433-9056


ohufxLogo 50x50 <http://www.ohufx.com>    

*vfx for storytellers <http://www.ohufx.com>*

*vfx compositing <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation & consulting <http://ohufx.com/index.php/vfx-customising>* *

**

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to