[Solved] Calling operator edge_slide, plz help

(taki) #1

Fairly new to bpy dev. I’m tring add edge slide to my quick menu, and I thought how hard can it be, just:

layout.operator(“transform.edge_slide”, text=“edge slide”)

However when I click this menu item. It acts as if slide is done with factor=0, no mouse move and helper dot line. I have to go lower left to manully adjust factor

I check blender official class VIEW3D_MT_editmeshtools(bpy.types.Menu), the slide menu item is same as my code, I must missing sth important, anyone point that out plz?

(starfox) #2

I am by no means an expert at python, but from the little I’ve played around with doing this sort of thing, you need to go to the menu item and right click, then select Copy Python Command. For Edge slide it should copy ‘bpy.ops.transform.edge_slide()’ I think this is what you need to add to your menu. Worth a try.

(taki) #3

I think yours is same as my code, actually, I just put the ops in a layout slot and give it a item label

(AFWS) #4
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("transform.edge_slide", text="edge slide")

(taki) #5

I know it’s the answer when I see it. Thanks!