How gizmo passes values to target_operator

In the demo rotate gizmo template, I cannot see how the actual rotation parameter is passed to ‘transform.rotate’ operator (gizmo setups other rotation props, but not actual rotation).

I tried something like this for my custom operator but it crashes blender:

arrow = self.gizmos.new("GIZMO_GT_arrow_3d")`
props = arrow.target_set_operator("mesh.rotate_face")
props.plane_co = Vector((arrow.target_get_value('offset')[0],0,0)) #seems to be crashing here
props.plane_no = Vector((1,0,0))

Also any info about gizmo matrices would be helpfull (offset matrix, space matrix?)

1 Like

Not being a Gizmo expert, here is something to try:

Run Blender from a console window (important)

Insert this line after you props = arrow... line:

print(arrow.target_get_value)

You will then know if this is a list and how long it is, then try this:

print(arrow.target_get_value[0])

To see what the value you are passing actually is, this may tell you where the problem lies.

Some hints - post all if not most of your code, post your OS and Blender version number, etc. it all helps us to help you and will get you more answers. We don’t know if you have defined your Gizmo properly, that might help solve the problem…

PS. Use pep8 standard for your coding. :thinking:

I know that arrow gizmo returns float, and other gizmos are returning 3x floats (Vectors).
I’m just not sure how to setup multiple gizmos eg: to send two variables form two gizmos to one operator which takes 2 parameters (plane_co, plane_no):
mpr.target_set_operator("face.rotate") #how to pass plance_co, plane_no to face.rotate() ?

I don’t think you can do that! You should have one Gizmo that sends both values AFAIK…

Basically I just want how to setup operator like build-in blender bisect mesh operator. It uses gizmo that defines both plane_center (with arrow), and place_normal (with rotate circle gizmo). So it looks like it can be done, but there is no documentation how to setups something like that.

Sorry, I don’t know that, maybe someone else can help here.