I can’t reproduce your crash with the code you have provided, even when the 
knob count is upped to 50. Can you provide any more of the code that is running 
from the button?

-Nathan



From: Simon Björk 
Sent: Tuesday, May 01, 2012 1:38 PM
To: [email protected] 
Subject: [Nuke-python] Re: Adding/Removing knobs and crashing

I've searched the archives and I've found that resetting the value of a knob 
before removing it helps. Also, adding a nuke.message("blabla") in the loop 
helps as well. It's almost like Nuke doesn't keep up with the python script. 

I should add that my full script creates two nodes within the group for each 
loop, and then add two link_Knobs to the main group node. Currently (with the 
above cheats), it works with 1 to around 6 loops, but if I go bigger, Nuke 
crashes.

Any ideas?



2012/5/1 Simon Björk <[email protected]>

  Hi all, 

  I've got a little group-node with a python button that adds nodes within the 
group and expose certain values via Link-knobs. It seems to work but often it 
causes Nuke to crash, especially if I run the script with high number of loops 
(above 10), and also setting it back to 1.

  I've attached some code that you can run on a node. It's very likely that I'm 
doing something wrong here, but I can't seem to find it myself. Just adjust the 
num variable to create different numbers of sliders.


  import re




  n = nuke.selectedNode()


  name = "tester"


  reg = re.compile(name)

  num = 10 




  for b in n.knobs():

  if reg.match(b):

  n.removeKnob(n.knobs()[b])




  for i in range(num):

  k = nuke.Link_Knob( name + str(i + 1) )

  n.addKnob(k) 



  Thanks.


  -- 
  --------------------------------
  Stiller Studios
  Lidingö/Sweden

  Simon Björk
  Stiller Studios
  +46 (0)8 555 23 560
  Ekholmsnäsvägen 40, S-181 41 Lidingö
  [email protected]
  www.stillerstudios.se

  find us: 
http://www.eniro.se/query?search_word=stiller+studios&geo_area=liding%F6&what=all







-- 
--------------------------------
Stiller Studios
Lidingö/Sweden

Simon Björk
Stiller Studios
+46 (0)8 555 23 560
Ekholmsnäsvägen 40, S-181 41 Lidingö
[email protected]
www.stillerstudios.se

find us: 
http://www.eniro.se/query?search_word=stiller+studios&geo_area=liding%F6&what=all





--------------------------------------------------------------------------------
_______________________________________________
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