Rotate object pivot and reset transforms

Hi there.

I´m doing an addon to be able to modify the object pivot manually, you activate a button, then you get an axis that you can translate, rotate and scale, and when you are done you press again that button and the object pivot changes, but JUST THE PIVOT

So far I´m having problems with rotations, I´m trying to do this using delta transforms, so far what I do is to get the euler or quaternionr (I ried with both) rotation of the axis object i´ve created, then I apply that rotation in the Delta Transforms of the target object, after that I apply the same value but multiplied by “-2” to counteract the delta transform effect, so far the counter action don´t seem to work until you apply the rotation, then the object should stay the same but the pivot should be rotated.

And of course… it´s not working at all probably because that thing of appiying to the rotation the -2 of the rotation of the other object is a non-sense that I don´t know when grew up in my mind.

So… so far what I want to give to the user is to be able to rotate that axis and when the user is finishes the object stays visually the same (without modifying the geometry inside it) but the axis gets rotated.

Can someone please help me here, I´m a bit lost, the functionality is similar to the one found in 3dsmax named “affect pivot only” where you can transform the object´s pivot without affecting the objects´s inside.

Cheers and thanks in advance!

TO clarify a bit more things, what I said work if I use just one axis, these are the steps to follow:

1.- Rotate the object X axis in delta 45º
2.- Rotate the object X axis transform -90º
3.- Apply rotation
4.- You will have the object unmodified but with it´s local axis orientation modifed 45º in X

The problem comes when I try to do that in more than one axis, no matter if I use Euler or Quaternion, I can´t reach a solid result when I modify more than one axis.

Cheers and thanks in advance!

So I think I solved it, of course I should be using Matrices instead of Quaternions or Eulers, once I converted things to a Matrix all worked out flawleshly so GREAT!

I´ll publish the add-on as soon as I have it ready, traslation and scale seems to be the easy part to do :slight_smile:

Cheers!

And BTW is not the double negative of the rotation, but the squared negative of the rotation the value I should use in Rotation to counteract deltas and have the object unmodified

Cheers!

Eagerly anticipating!

That should be awsome. :slight_smile: Waiting to see the addon.

So are you making a modal operator that will move, rotate and scale the pivot?