Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Use blender builtin hidden property instead of custom one
Browse files Browse the repository at this point in the history
  • Loading branch information
knot126 committed Jan 27, 2024
1 parent 6aa6ecf commit c75fa74
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion addon/shatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"name": "Shatter",
"description": "Blender-based tools for editing, saving and loading Smash Hit segments.",
"author": "Shatter Team",
"version": (2024, 1, 20),
"version": (2024, 1, 27),
"blender": (2, 80, 0),
"location": "File > Import/Export and 3D View > Tools",
"warning": "",
Expand Down
7 changes: 0 additions & 7 deletions addon/shatter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,6 @@ class sh_EntityProperties(PropertyGroup):
default = True,
)

sh_hidden: BoolProperty(
name = "Hidden",
description = "Controls if the entity will show in the official level editor. This is basically useless but included for completeness",
default = False,
)

sh_mode: EnumProperty(
name = "Mode",
options = {"ENUM_FLAG"},
Expand Down Expand Up @@ -1355,7 +1349,6 @@ def draw(self, context):
elif (t == "WAT"):
ui.prop("sh_resolution")

ui.prop("sh_hidden")
ui.prop("sh_export")

class sh_CreateBox(Operator):
Expand Down
2 changes: 1 addition & 1 deletion addon/shatter/segment_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def make_subelement_from_entity(level_root, scene, obj, params):
properties["type"] = obj.sh_properties.sh_powerup

# Hidden for all types
if (obj.sh_properties.sh_hidden):
if (not obj.visible_get()):
properties["hidden"] = "1"
else:
properties["hidden"] = "0"
Expand Down
11 changes: 7 additions & 4 deletions addon/shatter/segment_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ def sh_import_segment(fp, context, compressed = False):
b.sh_properties.sh_gradpoint2 = gradient[3:6]
b.sh_properties.sh_gradcolour1 = gradient[6:9]
b.sh_properties.sh_gradcolour2 = gradient[9:12]

# Set hidden in editor or not
b.hide_set(properties.get("hidden", "0") == "1")

# Obstacles
elif (kind == "obstacle"):
Expand All @@ -401,7 +404,7 @@ def sh_import_segment(fp, context, compressed = False):
o.sh_properties.sh_param9 = properties.get("param9", "")
o.sh_properties.sh_param10 = properties.get("param10", "")
o.sh_properties.sh_param11 = properties.get("param11", "")
o.sh_properties.sh_hidden = (properties.get("hidden", "0") == "1")
o.hide_set(properties.get("hidden", "0") == "1")

# Solve default templates
if (scene.sh_default_template and
Expand Down Expand Up @@ -440,7 +443,7 @@ def sh_import_segment(fp, context, compressed = False):
o.sh_properties.sh_blend = float(properties.get("blend", "1"))

# Set the hidden flag
o.sh_properties.sh_hidden = (properties.get("hidden", "0") == "1")
o.hide_set(properties.get("hidden", "0") == "1")

# Set the difficulty
o.sh_properties.sh_difficulty = sh_parse_string_array(properties.get("difficulty", "0 1"), fallbacks = [0, 1])
Expand All @@ -462,7 +465,7 @@ def sh_import_segment(fp, context, compressed = False):
o.sh_properties.sh_difficulty = sh_parse_string_array(properties.get("difficulty", "0 1"), fallbacks = [0, 1])

# Set hidden
o.sh_properties.sh_hidden = (properties.get("hidden", "0") == "1")
o.hide_set(properties.get("hidden", "0") == "1")

# Water
elif (kind == "water"):
Expand All @@ -479,7 +482,7 @@ def sh_import_segment(fp, context, compressed = False):
o.sh_properties.sh_resolution = sh_parse_string_array(properties.get("resolution", "32 32"), fallbacks = [32.0, 32.0])

# Set hidden
o.sh_properties.sh_hidden = (properties.get("hidden", "0") == "1")
o.hide_set(properties.get("hidden", "0") == "1")

# Anything else
else:
Expand Down

0 comments on commit c75fa74

Please sign in to comment.