yes, you can pass parameters. First, you need to add properties to the class:
Code: Select all
class W3DMenu(bpy.types.Menu):
bl_label = "W3D"
bl_idname = "W3D_MT_menu"
your_parameter = bpy.props.StringProperty()
and_another = bpy.props.IntProperty()
def draw(self, context):
layout = self.layout
# file export
layout.operator(".w3d_test", text="Test")
then pass the arguments like:
Code: Select all
def draw(self, context):
layout = self.layout
layout.operator(".w3d_test", text="Test").your_parameter = "model"
for action_key in bpy.data.actions:
layout.operator(".w3d_test", text="Test").your_parameter = action_key
in case you wanna pass multiple arguments, do it like this:
Code: Select all
for i, action_key in enumerate(bpy.data.actions):
props = layout.operator(".w3d_test", text="Test")
props.your_parameter = action_key
props.and_another = i
I'm sitting, waiting, wishing, building Blender in superstition...