how to manage ID of array of nodes

Hi, i’m creating a gizmo to draw marks (small crossmark) over the bg image , there’s ‘add’ button where the function is to spawn a new node(or mark) inside my gizmo – not at gizmo level (and the ‘mark’ is just my other simple gizmo for drawing a small cross mark) , so speak to the point , every single click of the ‘add’ buton will spawn a new node/mark and user can re-position it later. I probably end up with about 25 marks roughly. Every of these new mark have a unique ID to be tracked , and as for the naming, i’m using python to format it to make something like : mark_id0000 , mark_id0001, etc. And i add ‘delete’ button as well, so user can delete unused node/mark later. If anyone has experience in this kind of gizmo creation, my questions are :

1. what is the best workflow for managing ID for array of node, like mine , the total number of the new node to be spawned is roughly about 8-35, but i don’t limit it so user may add more (as i’m using 4 digits – it might handle thousands : 0000 – 9999), but anyway i have no problem to change to 2 digit padding (00-99) coz i really don’t need that much, it’s just my first design 🙂 . So I managed to bind the #ID to its name (id0000,id0001….etc). Is it more convenient this way , or better create a knob to hold the ID? so for every single node i spawn, i need to add new ie: integer knob to hold ID ? Is binding ID to the name is quite ‘secure’ and solid from future problem ? anyone has bad experience?

2. the ‘add’ button … it doesn’t just add/spawn new node , but for every spawning process , i also want to pick parameters from it and promote them at gizmo level , so user can play with it. the parameter are : translate and color. So user can manage to translate and to change color of any spawned marks. i want to know if ‘picking’ knob is possible using python? i couldn’t find it inside the documentation. If it’s not possible then the only way is to add new knobs for each spawned mark, and set the expression to link. Is this the best way?

3. when user delete any mark , so this will leave gap in ID array. do i need to keep track of these deleted elements? so when later user add new mark , it will re-use the deleted ID ( this will involve more works) . or just let it go, and deal with new ID ? which way is the better one? it’s related to database programming , so if anyone have any suggestion or experience, pls.

thanx

No Responses to “how to manage ID of array of nodes”

Post a Comment