mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Use regular json if no docstring when Patching
This commit is contained in:
@@ -41,6 +41,7 @@ class ExecuteIfcPatch(bpy.types.Operator):
|
|||||||
bl_idname = "bim.execute_ifc_patch"
|
bl_idname = "bim.execute_ifc_patch"
|
||||||
bl_label = "Execute IFCPatch"
|
bl_label = "Execute IFCPatch"
|
||||||
file_format: bpy.props.StringProperty()
|
file_format: bpy.props.StringProperty()
|
||||||
|
use_json_for_args: bpy.props.BoolProperty()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@@ -48,18 +49,7 @@ class ExecuteIfcPatch(bpy.types.Operator):
|
|||||||
return os.path.isfile(input_file) and "ifc" in os.path.splitext(input_file)[1]
|
return os.path.isfile(input_file) and "ifc" in os.path.splitext(input_file)[1]
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
if context.scene.BIMPatchProperties.ifc_patch_args_attr:
|
if self.use_json_for_args or not context.scene.BIMPatchProperties.ifc_patch_args_attr:
|
||||||
arguments = []
|
|
||||||
for arg in context.scene.BIMPatchProperties.ifc_patch_args_attr:
|
|
||||||
if arg.data_type == "string":
|
|
||||||
arguments.append(arg.string_value)
|
|
||||||
if arg.data_type == "boolean":
|
|
||||||
arguments.append(arg.bool_value)
|
|
||||||
if arg.data_type == "integer":
|
|
||||||
arguments.append(arg.int_value)
|
|
||||||
if arg.data_type == "float":
|
|
||||||
arguments.append(arg.float_value)
|
|
||||||
else:
|
|
||||||
arguments = json.loads(context.scene.BIMPatchProperties.ifc_patch_args or "[]")
|
arguments = json.loads(context.scene.BIMPatchProperties.ifc_patch_args or "[]")
|
||||||
else:
|
else:
|
||||||
arguments = [arg.get_value() for arg in context.scene.BIMPatchProperties.ifc_patch_args_attr]
|
arguments = [arg.get_value() for arg in context.scene.BIMPatchProperties.ifc_patch_args_attr]
|
||||||
|
|||||||
@@ -51,3 +51,4 @@ class BIM_PT_patch(bpy.types.Panel):
|
|||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
op = row.operator("bim.execute_ifc_patch")
|
op = row.operator("bim.execute_ifc_patch")
|
||||||
|
op.use_json_for_args = not bool(docs["inputs"])
|
||||||
|
|||||||
Reference in New Issue
Block a user