Skip to content

Commit

Permalink
Fix for RMAN-22201
Browse files Browse the repository at this point in the history
Refreshing PxrOSL nodes was failing

* double check the length of color parameters. The length for the default_value for our color sockets is 4, so make sure to
increase/decrease the length when necessary
* cannot deepcopy Blender's bpy_prop_array, so manually create a
list and copy the values.
* also bump the addon version and add a changelog for 26.1.
  • Loading branch information
Ian Hsieh committed Apr 23, 2024
1 parent 09f8bcb commit d2730ee
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
bl_info = {
"name": "RenderMan For Blender",
"author": "Pixar",
"version": (26, 0, 0),
"version": (26, 1, 0),
"blender": (2, 93, 0),
"location": "Render Properties > Render Engine > RenderMan",
"description": "RenderMan 26 integration",
Expand Down
10 changes: 10 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
v26.1, April 24, 2024

Bug Fixes:
* Fixed bugs related to refreshing an OSL shader via the PxrOSL shading node
* Fixed a bug that caused the field of view to no be calculated correctly when
using an orthographic camera
* Fixed a bug that caused integrators to use the wrong settings during IPR
* Fixed a bug that caused instances created via geometry nodes to have the
wrong material attached

v26.0, April 02, 2024

New Features:
Expand Down
24 changes: 19 additions & 5 deletions rman_bl_nodes/rman_bl_nodes_shaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..rfb_utils.property_utils import BlPropInfo, __LOBES_ENABLE_PARAMS__
from ..rfb_utils import filepath_utils
from ..rman_config import __RFB_CONFIG_DICT__
from ..rman_constants import RFB_FLOAT3, RFB_SHADER_ALLOWED_CONNECTIONS
from ..rman_constants import RFB_FLOAT3, RFB_SHADER_ALLOWED_CONNECTIONS, __RMAN_SOCKET_MAP__
from .. import rman_bl_nodes
from .. import rfb_icons
from .. import rman_render
Expand Down Expand Up @@ -707,7 +707,14 @@ def setOslProps(self, prop_names, shader_meta):
if socket.is_linked:
links[input_name] = {"from_node": socket.links[0].from_node, "from_socket": socket.links[0].from_socket}
else:
values[input_name] = deepcopy(socket.default_value)
if isinstance(socket.default_value, bpy.types.bpy_prop_array):
# deecopy seems to fail on bpy_prop_array types, so manually copy
val = list()
for v in socket.default_value:
val.append(v)
values[input_name] = val
else:
values[input_name] = deepcopy(socket.default_value)
for input_name, socket in self.outputs.items():
if socket.is_linked:
links[input_name] = {"from_node": socket.links[0].to_node, "from_socket": socket.links[0].to_socket}
Expand All @@ -722,7 +729,7 @@ def setOslProps(self, prop_names, shader_meta):
prop_type = shader_meta[prop_name]["type"]
if shader_meta[prop_name]["IO"] == "out":
socket = self.outputs.new(
rman_socket_utils.__RMAN_SOCKET_MAP__[prop_type], prop_name)
__RMAN_SOCKET_MAP__[prop_type], prop_name)
if prop_name in links and socket.hide is False:
link = links[prop_name]
self.id_data.links.new(socket, link['from_socket'])
Expand All @@ -734,15 +741,22 @@ def setOslProps(self, prop_names, shader_meta):
prop_default = float(prop_default)
elif prop_type == "int":
prop_default = int(float(prop_default))
elif prop_type == "color":
# error checking on len(prop_default)
# we want len(prop_default) = 4
if len(prop_default) < 4:
prop_default += (4-len(prop_default)) * (1.0,)
elif len(prop_default) > 4:
prop_default = prop_default[:4]

if prop_type == "matrix":
self.inputs.new(rman_socket_utils.__RMAN_SOCKET_MAP__["struct"], prop_name, prop_name)
self.inputs.new(__RMAN_SOCKET_MAP__["struct"], prop_name, prop_name)
elif prop_type == "void":
pass
elif 'lockgeom' in shader_meta[prop_name] and shader_meta[prop_name]['lockgeom'] == 0:
pass
else:
input = self.inputs.new(rman_socket_utils.__RMAN_SOCKET_MAP__[shader_meta[prop_name]["type"]],
input = self.inputs.new(__RMAN_SOCKET_MAP__[shader_meta[prop_name]["type"]],
prop_name, identifier=prop_name)
if prop_default:
input.default_value = prop_default
Expand Down
2 changes: 1 addition & 1 deletion rman_bl_nodes/rman_bl_nodes_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class RendermanNodeSocketFloat(NodeSocketFloat, RendermanSocket):
renderman_type: StringProperty(default='float')
is_array: BoolProperty(default=False)
array_elem: IntProperty(default=-1)
default_value: IntProperty(update=update_func)
default_value: FloatProperty(update=update_func)

@classmethod
def draw_color_simple(cls):
Expand Down

0 comments on commit d2730ee

Please sign in to comment.