Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added warning for using MCprep in a version beyond what was tested #509

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions MCprep_addon/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
# TYPING UTILITIES
# -----------------------------------------------------------------------------

# Upper supported Blender version
UPPER_BV_CAP = (4, 0, 0)

class Form(enum.Enum):
"""Texture or world import interpretation, for mapping or other needs."""
Expand Down Expand Up @@ -75,6 +77,7 @@ def __init__(self):
self.dev_file: Path = Path(os.path.dirname(__file__), "mcprep_dev.txt")

self.last_check_for_updated = 0
self.valid_environment: bool = True

# Check to see if there's a text file for a dev build. If so,
if self.dev_file.exists():
Expand Down Expand Up @@ -124,6 +127,11 @@ def __init__(self):
# If ever changing the resource pack, should also reset to None.
self.material_sync_cache = []

# Implement a hard cap for Blender versions
if hasattr(bpy.app, "version"):
if bpy.app.version > UPPER_BV_CAP:
self.valid_environment = False

def update_json_dat_path(self):
"""If new update file found from install, replace old one with new.

Expand Down
62 changes: 59 additions & 3 deletions MCprep_addon/mcprep_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,29 @@ def restart_layout(layout):
icon="ERROR")
col.label(text="to complete update")

def upper_bv_layout(layout):
"""Warn about the upper bv limit"""
box = layout.box()
col = box.column()
alert_row = col.row()
alert_row.alert = True
alert_row.label(text="Your Blender version is above")
alert_row = col.row()
alert_row.alert = True
alert_row.label(text="the range tested with this version.")
alert_row = col.row()
alert_row.alert = True
alert_row.label(text="Please report any issues")
alert_row = col.row()
alert_row.alert = True
alert_row.label(text="that occur!")

alert_row = col.row()
alert_row.alert = True
alert_row.operator(
"wm.url_open", text="Report a Bug!"
).url = "https://github.com/Moo-Ack-Productions/MCprep/issues/new?assignees=&labels=user-troubleshoot&projects=&template=Bug-Report.yml"


# -----------------------------------------------------------------------------
# UI class functions
Expand Down Expand Up @@ -289,6 +312,8 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(layout)
layout = self.layout
props = context.scene.mcprep_props

Expand Down Expand Up @@ -740,7 +765,8 @@ def draw(self, context):
if addon_just_updated():
# Don't draw restart_layout() here, as we already have a box
return

elif not env.valid_environment:
upper_bv_layout(self.layout)
layout = self.layout
split = layout.split()
col = split.column(align=True)
Expand Down Expand Up @@ -885,7 +911,8 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return

elif not env.valid_environment:
upper_bv_layout(self.layout)
# bridge.panel_draw(self, context)
pass

Expand All @@ -902,6 +929,8 @@ def draw(self, context):
if addon_just_updated():
restart_layout(layout)
return
elif not env.valid_environment:
upper_bv_layout(layout)

rw = layout.row()
col = rw.column()
Expand Down Expand Up @@ -957,7 +986,8 @@ def draw(self, context):
if addon_just_updated():
restart_layout(layout)
return

elif not env.valid_environment:
upper_bv_layout(layout)
scn_props = context.scene.mcprep_props
sind = context.scene.mcprep_skins_list_index
mob_ind = context.scene.mcprep_props.mob_list_index
Expand Down Expand Up @@ -1072,6 +1102,8 @@ def draw(self, context):
if addon_just_updated():
restart_layout(layout)
return
elif not env.valid_environment:
upper_bv_layout(layout)

row = layout.row()
# row.operator("mcprep.create_default_material")
Expand Down Expand Up @@ -1117,6 +1149,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)


b_row = self.layout.row()
b_col = b_row.column(align=False)
Expand Down Expand Up @@ -1676,6 +1711,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)

row = self.layout.row(align=True)
row.label(text="Click triangle to open")
ops = row.operator(
Expand All @@ -1697,6 +1735,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)

is_obj_mode = context.mode == "OBJECT"
if not is_obj_mode:
draw_mode_warning(self.layout)
Expand Down Expand Up @@ -1725,6 +1766,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)

is_obj_mode = context.mode == "OBJECT"
if not is_obj_mode:
draw_mode_warning(self.layout)
Expand Down Expand Up @@ -1753,6 +1797,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)

is_obj_mode = context.mode == "OBJECT"
is_pose_mode = context.mode == "POSE"
if not is_obj_mode and not is_pose_mode:
Expand Down Expand Up @@ -1782,6 +1829,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)

is_obj_mode = context.mode == "OBJECT"
if not is_obj_mode:
draw_mode_warning(self.layout)
Expand Down Expand Up @@ -1810,6 +1860,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)

is_obj_mode = context.mode == "OBJECT"
if not is_obj_mode:
draw_mode_warning(self.layout)
Expand Down Expand Up @@ -1838,6 +1891,9 @@ def draw(self, context):
if addon_just_updated():
restart_layout(self.layout)
return
elif not env.valid_environment:
upper_bv_layout(self.layout)

is_obj_mode = context.mode == "OBJECT"
if not is_obj_mode:
draw_mode_warning(self.layout)
Expand Down