Skip to content

Commit

Permalink
Merge branch 'revert-e94bf810' into 'main'
Browse files Browse the repository at this point in the history
Revert "Merge branch 'revert-b09668de' into 'main'"

See merge request renderman/projects/RenderManForBlender!23
  • Loading branch information
Ian Hsieh committed Apr 8, 2024
2 parents 85f5f70 + 673a2f3 commit 8e95f1c
Show file tree
Hide file tree
Showing 97 changed files with 5,739 additions and 3,125 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To use, install RenderMan, (free from [renderman.pixar.com](https://renderman.pi

## Getting Help

For support visit the [RenderMan AnswerHub](https://renderman.pixar.com/answers/) or the [RenderMan Discord Server](https://discord.com/invite/renderman).
For support visit the [RenderMan Discord Server](https://discord.com/invite/renderman).

## Acknowledgements

Expand Down
5 changes: 3 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
bl_info = {
"name": "RenderMan For Blender",
"author": "Pixar",
"version": (25, 2, 0),
"version": (26, 0, 0),
"blender": (2, 93, 0),
"location": "Render Properties > Render Engine > RenderMan",
"description": "RenderMan 25 integration",
"description": "RenderMan 26 integration",
"doc_url": "https://rmanwiki.pixar.com/display/RFB",
'warning': '',
"category": "Render"}

__RMAN_ADDON_LOADED__ = False
Expand Down
28 changes: 28 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
v26.0, April 02, 2024

New Features:
* Blender 3.6 and 4.1 are now officially supported. Note, the Qt framework is not
supported in 4.1
* Viewport renders can now use the RenderMan AI denoiser as well as the OptiX denoiser.
* Add a new menu item in the shader graph to convert selected Cycles image nodes
to PxrTexture nodes. This is useful when dragging and dropping image files from the file
browser to the shader graph.

Changes:
* For the material properties panel, we now display only the current selected node, rather
than inlining all connections. This can be turned off in the preferences.
* You can now specify the namespace for user attributes. Default is "user".
* Shorten the name for the PxrSurface lobe checkboxes.
* The Blender Subdivision Surface modifier's levels setting (viewport and render) now
works with RenderMan. Note, RenderMan's subdivision mesh scheme attribute still takes
precedence over the modifier.

Bug Fixes:
* Fix issues with texturing being incorrect for PxrDomeLight in the viewport.
* Orientation of the PxrEnvDayLight was incorrect in the viewport. This change will cause
look differences in older scenes.
* Fix a number bugs related to child objects not inherting attributes from their
parents correctly.
* Fix a bug that was causing exporting of hair curves object to be slow.
* Fix an issue where metaballs did not render in Blender 3.6

v25.2, June 29, 2023

Changes:
Expand Down
6 changes: 3 additions & 3 deletions installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ RenderMan for Blender Installation Instructions
------------------------------------------
(NOTE: current **MacOS** support is limited to the **Intel** variant; M1/M2 Macs can still run RenderManForBlender on the Mac/Intel version of Blender)

1. Install Blender if not already (2.83 LTS recommended)
1. Install Blender if not already (3.0 recommended)

2. Register for the free Non-Commercial Version of RenderMan from Pixar.
https://renderman.pixar.com/store/intro

3. Download and install RenderMan Pro Server Package and
installation instructions at: http://rendermansite.pixar.com/view/get-renderman
You need to install at a minimum RenderMan Pro Server 24.0
You need to install at a minimum RenderMan Pro Server 26.0
It is recommended to install RenderMan Pro Server in the default location (or see advanced instructions below)

3.A If on Windows, be sure to restart after installing RenderMan Pro Server
Expand All @@ -24,7 +24,7 @@ https://github.com/prman-pixar/RenderManForBlender/releases save the zip file so

ADVANCED:
RenderMan normally bases everything off a variable RMANTREE which is set to your installation
folder, eg /Applications/Pixar/RenderManProServer-24.0 on OSX and C:\Program Files\Pixar\RenderManProServer-24.0 on Windows.
folder, eg /Applications/Pixar/RenderManProServer-26.0 on OSX and C:\Program Files\Pixar\RenderManProServer-26.0 on Windows.

RenderMan for Blender will try and guess the appropriate RenderMan version to use and the location of
the RMANTREE folder. If you are installing RenderMan to the standard location you shouldn't have to do anything!
Expand Down
44 changes: 16 additions & 28 deletions preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
'rman_viewport_refresh_rate': 0.01,
'rman_solo_collapse_nodes': True,
'rman_use_blend_dir_token': True,
'rman_ui_framework': "NATIVE",
'rman_ui_framework': "QT",
'rpbConfigFile': '',
'rpbUserLibraries': [],
'rpbSelectedLibrary': '',
Expand Down Expand Up @@ -109,7 +109,8 @@
'rman_tractor_whendone': '',
'rman_tractor_whenerror': '',
'rman_tractor_whenalways': '',
'rman_tractor_dirmaps': []
'rman_tractor_dirmaps': [],
'rman_single_node_view': True
}

class RendermanPreferencePath(bpy.types.PropertyGroup):
Expand Down Expand Up @@ -522,8 +523,8 @@ def update_rman_logging_level(self, context):

rman_ui_framework: EnumProperty(
name="UI Framework",
default="NATIVE",
description="Which UI framework to use. Qt is currently experimental and requires PySide2 to be installed. Changes to this requires a restart.",
default="QT",
description="Which UI framework to use. Changes to this requires a restart. NOTE: QT is currently not supported in Blender 4.1 and above.",
items=[('NATIVE', 'Native', ''),
("QT", "Qt", '')
]
Expand Down Expand Up @@ -587,7 +588,7 @@ def update_stats_config(self, context):
('3', 'Most', ''),
('4', 'All', ''),
],
description="How much live stats to print",
description="How much live stats to print in the viewport",
update=update_stats_config
)

Expand Down Expand Up @@ -704,6 +705,12 @@ def update_stats_config(self, context):

rman_tractor_dirmaps: bpy.props.CollectionProperty(type=RendermanDirMap)

rman_single_node_view: BoolProperty(
name='Single Node View',
default=True,
description="If enabled, the Material tab will only show the current selected node, rather than embedding all of the connected nodes."
)

def draw_xpu_devices(self, context, layout):
if self.rman_xpu_device == 'CPU':
device = self.rman_xpu_cpu_devices[0]
Expand Down Expand Up @@ -821,6 +828,7 @@ def draw(self, context):
col.prop(self, 'rman_ui_framework')
if self.rman_ui_framework == 'QT':
col.prop(self, 'rman_show_wip_qt')
col.prop(self, 'rman_single_node_view')

# Logging
row = layout.row()
Expand Down Expand Up @@ -882,29 +890,9 @@ def draw(self, context):
row = col.row()
col = row.column()
col.prop(self, 'rman_roz_logLevel')
col.prop(self, 'rman_roz_liveStatsEnabled')

if self.rman_roz_liveStatsEnabled:
try:
from .rman_stats import RfBStatsManager
stats_mgr = RfBStatsManager.get_stats_manager()
split = layout.split()
row = split.row()
col.prop(self, 'rman_roz_webSocketServer_Port', slider=False)
col = row.column()
col.label(text='')
col = row.column()
if stats_mgr:
if stats_mgr.is_connected():
col.operator('renderman.disconnect_stats_render')
else:
col.operator('renderman.attach_stats_render')
col.label(text=' Web Socket Status: %s' % stats_mgr.get_status())

except Exception as e:
rfb_logger.rfb_log().debug("Could not import rman_stats: %s" % str(e))
pass

col.prop(self, 'rman_roz_webSocketServer_Port', slider=False)
col.prop(self, 'rman_roz_stats_print_level')

row = layout.row()
col = row.column()
col.label(text='Other', icon_value=rman_r_icon.icon_id)
Expand Down
Binary file added rfb_icons/out_PxrCheatShadowLightFilter.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions rfb_unittests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import unittest
from RenderManForBlender.rfb_unittests.test_string_expr import StringExprTest
from RenderManForBlender.rfb_unittests.test_shader_nodes import ShaderNodesTest
from RenderManForBlender.rfb_unittests.test_geo import GeoTest

classes = [
StringExprTest
StringExprTest,
ShaderNodesTest,
GeoTest
]

def suite():
Expand All @@ -14,8 +18,19 @@ def suite():
return suite

def run_rfb_unittests():
runner = unittest.TextTestRunner()
runner.run(suite())
runner = unittest.TextTestRunner(verbosity=2, failfast=True)
test_result = runner.run(suite())

if test_result.wasSuccessful():
return None
msg = ''
for cls, err in test_result.errors:
msg += '%s:\n' % cls.id()
msg += '\t%s' % err
for cls, err in test_result.failures:
msg += '%s:\n' % cls.id()
msg += '\t%s' % err
return msg

if __name__ == '__main__':
run_rfb_unittests()
36 changes: 36 additions & 0 deletions rfb_unittests/test_geo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import unittest
import bpy
from ..rfb_utils import mesh_utils


class GeoTest(unittest.TestCase):

@classmethod
def add_tests(self, suite):
suite.addTest(GeoTest('test_mesh_export'))

def test_mesh_export(self):

def test_eq(a, b, msg=None):
if a != b:
msg = "Mesh export test failed"
bpy.ops.object.delete()
raise self.failureException(msg)

nverts = [4, 4, 4, 4, 4, 4]
verts = [0, 1, 3, 2, 2, 3, 7, 6, 6, 7, 5, 4, 4, 5, 1, 0, 2, 6, 4, 0, 7, 3, 1, 5]
P = [[-1.0, -1.0, -1.0], [-1.0, -1.0, 1.0], [-1.0, 1.0, -1.0], [-1.0, 1.0, 1.0], [1.0, -1.0, -1.0], [1.0, -1.0, 1.0], [1.0, 1.0, -1.0], [1.0, 1.0, 1.0]]
N = [[-1.0, -0.0, 0.0], [0.0, 1.0, 0.0], [1.0, -0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0], [0.0, -0.0, 1.0]]

mesh = mesh_utils.RmanMesh(nverts, verts, P, N)

bpy.ops.mesh.primitive_cube_add()
ob = bpy.context.object

mesh_test = mesh_utils.get_mesh(ob.data, get_normals=True)

self.addTypeEqualityFunc(mesh_utils.RmanMesh, test_eq)
self.assertEqual(mesh, mesh_test)
bpy.ops.object.delete()


94 changes: 94 additions & 0 deletions rfb_unittests/test_shader_nodes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import unittest
import bpy
from ..rfb_utils import string_utils, property_utils
from .. import rfb_api
import rman

class ShaderNodesTest(unittest.TestCase):

@classmethod
def add_tests(self, suite):
suite.addTest(ShaderNodesTest('test_value_conversion'))
suite.addTest(ShaderNodesTest('test_rtparamlist'))

# test getvar
def test_value_conversion(self):
import mathutils

mat, n1 = rfb_api.create_bxdf('PxrSurface')
n2 = rfb_api.create_pattern('PxrPrimvar', mat)
n3 = rfb_api.create_pattern('PxrDirt', mat)

diffuse_color = [0.18, 0.18, 0.18]
diffuse_color_test = string_utils.convert_val(n1.diffuseColor, type_hint='color')
bias_direction = [0.0, 0.0, 0.0]
bias_direction_test = string_utils.convert_val(n3.biasDirection)

bl_mtx = string_utils.convert_val(mathutils.Matrix.Identity(4))
rman_mtx = [1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
]

unitLength = 0.1
diffuseDoubleSided = 0
var_type = 'float'

for i in range(3):
self.assertAlmostEqual(diffuse_color[i], diffuse_color_test[i])

for i in range(3):
self.assertAlmostEqual(bias_direction[i], bias_direction_test[i])

for i in range(16):
self.assertAlmostEqual(rman_mtx[i], bl_mtx[i])

self.assertAlmostEqual(unitLength, string_utils.convert_val(n1.unitLength, type_hint='float'))
self.assertEqual(diffuseDoubleSided, string_utils.convert_val(n1.diffuseDoubleSided, type_hint='int'))
self.assertEqual(var_type, string_utils.convert_val(n2.type, type_hint='string'))

bpy.data.materials.remove(mat)

# test RtParamList
def test_rtparamlist(self):
from ..rfb_utils import prefs_utils
diffuse_params = [
'diffuseColor',
'transmissionBehavior',
'transmissionColor',
'presence',
'bumpNormal',
'shadowBumpTerminator'
]

def test_eq(a, b, msg=None):
# for now, we can only check the existence
# of a parameter
# we cannot retrieve its value
for nm in diffuse_params:
if not b.HasParam(nm):
msg = "%s is not in RtParamList" % nm
raise self.failureException(msg)

mat, node = rfb_api.create_bxdf('PxrDiffuse')
params = rman.Types.RtParamList()
params_test = rman.Types.RtParamList()

params.SetColor("diffuseColor", [0.5, 0.5, 0.5])
params.SetInteger("transmissionBehavior", 2)
params.SetColor("transmissionColor", [0.0, 0.0, 0.0])
params.SetFloat("presence", 1.0)
params.SetNormal("bumpNormal", [0.0, 0.0, 0.0])
params.SetInteger("shadowBumpTerminator", 1)

prefs = prefs_utils.get_addon_prefs()
pref_val = prefs_utils.get_pref('rman_emit_default_params', False)
prefs.rman_emit_default_params = True
property_utils.set_node_rixparams(node, None, params_test)
self.addTypeEqualityFunc(rman.Types.RtParamList, test_eq)
self.assertEqual(params, params_test)

prefs.rman_emit_default_params = pref_val
bpy.data.materials.remove(mat)

0 comments on commit 8e95f1c

Please sign in to comment.