changed operator
This commit is contained in:
1 parent
732a647572
commit
915c8c8225
2 files changed
+13
-8
No files matched your search
@@ -1,26 +1,30 @@
|
||||
"""Operators."""
|
||||
|
||||
import bpy
|
||||
import json
|
||||
|
||||
class WTDBuildOp(bpy.types.Operator):
|
||||
class WTDGetOidForPath(bpy.types.Operator):
|
||||
|
||||
bl_idname = "wtd_tools.build"
|
||||
bl_label = "Build"
|
||||
bl_idname = "wtd_tools.getoidforpath"
|
||||
bl_label = "Get Oid For Open Scene"
|
||||
|
||||
def execute(self, context):
|
||||
oid = ""
|
||||
if bpy.ops.kabaret.cmds_call(
|
||||
actor_name="Flow",
|
||||
cmd_name="action_needs_dialog",
|
||||
args_json=json.dumps([oid]),
|
||||
cmd_name="getoidforpath",
|
||||
args_json=json.dumps([]),
|
||||
kwargs_json=json.dumps({'path': bpy.data.filepath.replace('\\', '/')}),
|
||||
) == {"FINISHED"}:
|
||||
result = json.loads(bpy.context.window_manager.kabaret_ipc_last_result)
|
||||
self.report({'INFO'}, str(result))
|
||||
else:
|
||||
error = bpy.context.window_manager.kabaret_ipc_last_error
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def register() -> None:
|
||||
bpy.utils.register_class(WTDBuildOp)
|
||||
bpy.utils.register_class(WTDGetOidForPath)
|
||||
|
||||
def unregister() -> None:
|
||||
bpy.utils.unregister_class(WTDBuildOp)
|
||||
bpy.utils.unregister_class(WTDGetOidForPath)
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Sidebar UI."""
|
||||
|
||||
import bpy
|
||||
from . import ops
|
||||
|
||||
|
||||
# Panel like kabaret ipc
|
||||
@@ -26,7 +27,7 @@ class WTDToolsMenu(bpy.types.Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator("wtd_tools.build", text="Build")
|
||||
layout.operator(ops.WTDGetOidForPath.bl_idname, text=ops.WTDGetOidForPath.bl_label)
|
||||
|
||||
def draw_item(self, context):
|
||||
self.layout.menu(WTDToolsMenu.bl_idname)
|
||||
|
||||
Reference in new issue
Block a user