Re: [Nuke-users] adding a user knob to a default node

2011-03-18 Thread Ivan Busquets
I think the most adequate options would be:

A- Make a onUserCreate callback that adds your custom userKnob every time a
CornerPin node is user-created
or...
B- Override nuke.createNode with your own function, and check in there
whether the node being created is a CornerPin. If it is, then you can
proceed with creating your custom Knob. If not, just call the original
nuke.createNode function.

I would probably choose A for this particular case, but B could be a better
choice if you have other standard nodes that you want to have your custom
version of.

Examples:

A: (using a OnUserCreate callback)

def addCornerPinButton():
n = nuke.thisNode()
k = nuke.PyScript_Knob('userKnob', 'userKnob', '')
n.addKnob(k)

nuke.addOnUserCreate(addCornerPinButton, nodeClass = 'CornerPin2D')


B: (overriding nuke.createNode() with your own function)

def createCustomNodes(nodeClass, knobs = , inpanel = True):
node = nukeOriginalCreateNode(node = nodeClass, knobs = knobs, inpanel =
inpanel)
if nodeClass == CornerPin2D:
k = nuke.PyScript_Knob('userKnob', 'userKnob', '')
node.addKnob(k)
return node

nukeOriginalCreateNode = nuke.createNode
nuke.createNode = createCustomNodes


Hope that helps.

Cheers,
Ivan


On Thu, Mar 17, 2011 at 4:07 PM, glouk gl...@glouk.org wrote:

 Hi,

 I would like to add by default a userKnob (python button) to every
 cornerpin that i create...
 (this button copies the values of the from to the to, which i find very
 practical in everyday compositing)

 is there a way to do that in menu.py ? got any ideas ?

 thanks

  glouk http://www.imdb.com/name/nm0522119/

 Highly illogical, Captain.

 http://demo.glouk.org/



 ___
 Nuke-users mailing list
 Nuke-users@support.thefoundry.co.uk
 http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users


___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users


Re: [Nuke-users] adding a user knob to a default node

2011-03-18 Thread Johan Boije
You are not alone in wanting more copy back and forth functions in the
cornerpin node. So if you are not dying to do this yourself this has already
been done by others:

http://www.nukepedia.com/gizmo-downloads/transform/better_cornerpin/

http://www.nukepedia.com/python-scripts/misc/im_cornerpin/

http://www.creativecrash.com/nuke/downloads/gizmos/transform/c/tunedcp2d

I havent tried all of them.

Cheers,
Johan



On Fri, Mar 18, 2011 at 12:07 AM, glouk gl...@glouk.org wrote:

 Hi,

 I would like to add by default a userKnob (python button) to every
 cornerpin that i create...
 (this button copies the values of the from to the to, which i find very
 practical in everyday compositing)

 is there a way to do that in menu.py ? got any ideas ?

 thanks

  glouk http://www.imdb.com/name/nm0522119/

 Highly illogical, Captain.

 http://demo.glouk.org/



 ___
 Nuke-users mailing list
 Nuke-users@support.thefoundry.co.uk
 http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users


___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users


Re: [Nuke-users] adding a user knob to a default node

2011-03-18 Thread glouk
thank you very much.

i'll try method A

Johan, the code is already written. I'm just looking for a way to include it 
automatically. But thanks for the links, i'll have a look.

cheers

Le vendredi 18 mars 2011 08:14:21, Ivan Busquets a écrit :
 I think the most adequate options would be:
 
 A- Make a onUserCreate callback that adds your custom userKnob every time a
 CornerPin node is user-created
 or...
 B- Override nuke.createNode with your own function, and check in there
 whether the node being created is a CornerPin. If it is, then you can
 proceed with creating your custom Knob. If not, just call the original
 nuke.createNode function.
 
 I would probably choose A for this particular case, but B could be a better
 choice if you have other standard nodes that you want to have your custom
 version of.
 
 Examples:
 
 A: (using a OnUserCreate callback)
 
 def addCornerPinButton():
 n = nuke.thisNode()
 k = nuke.PyScript_Knob('userKnob', 'userKnob', '')
 n.addKnob(k)
 
 nuke.addOnUserCreate(addCornerPinButton, nodeClass = 'CornerPin2D')
 
 
 B: (overriding nuke.createNode() with your own function)
 
 def createCustomNodes(nodeClass, knobs = , inpanel = True):
 node = nukeOriginalCreateNode(node = nodeClass, knobs = knobs, inpanel
  = inpanel)
 if nodeClass == CornerPin2D:
 k = nuke.PyScript_Knob('userKnob', 'userKnob', '')
 node.addKnob(k)
 return node
 
 nukeOriginalCreateNode = nuke.createNode
 nuke.createNode = createCustomNodes
 
 
 Hope that helps.
 
 Cheers,
 Ivan
 
 On Thu, Mar 17, 2011 at 4:07 PM, glouk gl...@glouk.org wrote:
  Hi,
 
  I would like to add by default a userKnob (python button) to every
  cornerpin that i create...
  (this button copies the values of the from to the to, which i find
  very practical in everyday compositing)
 
  is there a way to do that in menu.py ? got any ideas ?
 
  thanks
 
   glouk http://www.imdb.com/name/nm0522119/
 
  Highly illogical, Captain.
 
  http://demo.glouk.org/
 
 
 
  ___
  Nuke-users mailing list
  Nuke-users@support.thefoundry.co.uk
  http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
 

-- 

glouk 

Highly illogical, Captain.

___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users


Re: [Nuke-users] adding a user knob to a default node

2011-03-18 Thread Johan Boije
Aha. Share on Nukepedia if you can. We can never have too many cornerpins.
That copy functionality should really be there out of the box as well as an
invert button me thinks. But that's the beauty of customization I guess, if
it's not there just build it yourself.

J.

On Fri, Mar 18, 2011 at 2:02 PM, glouk gl...@glouk.org wrote:

  thank you very much.

 i'll try method A

 Johan, the code is already written. I'm just looking for a way to include
 it automatically. But thanks for the links, i'll have a look.

 cheers

 Le vendredi 18 mars 2011 08:14:21, Ivan Busquets a écrit :

  I think the most adequate options would be:

 

  A- Make a onUserCreate callback that adds your custom userKnob every time
 a

  CornerPin node is user-created

  or...

  B- Override nuke.createNode with your own function, and check in there

  whether the node being created is a CornerPin. If it is, then you can

  proceed with creating your custom Knob. If not, just call the original

  nuke.createNode function.

 

  I would probably choose A for this particular case, but B could be a
 better

  choice if you have other standard nodes that you want to have your custom

  version of.

 

  Examples:

 

  A: (using a OnUserCreate callback)

  

  def addCornerPinButton():

  n = nuke.thisNode()

  k = nuke.PyScript_Knob('userKnob', 'userKnob', '')

  n.addKnob(k)

 

  nuke.addOnUserCreate(addCornerPinButton, nodeClass = 'CornerPin2D')

  

 

  B: (overriding nuke.createNode() with your own function)

  

  def createCustomNodes(nodeClass, knobs = , inpanel = True):

  node = nukeOriginalCreateNode(node = nodeClass, knobs = knobs, inpanel

  = inpanel)

  if nodeClass == CornerPin2D:

  k = nuke.PyScript_Knob('userKnob', 'userKnob', '')

  node.addKnob(k)

  return node

 

  nukeOriginalCreateNode = nuke.createNode

  nuke.createNode = createCustomNodes

  

 

  Hope that helps.

 

  Cheers,

  Ivan

 

  On Thu, Mar 17, 2011 at 4:07 PM, glouk gl...@glouk.org wrote:

   Hi,

  

   I would like to add by default a userKnob (python button) to every

   cornerpin that i create...

   (this button copies the values of the from to the to, which i find

   very practical in everyday compositing)

  

   is there a way to do that in menu.py ? got any ideas ?

  

   thanks

  

   glouk http://www.imdb.com/name/nm0522119/

  

   Highly illogical, Captain.

  

   http://demo.glouk.org/

  

  

  

   ___

   Nuke-users mailing list

   Nuke-users@support.thefoundry.co.uk

   http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

 


 --

 glouk http://www.imdb.com/name/nm0522119/

 Highly illogical, Captain.


 ___
 Nuke-users mailing list
 Nuke-users@support.thefoundry.co.uk
 http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users


___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users