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

Adding material no_prep properties #561

Merged
Merged
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
26 changes: 17 additions & 9 deletions MCprep_addon/materials/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ def execute(self, context):
engine = context.scene.render.engine
count = 0
count_lib_skipped = 0
count_no_prep = 0

for mat in mat_list:
if not mat:
env.log(
"During prep, found null material:" + str(mat), vv_only=True)
continue

elif mat.library:
elif mat.library or mat.get("MCPREP_NO_PREP", False):
count_lib_skipped += 1
continue

Expand Down Expand Up @@ -263,7 +263,8 @@ def execute(self, context):
else:
self.report(
{'ERROR'},
"Only Cycles and Eevee are supported")
"Only Cycles and Eevee are supported"
)
return {'CANCELLED'}

if self.animateTextures:
Expand Down Expand Up @@ -291,14 +292,21 @@ def execute(self, context):
if self.optimizeScene and engine == 'CYCLES':
bpy.ops.mcprep.optimize_scene()

has_lib_skipped = count_lib_skipped > 0
has_mat = count > 0

info = []
if has_mat:
info.append(f"modified {count}")
if has_lib_skipped:
info.append(f"skipped {count_lib_skipped}")

mat_info = ", ".join(x for x in info).capitalize()

if self.skipUsage is True:
pass # Don't report if a meta-call.
elif count_lib_skipped > 0:
self.report(
{"INFO"},
f"Modified {count} materials, skipped {count_lib_skipped} linked ones.")
elif count > 0:
self.report({"INFO"}, f"Modified {count} materials")
elif has_mat or has_lib_skipped:
self.report({"INFO"}, mat_info)
else:
self.report(
{"ERROR"},
Expand Down