Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Allow metadata export to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
knot126 committed May 12, 2023
1 parent 7b2976e commit 0d4802f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
15 changes: 11 additions & 4 deletions blender_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"name": "Smash Hit Blender Tools",
"description": "Blender-based tools for editing, saving and loading Smash Hit segments",
"author": "Smash Hit Lab",
"version": (2, 1, 5),
"version": (2, 1, 6),
"blender": (3, 2, 0),
"location": "File > Import/Export and 3D View > Tools",
"warning": "",
Expand Down Expand Up @@ -151,7 +151,7 @@ def execute(self, context):
return result

def sh_draw_export_auto(self, context):
self.layout.operator("sh.export_auto", text="Export to APK")
self.layout.operator("sh.export_auto", text="SHBT: Export to APK")

class sh_export_test(Operator):
"""
Expand Down Expand Up @@ -181,7 +181,7 @@ def execute(self, context):
return result

def sh_draw_export_test(self, context):
self.layout.operator("sh.export_test_server", text="SHBT Quick Test Server")
self.layout.operator("sh.export_test_server", text="SHBT: Quick Test Server")

class sh_export_binary(sh_ExportCommon):
"""
Expand Down Expand Up @@ -829,10 +829,17 @@ class sh_AddonPreferences(AddonPreferences):
default = "",
)

enable_metadata: BoolProperty(
name = "Export metadata",
description = "Allows exporting metadata with the segment, like the time it was created and a user trace or ID",
default = True,
)

def draw(self, context):
ui = self.layout

ui.label(text = "Segment export")
ui.prop(self, "enable_metadata")
ui.prop(self, "creator")

ui.label(text = "Network and privacy")
Expand Down Expand Up @@ -1091,7 +1098,7 @@ def register():
bpy.types.TOPBAR_MT_file_export.append(sh_draw_export)
bpy.types.TOPBAR_MT_file_export.append(sh_draw_export_gz)
bpy.types.TOPBAR_MT_file_export.append(sh_draw_export_auto)
bpy.types.TOPBAR_MT_file_export.append(sh_draw_export_binary)
# bpy.types.TOPBAR_MT_file_export.append(sh_draw_export_binary)
bpy.types.TOPBAR_MT_file_export.append(sh_draw_export_test)

# Add import operators to menu
Expand Down
16 changes: 9 additions & 7 deletions segment_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,20 @@ def sh_create_root(scene, params):
if (scene.sh_drm_disallow_import):
seg_props["drm"] = "NoImport"

# Creator information
# Creator information - always exported if available
creator = bpy.context.preferences.addons["blender_tools"].preferences.creator

if (creator):
seg_props["shbt-meta-creator"] = creator

# Export time
seg_props["shbt-meta-time"] = hex(util.get_time())[2:]

# Export user trace if the creator wasn't specified
if (not creator):
seg_props["shbt-meta-trace"] = util.get_trace()
# Metadata, if allowed
if (bpy.context.preferences.addons["blender_tools"].preferences.enable_metadata):
# Export time
seg_props["shbt-meta-time"] = hex(util.get_time())[2:]

# Export user trace if the creator wasn't specified
if (not creator):
seg_props["shbt-meta-trace"] = util.get_trace()

# Create main root and return it
level_root = et.Element("segment", seg_props)
Expand Down

0 comments on commit 0d4802f

Please sign in to comment.