Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-16 01:40:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-16 01:40:33 +0300
commit5272991e8b91c527fbe3923d75ae2c5148dd7177 (patch)
tree84c871abe7d084a775ff7ffab5033c08d085ed32 /release
parent2b3a6b38b764717878de39a97feeee186e3694ad (diff)
generic operator menu was searching for "type" and using the first enum property if it wasnt found.
this is too arbitrary and could break if roperty order is changed. store the property in the operator type that is to be used for menu and enum search func's. python function for searching operator enums on invoke. (just need dynamic python enums now) wm.invoke_search_popup(self)
Diffstat (limited to 'release')
-rw-r--r--release/scripts/templates/operator.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/release/scripts/templates/operator.py b/release/scripts/templates/operator.py
index f175ca06f28..92fbdaee989 100644
--- a/release/scripts/templates/operator.py
+++ b/release/scripts/templates/operator.py
@@ -19,6 +19,11 @@ class ExportSomeData(bpy.types.Operator):
path = StringProperty(name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= "")
use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default= True)
+ type = bpy.props.EnumProperty(items=(('OPT_A', "First Option", "Description one"), ('OPT_B', "Second Option", "Description two.")),
+ name="Example Enum",
+ description="Choose between two items",
+ default='OPT_A')
+
def poll(self, context):
return context.active_object != None
@@ -39,13 +44,18 @@ class ExportSomeData(bpy.types.Operator):
# File selector
wm.add_fileselect(self) # will run self.execute()
return {'RUNNING_MODAL'}
- elif 0:
+ elif True:
+ # search the enum
+ wm.invoke_search_popup(self)
+ return {'RUNNING_MODAL'}
+ elif False:
# Redo popup
return wm.invoke_props_popup(self, event) #
- elif 0:
+ elif False:
return self.execute(context)
+
bpy.types.register(ExportSomeData)
# Only needed if you want to add into a dynamic menu
@@ -53,4 +63,4 @@ menu_func = lambda self, context: self.layout.operator("export.some_data", text=
bpy.types.INFO_MT_file_export.append(menu_func)
if __name__ == "__main__":
- bpy.ops.export.some_data(path="/tmp/test.ply")
+ bpy.ops.export.some_data('INVOKE_DEFAULT', path="/tmp/test.ply") \ No newline at end of file