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]> 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]> 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], 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

Reply via email to