Notifications
Clear all

[Closed] ResetXform but keep instanced objects

I’ve searched for this quite much and there seem to be no solution, but I wanted to make sure; is there any method to resetXform but keep instancing for instanced objects?

6 Replies

There are more than 1 solution for all tasks in Max. Or more ways to same solution.

What do you mean with ” instanced objects”?
You can instance creation parameters, modifiers, animation/transform controllers…

Don’t like to propose any solution on undefined questions but, you know for “Dont affect children” option in Hierarchy panel?

1 Reply
(@haider_of_sweden)
Joined: 10 months ago

Posts: 0

Clones objects with the option Instance. That’s called “instanced objects” isn’t it?

Resetting transform will not brake instancing.

You are probably talking about collapsing (to another object)?
So losing/changing some controllers.

1 Reply
(@haider_of_sweden)
Joined: 10 months ago

Posts: 0

you’re right of course! That’s when the problem occurs.
So, lets properly define the question then: how can I collapse after resetXform and keep the instancing

ResetXForm doesn’t reset instancing. Collapse Stack does do it. There is no built-in option to keep instancing after stack collapsing.
But… you can do it using your custom code:

example scene setup –

delete objects 

b = box width:10 length:25 height:15 
rotate b (eulerangles 45 45 45)
for k=1 to 3 do instance b pos:[k*20,0,0] rotation:(eulerangles (k*30) (k*30) (k*30)) wirecolor:(b.wirecolor * 0.5)

the code idea:

fn resetXFormAdvanced node = 
(
	InstanceMgr.GetInstances node &insts
	tm = node.transform

	resetXform node
	collapseStack node

	for i in insts where i != node do 
	(
		instancereplace i node
		i.transform *= inverse i.objecttransform * (inverse tm * i.transform)
	)
)

resetXFormAdvanced b
 

In real life everything is much more complicated. Instanced objects might be children of different parents. But… it will be a different story.

Just a short reply before calling it a day; Collapse in general can keep instancing if you do “Collapse to”. However, that doesn’t work with Xform in the stack. Xforms are added as if the object is a Reference, not an Instance (it places a “divider” in the stack).

Thanks in advance for your code, I’ll have to look into it tomorrow. I can tell you this much though. The case where I would need this is way not complicated. No children involved or anything. Just plain instanced objects.