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