Skip to content

Commit

Permalink
revert: Add nuance back to get_exporter return value
Browse files Browse the repository at this point in the history
Signed-off-by: Mahid Sheikh <[email protected]>
  • Loading branch information
StandingPadAnimations committed Jul 6, 2024
1 parent 6f2c226 commit 3a30cfe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MCprep_addon/materials/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class MCPREP_OT_swap_texture_pack(

@classmethod
def poll(cls, context):
if world_tools.get_exporter(context) != world_tools.WorldExporter.Unknown:
if world_tools.get_exporter(context) != None:
return util.is_atlas_export(context)
# Fallback to legacy
addon_prefs = util.get_user_preferences(context)
Expand Down
7 changes: 4 additions & 3 deletions MCprep_addon/world_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ class WorldExporter(Enum):
"jmc2obj-c" : WorldExporter.ClassicJmc
}

UNSUPPORTED_OR_NONE = (WorldExporter.Unknown, None)

def get_exporter(context: Context) -> WorldExporter:
def get_exporter(context: Context) -> Optional[WorldExporter]:
"""
Return the exporter on the active object if it has
an exporter attribute.
Expand All @@ -168,7 +169,7 @@ def get_exporter(context: Context) -> WorldExporter:
"""
obj = context.active_object
if not obj:
return WorldExporter.Unknown
return None

if "COMMONMCOBJ_HEADER" in obj:
if obj["PARENTED_EMPTY"] is not None and obj["PARENTED_EMPTY"]["exporter"] in EXPORTER_MAPPING:
Expand All @@ -187,7 +188,7 @@ def get_exporter(context: Context) -> WorldExporter:
return WorldExporter.ClassicMW
elif prefs.MCprep_exporter_type == "jmc2obj":
return WorldExporter.ClassicJmc
return WorldExporter.Unknown
return None


def detect_world_exporter(filepath: Path) -> Union[CommonMCOBJ, ObjHeaderOptions]:
Expand Down

0 comments on commit 3a30cfe

Please sign in to comment.