Skip to content

Commit

Permalink
add option for creating compact JSON files
Browse files Browse the repository at this point in the history
  • Loading branch information
Durman committed Jun 1, 2021
1 parent 6a5934f commit 82bd855
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/sv_IO_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class SvNodeTreeExporter(bpy.types.Operator):
options={'HIDDEN'})

id_tree: bpy.props.StringProperty()
compact: bpy.props.BoolProperty(default=True, description="Compact representation of the JSON file")
compress: bpy.props.BoolProperty()
selected_only: bpy.props.BoolProperty(name="Selected only")

Expand All @@ -141,7 +142,8 @@ def execute(self, context):
warning(msg)
return {'CANCELLED'}

json.dump(layout_dict, open(destination_path, 'w'), indent=2) # json_struct does not expect sort_keys = True
indent = None if self.compact else 2
json.dump(layout_dict, open(destination_path, 'w'), indent=indent) # json_struct doesnt expect sort_keys = True
msg = 'exported to: ' + destination_path
self.report({"INFO"}, msg)
info(msg)
Expand Down Expand Up @@ -179,6 +181,7 @@ def draw(self, context):
col = self.layout.column() # old syntax in <= 2.83

col.use_property_split = True
col.prop(self, 'compact')
col.prop(self, 'selected_only')
col.prop(self, 'compress', text="Create ZIP archive")

Expand Down

0 comments on commit 82bd855

Please sign in to comment.