Files

33 lines
894 B
Python

"""Operators for the individual tools."""
import json
import bpy
class WTDGetOidForPath(bpy.types.Operator):
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="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(WTDGetOidForPath)
def unregister() -> None:
bpy.utils.unregister_class(WTDGetOidForPath)