Object Data

How do I make a Structure that retains the information for Position,Rotation and Scale.

Right now if you use the script below it only retains the position information of the selected objects.

Use:
1.Select Objects
2.Click the button
3.Move objects
4.Uncheck the button

result - the objects return to their original position. However i want them to return to there original position, rotation and scale.
Help is appreciated.
Thanks
JokerMartini

(
--//Variables
obj_collection = #() -- stores preview objects
obj_Node_collection = #() -- stores list objects node information

--//Functions
fn cacheObjNodes userSel =
(
obj_collection = #() -- stores preview objects
obj_Node_collection = #() -- stores original wirecolors
if userSel.count !=0 then
(
--// Storing the selected objects materials as arrays
for o in userSel do
(
try
(
m = o.pos
if m != undefined then
(
append obj_collection o
append obj_Node_collection m
)
)
catch
(
)
)

)
)

fn restoreObjNodes =
(
--// Restore previous materials
for i = 1 to obj_collection.count do
(
try
(
obj_collection[i].position= obj_Node_collection[i]
--obj_collection[i].scale = obj_Node_collection[i]
--obj_collection[i].rotation = obj_Node_collection[i]
)
catch
(
)
)
)

rollout rlStoreObjNode "Store Nodes"
(
checkbutton ckbtnStore "Store" width:140 height:40

on ckbtnStore changed st do
(
if st ==true then --// Button state checked TRUE
(
userSel =getCurrentSelection ()
cacheObjNodes userSel
print "I got you!"
)
else --// Button state checked FALSE
(
restoreObjNodes()
print "Back to normal!"
)
)
)
createDialog rlStoreObjNode 150 50 900 500
)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kilad's picture

just store the obj.transform

just store the obj.transform instead.

Graph's picture

wrong: --obj_collection[i].sc

wrong:
--obj_collection[i].scale = obj_Node_collection[i]
--obj_collection[i].rotation = obj_Node_collection[i]

right:
obj_collection[i].scale = obj_Node_collection[i]
obj_collection[i].rotation = obj_Node_collection[i]

Raphael Steves

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.