I think you’ll be less likely to run into issues (and able to keep your code 
cleaner) if you just use a running ID counter and don’t bother filling holes.

-Nathan



From: andi 
Sent: Monday, May 28, 2012 11:45 AM
To: [email protected] 
Subject: [Nuke-python] manage array of knob using ID sequence,which way to go?

Hi, here's my case : i want to create gizmo, this gizmo has a feature for user 
to add and delete button. each of these buttons creation will be attached to an 
#ID. so all the buttons is managed by array of IDs.
Now, let's say, user add 10 buttons : buton000, buton001.... buton009. Later, 
user will delete 3 of these button which will be for example : 003,004,008. So 
now i got 7 buttons left. My question is , i'm in the middle of making decision 
which way to apply id if user then add new button. 

First option is : find the 'hole' or 'gap' where id has been deleted ( in above 
example is 003,004,007) . So the deleted id will be used first for new button 
(to fill the gap in array).

second option : don't care about the gap, just use the last id (max number of 
id, in above case is #009) and continue from there.

Which way to go? maybe one will prefer first option and other prefer second . 
If anyone can share and why ? what is benefit of one over the other? as ID 
number getting bigger, is there gonna be problem with one of these method?

Thanx


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