Skip to content

Commit

Permalink
Adding clouds now will update camera clipping pane ends
Browse files Browse the repository at this point in the history
As per #172, clouds are clipped by default. Now if the cloud setting is on, clipping end will be set to 1000 to match the cloud shader limit. Also made minor compatibility improvement for materialsFromObj.
  • Loading branch information
TheDuckCow committed Nov 5, 2020
1 parent fd3d00f commit 427ebd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MCprep_addon/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ def materialsFromObj(obj_list):
# also capture obj materials from dupliverts/instances on e.g. empties
if hasattr(obj, "dupli_group") and obj.dupli_group: # 2.7
for dup_obj in obj.dupli_group.objects:
obj_list.append(dup_obj)
if dup_obj not in obj_list:
obj_list.append(dup_obj)
elif hasattr(obj, "instance_collection") and obj.instance_collection: # 2.8
for dup_obj in obj.instance_collection.objects:
obj_list.append(dup_obj)
if dup_obj not in obj_list:
obj_list.append(dup_obj)
if obj.type != 'MESH':
continue
for slot in obj.material_slots:
Expand Down
5 changes: 5 additions & 0 deletions MCprep_addon/world_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,11 @@ def execute(self, context):
mat.use_shadeless = False
mat.translucency = 1

# Now also increase camera render distance to see clouds
cams = [obj for obj in bpy.data.objects if obj.type == "CAMERA"]
for cam in cams:
cam.data.clip_end = 1000 # 1000 matches explicitly to shader

# ensure all new objects (lights, meshes, control objs) in same group
if "mcprep_world" in util.collections():
util.collections()["mcprep_world"].name = "mcprep_world_old"
Expand Down

0 comments on commit 427ebd7

Please sign in to comment.