PDA

View Full Version : storing the hiearachy


charles-magne
09-28-2005, 01:51 PM
Hi,
I'm writing an exporter script that needs to rotate all the scene, and then export each object. I 'm doing the rotation by linking al the objects to a dummy in [0,0,0], and then rotating the dummy. At the end I rotate back and delete the dummy.

My problem is that the script destroys all the hierarchy. How can I store and recall that hierarchy ?

I could do
max hold
-- ....
max fetch #no prompt

but that's not very clean. Doing this the exporter plug-in won't remember its settings... That's almost what I want to achieve but I need to do it another way.

Bobo
09-28-2005, 02:16 PM
Hi,
I'm writing an exporter script that needs to rotate all the scene, and then export each object. I 'm doing the rotation by linking al the objects to a dummy in [0,0,0], and then rotating the dummy. At the end I rotate back and delete the dummy.

My problem is that the script destroys all the hierarchy. How can I store and recall that hierarchy ?

I could do
max hold
-- ....
max fetch #no prompt

but that's not very clean. Doing this the exporter plug-in won't remember its settings... That's almost what I want to achieve but I need to do it another way.


A relatively easy way to do it is to link only the "children of the world" to the dummy, not all objects. Those with parents will move with them anyway


theParentlessArray = for o in objects where o.parent == undefined collect o
theDummy = Dummy()
theParentlessArray.parent = theDummy
theDummy.rotation = quat 90 [1,0,0]
--export the scene
theDummy.rotation = quat 0 [1,0,0]
delete theDummy --this makes the parent of all objects in theParentlessArray undefined again.

charles-magne
09-28-2005, 02:24 PM
thanks a lot ! The answer is quite simple, shame on me I didn't find it myself...

CGTalk Moderation
09-28-2005, 02:24 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.