Skip to content

Commit

Permalink
fix: Make sure updating the Vivy path resets Vivy cache
Browse files Browse the repository at this point in the history
Signed-off-by: Mahid Sheikh <[email protected]>
  • Loading branch information
StandingPadAnimations committed Sep 6, 2024
1 parent 2418db3 commit 17ebcce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MCprep_addon/mcprep_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1942,9 +1942,12 @@ def mcprep_image_tools(self, context: Context) -> None:
else:
row.operator("mcprep.spawn_item", text=txt).filepath = path

def update_vivy_json(self, context: Context) -> None:
def update_vivy_variables(self, context: Context) -> None:
"""Update all Vivy related variables when changing the file"""
path = Path(bpy.path.abspath(context.scene.vivy_file_path))
env.reload_vivy_json(path)
env.vivy_name_changes = {}
env.vivy_cache = None

# -----------------------------------------------
# Addon wide properties (aside from user preferences)
Expand Down Expand Up @@ -2105,7 +2108,7 @@ def register():
name="Vivy Folder",
description="Folder to source Vivy materials",
subtype='DIR_PATH',
update=update_vivy_json,
update=update_vivy_variables,
default=addon_prefs.exp_vivy_file_path)
env.verbose = addon_prefs.verbose
if hasattr(bpy.types, "VIEW3D_MT_add"): # 2.8
Expand Down

0 comments on commit 17ebcce

Please sign in to comment.