prman-pixar / RenderManForBlender

RenderMan for Blender render addon
MIT License
803 stars 134 forks source link

Crash when connecting RGB shader node output to Bxdf input #689

Closed erjiang closed 11 months ago

erjiang commented 11 months ago

OS: Linux Blender 3.6.2 Renderman for Blender 25.2.0

To reproduce:

  1. Create a new material with Renderman node tree
  2. Add a PxrTexture node
  3. Connect the resultRGB output of the PxrTexture node directly to the Bxdf input of the RenderMan material node

Expected:

Error message OR black/null shader OR texture RGB used as the shader result

Actual:

Blender crashes with the following output in the logs:

WARN (bpy.rna): source/blender/python/intern/bpy_rna.c:8420 bpy_class_call: unable to get Python class for RNA struct 'RendermanShadingNode'
Segmentation fault (core dumped)
prman-pixar commented 11 months ago

@erjiang

Can you see if the patched file works for you? This should go into your local directory in:

RenderManForBlender/rman_bl_nodes

rman_bl_nodes_shaders.zip

erjiang commented 11 months ago

The modified file works and handles the error. Thanks for the fix!

erjiang commented 11 months ago

I take that back. It seems I can no longer connect the resultF of a PxrFacingRatio node to the topA input of a PxrBlend.

prman-pixar commented 11 months ago

Can you revert the change that I gave you in #690 690? ? I think the fix for that conflicts with the fix needed for this one.

erjiang commented 11 months ago

Can you revert the change that I gave you in #690 690? ? I think the fix for that conflicts with the fix needed for this one.

You are right, that was my mistake. This patched file does not cause the problem I just described.

prman-pixar commented 11 months ago

OK, thanks.

re: #690

Unfortunately, this seems to be a limitation of Blender.

We're using a custom class for our node sockets. There doesn't seem to be any way to change the socket's type property when using a custom class. Custom node sockets all get set as 'VALUE' for its type. The group node seems to use this property to figure out what kind of socket it should add for its input/output. If you try to explicitly set the type property, the socket reverts back to the base NodeSocketFloat class, and we lose our custom properties.

We cannot use the base Blender node socket classes, because we want to be able to add our own properties, and override the draw methods for the class. The only thing I can think of that might fix this is to create our own custom group node, but that would be a significant change, and I'm not sure if that will fully solve this.

In any case, can you try this patch and see if fixes this issue for you? Please revert whatever you had before, before applying this.

patch.zip

erjiang commented 11 months ago

In any case, can you try this patch and see if fixes this issue for you? Please revert whatever you had before, before applying this.

patch.zip

Yes, that patch seems to fix the issue by popping up an error when trying to connect color output to shader output.

prman-pixar commented 11 months ago

Thanks for confirming.