Notifications
Clear all

[Closed] Copying Gizmos from one modifier to the next

Having trouble copying modifier gizmo transforms from one object to the next. It works if you don’t introduce too many transforms, but the moment you transform both objects and transform their gizmos, you end up getting odd results. This line works in simple cases…

b.modifiers[#Bend].gizmo.transform = (s.modifiers[#Bend].gizmo.transform * s.objecttransform) * inverse b.objecttransform

But here’s a more complex example, which doesn’t work…


-- make and transform sphere
s = Sphere()
move s [10,5,-10]
scale s [1.1,2,1]
rotate s (angleaxis 25 [1,0,0])
addmodifier s (bend())
s.modifiers[#Bend].gizmo.rotation += quat 0 0 0.25 0.9
-- make and transform box
b = Box()
move b [20,15,-1]
scale b [2,1.1,1.6]
rotate b (angleaxis -40 [0,0,1])
addmodifier b (bend())
b.modifiers[#Bend].gizmo.rotation += quat 0 0.5 0.12 0.9
-- try and copy gizmo transform from sphere to box
b.modifiers[#Bend].gizmo.transform = (s.modifiers[#Bend].gizmo.transform * s.objecttransform) * inverse b.objecttransform

Any ideas?

  • Neil
11 Replies

I am still hunting for the perfect solution, but you could take a look at what I have so far in my gizmoControl script: http://scripts.breidt.net/index.html#gizmoControl – the script allows you to link any gizmo to any other scene node.

FWIW, there is .transform, .objecttransform as well as the matrix retrieved by getModContextTM(). And each gizmo has it’s own transform controller, too.

Great, isn’t it?

– MartinB

Thanks Martin, I believe you’ve sent me to your script once before, and I’ve never been intelligent enough to figure out how to use any of that code for anything But glad to know I’m not the only one who’s never found the perfect solution. I get the feeling the only way this will be resolved is if the developpers themselves intervene, since there’s just too many transforms involved to get a clean answer Thanks for the help anyways.

  • Neil

hey neil,
try this

b.modifiers[1].gizmo.value = s.modifiers[1].gizmo.value * s.objectTransform * inverse b.objectTransform

mark

1 Reply
(@artofsoulburn)
Joined: 11 months ago

Posts: 0

Nope, the two gizmos are not the same after the operation. But thanks for trying.

  • Neil

neil , for me the gizmo transforms are the same , i.e they have the same world space transform

-- make and transform sphere
  s = Sphere()
  move s [10,5,-10]
  scale s [1.1,2,1]
  rotate s (angleaxis 25 [1,0,0])
  addmodifier s (bend())
  s.modifiers[#Bend].gizmo.rotation += quat 0 0 0.25 0.9
  -- make and transform box
  b = sphere()
  move b [20,15,-1]
  scale b [2,1.1,1.6]
  rotate b (angleaxis -40 [0,0,1])
  addmodifier b (bend())
  b.modifiers[#Bend].gizmo.rotation += quat 0 0.5 0.12 0.9
  -- try and copy gizmo transform from sphere to box
  b.modifiers[1].gizmo.value = s.modifiers[1].gizmo.value * s.objectTransform * inverse b.objectTransform

whats different when you use a box and sphere is the center offset and the offset from the pivot and the center of the bounding box

1 Reply
(@artofsoulburn)
Joined: 11 months ago

Posts: 0

So how would you compensate for that? If you’re copying “transforms” around, instead of individual pos, rotation, scale values, how do you inject the pivot offset into the equation?

  • Neil

what exactly are you trying to do ?

mark

I have 2 objects, each with a seperate modifier (the two modifiers will be the same sort of modifier, in my example, bend). I want to copy the first gizmo’s transforms to the second one so that if you flip between the two objects, the modifier is exactly the same size, position and rotation in world space.

  • Neil

nope couldnt get it yet… something missing
mark

If you can figure out how to do this, I’ll buy ya a beer! (or several)

  • Neil

you’ll probably have to compensate for the different modifier context bounding boxes as well?

getModContextBBoxMin / getModContextBBoxMax