Skip to content
Snippets Groups Projects
Commit 46c41ca8 authored by Bastien Montagne's avatar Bastien Montagne
Browse files

We need no more that hack!

parent 5755991c
No related branches found
No related tags found
No related merge requests found
...@@ -148,28 +148,18 @@ class UI_OT_i18n_addon_translation_invoke(bpy.types.Operator): ...@@ -148,28 +148,18 @@ class UI_OT_i18n_addon_translation_invoke(bpy.types.Operator):
module_name = EnumProperty(items=enum_addons, name="Addon", description="Addon to process", options=set()) module_name = EnumProperty(items=enum_addons, name="Addon", description="Addon to process", options=set())
op_id = StringProperty(name="Operator Name", description="Name (id) of the operator to invoke") op_id = StringProperty(name="Operator Name", description="Name (id) of the operator to invoke")
# XXX Ugly hack! invoke_search_popup does not preserve ops' properties :(
_op_id = ""
def invoke(self, context, event): def invoke(self, context, event):
print("op_id:", self.op_id)
# XXX Ugly hack! invoke_search_popup does not preserve ops' properties :(
self.__class__._op_id = self.op_id
context.window_manager.invoke_search_popup(self) context.window_manager.invoke_search_popup(self)
return {'RUNNING_MODAL'} return {'RUNNING_MODAL'}
def execute(self, context): def execute(self, context):
print("op_id:", self.op_id, self.__class__._op_id)
if not self.op_id: if not self.op_id:
# XXX Ugly hack! invoke_search_popup does not preserve ops' properties :( return {'CANCELLED'}
if not self.__class__._op_id:
return {'CANCELLED'}
self.op_id = self.__class__._op_id
self.__class__._op_id = ""
op = bpy.ops op = bpy.ops
for item in self.op_id.split('.'): for item in self.op_id.split('.'):
op = getattr(op, item, None) op = getattr(op, item, None)
print(self.op_id, item, op) #print(self.op_id, item, op)
if op is None: if op is None:
return {'CANCELLED'} return {'CANCELLED'}
return op('INVOKE_DEFAULT', module_name=self.module_name) return op('INVOKE_DEFAULT', module_name=self.module_name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment