Gizmos require a target to act upon.
Manipulating the gizmo will act upon either:
These are set by calling one of the following methods:
target_set_prop(target, data, property, index=-1)
target_set_handler(target, get, set, range=None)
The second of these return an Operator Properties object which you can then set. Still researching this and need to run some tests but I believe that the second one is what you are looking for. Please see the documentation for these methods
gizmo_operator_target.py template for an example using the transform operator.
gizmo_operator.py template for an example that performs a more complex operation using the callback method.
Callbacks made easy
It's quite difficult to see what's going on in the template example so I have prepared a simpler version:
def setup(self, context):
arrow = self.gizmos.new("GIZMO_GT_arrow_3d")
context.object.location.x = value
arrow.target_set_handler("offset", get=move_get_x, set=move_set_x)
arrow.matrix_basis = context.object.matrix_world.normalized()
self.x_gizmo = arrow
def refresh(self, context):
self.x_gizmo.matrix_basis = context.object.matrix_world.normalized()
In order to manipulate a gizmo independently you will have to look at the matrix_basis property.
Simply commenting out the last line in the refresh method will leave the gizmo where it first instantiated:
#self.x_gizmo.matrix_basis = context.object.matrix_world.normalized()
If you want to keep the gizmo with the object then you need to update matrix_basis accordingly.
Another option is to subclass gizmo, unfortunately I haven't had time to write up an example of this but it is another avenue to explore.
You might also want to look at using the matrix_offset to retrieve information about the change.
If this still isn't quite what you're looking for then you can consider using an empty and attach the gizmp to that instead.
You might also want to look at this question.