Skip to content

Commit

Permalink
Safer reloading of assets
Browse files Browse the repository at this point in the history
Partial solve for issue #331
  • Loading branch information
TheDuckCow committed Aug 11, 2022
1 parent d7f4c86 commit 8ece23c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion MCprep_addon/spawner/effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,11 @@ def load_geonode_effect_list(context):
path = context.scene.mcprep_effects_path
path = os.path.join(path, "geonodes")

if not os.path.isdir(path):
print("The geonode directory is missing! Reinstall MCprep")
print(path)
return

# Find all files with geonodes.
blends = [
os.path.join(path, blend) for blend in os.listdir(path)
Expand Down Expand Up @@ -834,6 +839,11 @@ def load_area_particle_effects(context):
path = context.scene.mcprep_effects_path
path = os.path.join(path, "particle")

if not os.path.isdir(path):
print("The particle directory is missing! Reinstall MCprep")
print(path)
return

# Find all files with geonodes.
blends = [
os.path.join(path, blend) for blend in os.listdir(path)
Expand Down Expand Up @@ -862,6 +872,11 @@ def load_collection_effects(context):
path = context.scene.mcprep_effects_path
path = os.path.join(path, "collection")

if not os.path.isdir(path):
print("The collection directory is missing! Reinstall MCprep")
print(path)
return

# Find all files with geonodes.
blends = [
os.path.join(path, blend) for blend in os.listdir(path)
Expand Down Expand Up @@ -894,7 +909,8 @@ def load_image_sequence_effects(context):
lvl_3 = os.path.join(resource_folder, "assets", "minecraft", "textures", "particle")

if not os.path.isdir(resource_folder):
conf.log("Error, resource folder does not exist")
conf.log(
"The particle resource directory is missing! Assign another resource pack")
return
elif os.path.isdir(lvl_0):
resource_folder = lvl_0
Expand Down

0 comments on commit 8ece23c

Please sign in to comment.