View Full Version : Deleted Scene Nodes from an array when the objects are still there
12 December 2008, 02:05 PM
Im trying to run a loop using 2 arrays, one is a list of bones and the other is a list of control object names. I firstly declare my 2 arrays as follows;
faceBones = #(
contName = #(
Then I have the for loop declared as follows;
function renameControllers =
for i =1 to contName.count do
for b in faceBones do
b.pos.controller.Zero_Pos_XYZ.controller.X_Position.controller.setName i (contName[i] +"_Pos_X")
b.pos.controller.Zero_Pos_XYZ.controller.Y_Position.controller.setName i (contName[i] +"_Pos_Y")
When this runs I get an error saying;
Attempt to access deleted scene object
I have tried to just print b to see whats happening and I get told its a deleted scene object, but the objects are still there in my scene! Does anyone understand what I'm doing wrong?
12 December 2008, 02:26 PM
Does it tell you the scene node is deleted every time you evaluate the full script - including the initial array declaration?
The reason I ask is because if you have a variable or array value such as this:
And you then delete the object named "mySphere", then that array will have a deleted object.
If you then create a new object and name it "mySphere" as well, then the array will report a deleted object as the original 'mySphere' was deleted; the array stores a reference to the actual node, not to 'a node with the name mySphere'.
If you do get the error every time even if you (re-)initialize the array, could you post more of the actual setup / script you're using?
12 December 2008, 02:32 PM
OK here's and explanation of my scene setup. I have a facial skeleton, with bones listed as per the faceBones array (there are more but for sake of compactness I shortened it in the example above).
I then have several spline shapes which I am using to create an osipa style control interface (listend in the contName array, again this list is shorter in the example than my actual list).
The X and Y translations of the control objects are wired to float list controllers on the facial bones and the purpose of this bit of script is to rename the wired controllers of the float lists for easy visualisation of what each wire is connected to.
I am not deleting any objects in my scene, all that is being done is that when I wire to a controller the controller gets the default 'float_wire' name and i want to change this to Jaw_Pos_X or Jaw_Out_Pos_Y etc.
Also, the error occurs every time the script is run.
12 December 2008, 03:15 PM
I've figured out my issue. Further up in the script i had a step which loads my test scene and rather stupidly i had forgotten about this and i was declaring my array before the scene was loading.
12 December 2008, 08:50 PM
hehe - whoops(!) :) Glad it's solved :)
12 December 2008, 08:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.