Skip to content

Commit

Permalink
Workaround fix for GitHub #698
Browse files Browse the repository at this point in the history
For now, don't draw the projection if the barn light filter is in physical mode.
It's also not clear to me how the projection should be drawn if the same light filter is attached to two or more lights.
  • Loading branch information
Ian Hsieh committed Feb 1, 2024
1 parent 05d7f8b commit 8349a13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rman_ui/rman_ui_light_handlers/__init__.py
Expand Up @@ -1612,7 +1612,7 @@ def draw_barn_light_filter(ob, light_shader, light_shader_name):
pts = [m @ Vector(pt) for pt in vtx_buffer ]
indices = _BARN_LIGHT_DRAW_HELPER_.idx_buffer(len(pts), 0, 0)
# blender wants a list of lists
indices = [indices[i:i+2] for i in range(0, len(indices), 2)]
indices = [indices[i:i+2] for i in range(0, len(indices), 2) if indices[i] is not None]

draw_line_shape(ob, _SHADER_, pts, indices)

Expand Down
Expand Up @@ -3,6 +3,7 @@
from mathutils import Vector, Matrix
import math
import copy
import os

CORNERS = [Vector((-0.5, 0.5, 0.0)), Vector((0.5, 0.5, 0.0)),
Vector((0.5, -0.5, 0.0)), Vector((-0.5, -0.5, 0.0))]
Expand Down Expand Up @@ -102,7 +103,8 @@ def update_input_params(self, obj, radius):

light = obj.data
rm = light.renderman.get_light_node()
self.barnMode = int(getattr(rm, "barnMode", 0))
self.cookieMode = int(getattr(rm, 'cookieMode', 0))
self.barnMode = int(getattr(rm, "barnMode", self.cookieMode))
self.mode = self.barnMode
self.directional = getattr(rm, "directional", 0)
self.shearX = getattr(rm, "shearX", 0.0)
Expand Down Expand Up @@ -507,6 +509,11 @@ def idx_buffer(self, num_vtx, start_idx, inst_idx):
# near soft shape
_gl_lines(indices, start_idx + grp_n_vtx, grp_n_vtx, grp_n_idxs,
loop=True)

if not os.environ.get('RFB_DRAW_BARN_PROJECTION', None) and self.mode == 0:
# for now, don't draw the projection in physical mode
# until we can fix the rotation issue (see GitHub #698)
return indices

# compute offsets
vtx_start = start_idx + grp_n_vtx * 2
Expand Down

0 comments on commit 8349a13

Please sign in to comment.