Gizmos and callbacks for pure matrices

Hi folks,

I’m really at the end of my rope on this, and I figure it’s something obvious I’m missing.

The main idea: I want to mimic the move / scale / rotate handles in Blender, but I need them to drive a pure 4x4 matrix. I am using a workspace tool that has a gizmo group, which in turn (for the moment) creates instances of GIZMO_GT_arrow_3d.

I’ve noticed that when gizmos like this work, they generally call out to the transform operator. This allows the tool to go away while the transform operator works, but then when the transform operator finishes the tool comes back and re-runs its setup.

In my case, I don’t want the tool to disable at any point. While I drag on a specific arrow I want the others to hide, and when I release I want the others to become visible again. I also want the three manipulators’ matrix_basis values to stay in sync. The hiding is working fine; the sync is not. It seems that the offset of the handle sticks. When I go back to moving the handle that offset vanishes momentarily until release.

The goal here is to be able to use the stock gizmos to move around a Matrix like it’s a regular object because I would prefer to stand on all the bug fixes and edge case catching they currently do. I would like to set that matrix every draw, so that the transform I’m modifying updates as the user drags. I very much DO NOT want to create a temporary transform in the scene; I have gone down this road and it is a terrible, terrible road full of potholes and pain.

Can anyone please have a look at what I’m doing and tell me where I’ve gone wrong? I’d also love to know what the proper way for modifying the scene is. The best place so far, it seems, is to react in the draw function, but that is obviously not an option here.

Select an object this tool to see what I produced in the gif.

~ k

Some progress: Looks like allowing the other axes to pull their own offset values from callbacks helps:

It almost reacts properly, but there are remaining issues:

  • the axes you’re not pulling don’t move until release
  • if you hit G/R the axes don’t reset when the tool completes and you’re back to the custom tool here.

Any help?

What even is a Matrix?