Skip to content

Commit

Permalink
Merge branch '1.4_maintenance'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Aug 5, 2024
2 parents f8b3e5c + a293f3c commit b7773c9
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 55 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/versionCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Version check
on: [ pull_request ]
jobs:

check:

name: Version check
runs-on: ubuntu-20.04

steps:

# Checkout both the merge commit for the PR and the
# source branch for the PR.

- uses: actions/checkout@v4
with:
path: merge

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: source

# Do the check.

- name: Check version
run: |
import os
import re
import sys
# Parses version number from the SConstruct file.
def version( filename ) :
versions = {}
versionRe = re.compile( r"^(gaffer.*Version.*) = (\S+)" )
with open( filename ) as sconstruct :
for line in sconstruct.readlines() :
versionMatch = versionRe.match( line )
if versionMatch :
versions[versionMatch.group( 1 )] = versionMatch.group( 2 ).strip( "'\"" )
return versions["gafferMilestoneVersion"] + "." + versions["gafferMajorVersion"]
# Check that versions match between source and target branches, to avoid
# common mistake of targeting a PR to `main` rather than a maintenance branch.
#
# > Note : We compare the source version to the merged version rather than the
# > version from the target branch itself, to allow a PR to change version number
# > if necessary. That will just be subject to the usual human review process.
mergeVersion = version( "merge/SConstruct" )
sourceVersion = version( "source/SConstruct" )
if sourceVersion != mergeVersion :
message = "Source version {} does not match target version {}. Did you choose the wrong target branch?\n".format(
sourceVersion, mergeVersion
)
sys.stderr.write( f"FAIL : {message}" )
with open( os.environ["GITHUB_STEP_SUMMARY"], "a" ) as summary :
summary.write( f"> [!CAUTION]\n> {message}" )
sys.exit( 1 )
else :
with open( os.environ["GITHUB_STEP_SUMMARY"], "a" ) as summary :
summary.write( f"> [!NOTE]\n> Targeting version {mergeVersion}" )
shell: python
4 changes: 3 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ Improvements
------------

- SetExpressions : Set Expressions containing only whitespace characters are now treated as empty rather than producing an error.
- ArnoldShader : Moved Arnold 7.3.3.0's new `standard_volume.scatter_diffusion` parameters to a "Scatter Diffusion" section of the UI.
- ArnoldShader :
- Added a UI layout for the new `openpbr_surface` shader.
- Moved Arnold 7.3.3.0's new `standard_volume.scatter_diffusion` parameters to a "Scatter Diffusion" section of the UI.

Fixes
-----
Expand Down
50 changes: 1 addition & 49 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -922,55 +922,6 @@ if env["ARNOLD_ROOT"] :

arnoldInstallRoot = "${{BUILD_DIR}}/arnold/{ARCH}.{MAJOR}".format( **arnoldVersions )

# Metadata. Our `arnoldPlugins/gaffer.mtd` contains metadata for all the Arnold
# nodes we know about, in all Arnold versions. We need to filter this down
# to only the nodes in _this_ Arnold version during installation. Arnold emits
# warnings if we attempt to register metadata for nodes that don't exist.

def filterMetadata( target, source, env ) :

# Get set of built-in nodes

kickEnv = env["ENV"].copy()
kickEnv["PATH"] = os.pathsep.join( [ os.path.join( env["ARNOLD_ROOT"], "bin" ), kickEnv["PATH"] ] )
kickOutput = subprocess.check_output(
"kick -nodes",
env = kickEnv,
universal_newlines = True,
shell = True
)

nodeDefRegex = re.compile( r"\s*([a-zA-Z0-9_]+)\s+(driver|color_manager|driver|filter|imager|light|operator|options|override|shader|shape)" )
nodes = set()
for line in kickOutput.split( "\n" ) :
m = nodeDefRegex.match( line )
if m :
nodes.add( m.group( 1 ) )

# Filter the input metadata file so that we only include metadata
# for nodes that exist.

newNodeRegex = re.compile( r"^\[node ([a-zA-Z_0-9]+)\]" )
with open( str( source[0] ) ) as inFile :
with open( str( target[0] ), "w" ) as outFile :
omit = False
for line in inFile.readlines() :
m = newNodeRegex.match( line )
if m :
nodeName = m.group( 1 )
omit = nodeName not in nodes
if omit :
sys.stderr.write( "Omitting non-existent node {}\n".format( nodeName ) )
if not omit :
outFile.write( line )

metadataInstall = env.Command(
os.path.join( arnoldInstallRoot, "arnoldPlugins/gaffer.mtd" ),
"arnoldPlugins/gaffer.mtd",
filterMetadata
)
env.Alias( "build", metadataInstall )

###############################################################################################
# Definitions for the libraries we wish to build
###############################################################################################
Expand Down Expand Up @@ -1191,6 +1142,7 @@ libraries = {
},
"requiredOptions" : [ "ARNOLD_ROOT" ],
"installRoot" : arnoldInstallRoot,
"additionalFiles" : [ "arnoldPlugins/gaffer.mtd" ],
},

"IECoreArnoldTest" : {
Expand Down
197 changes: 197 additions & 0 deletions arnoldPlugins/gaffer.mtd
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,203 @@
gaffer.nodeMenu.category STRING "Maths"


[node openpbr_surface]

gaffer.nodeMenu.category STRING "Surface"

gaffer.graphEditorLayout.defaultVisibility BOOL false

[attr base_weight]
page STRING "Base"
label STRING "Weight"
[attr base_color]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Base"
label STRING "Color"
[attr base_metalness]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Base"
label STRING "Metalness"
[attr base_diffuse_roughness]
page STRING "Base"
label STRING "Diffuse Roughness"

[attr specular_weight]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Specular"
label STRING "Weight"
[attr specular_color]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Specular"
label STRING "Color"
[attr specular_roughness]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Specular"
label STRING "Roughness"
[attr specular_roughness_anisotropy]
page STRING "Specular"
label STRING "Roughness Anisotropy"
[attr specular_ior]
page STRING "Specular"
label STRING "IOR"

[attr transmission_weight]
page STRING "Transmission"
label STRING "Weight"
[attr transmission_color]
page STRING "Transmission"
label STRING "Color"
[attr transmission_depth]
page STRING "Transmission"
label STRING "Depth"
[attr transmission_scatter]
page STRING "Transmission"
label STRING "Scatter"
[attr transmission_scatter_anisotropy]
page STRING "Transmission"
label STRING "Scatter Anisotropy"
[attr transmission_dispersion_abbe_number]
page STRING "Transmission"
label STRING "Dispersion Abbe Number"
[attr transmission_dispersion_scale]
page STRING "Transmission"
label STRING "Dispersion Scale"
[attr transmission_transmit_aovs]
page STRING "Transmission"
label STRING "Transmit AOVs"
[attr dielectric_priority]
page STRING "Transmission"

[attr subsurface_weight]
page STRING "Subsurface"
label STRING "Weight"
[attr subsurface_color]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Subsurface"
label STRING "Color"
[attr subsurface_radius]
page STRING "Subsurface"
label STRING "Radius"
[attr subsurface_radius_scale]
page STRING "Subsurface"
label STRING "Radius Scale"
[attr subsurface_scatter_anisotropy]
page STRING "Subsurface"
label STRING "Scatter Anisotropy"

[attr coat_weight]
page STRING "Coat"
label STRING "Weight"
[attr coat_color]
page STRING "Coat"
label STRING "Color"
[attr coat_roughness]
page STRING "Coat"
label STRING "Roughness"
[attr coat_roughness_anisotropy]
page STRING "Coat"
label STRING "Roughness Anisotropy"
[attr coat_ior]
page STRING "Coat"
label STRING "IOR"
[attr coat_darkening]
page STRING "Coat"
label STRING "Darkening"

[attr fuzz_weight]
page STRING "Fuzz"
label STRING "Weight"
[attr fuzz_color]
page STRING "Fuzz"
label STRING "Color"
[attr fuzz_roughness]
page STRING "Fuzz"
label STRING "Roughness"

[attr emission_luminance]
page STRING "Emission"
label STRING "Luminance"
[attr emission_color]
page STRING "Emission"
label STRING "Color"

[attr thin_film_weight]
page STRING "Thin Film"
label STRING "Weight"
[attr thin_film_thickness]
page STRING "Thin Film"
label STRING "Thickness"
[attr thin_film_ior]
page STRING "Thin Film"
label STRING "IOR"

[attr geometry_thin_walled]
page STRING "Geometry"
label STRING "Thin Walled"
[attr geometry_opacity]
page STRING "Geometry"
label STRING "Opacity"
[attr geometry_normal]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Geometry"
label STRING "Normal"
[attr geometry_tangent]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Geometry"
label STRING "Tangent"
[attr geometry_coat_normal]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Geometry"
label STRING "Coat Normal"
[attr geometry_coat_tangent]
gaffer.graphEditorLayout.visible BOOL true
page STRING "Geometry"
label STRING "Coat Tangent"

[attr caustics]
page STRING "Advanced"
[attr internal_reflections]
page STRING "Advanced"
[attr exit_to_background]
page STRING "Advanced"
[attr indirect_diffuse]
page STRING "Advanced"
[attr indirect_specular]
page STRING "Advanced"

[attr aov_id1]
page STRING "AOV"
[attr aov_id2]
page STRING "AOV"
[attr aov_id3]
page STRING "AOV"
[attr aov_id4]
page STRING "AOV"
[attr aov_id5]
page STRING "AOV"
[attr aov_id6]
page STRING "AOV"
[attr aov_id7]
page STRING "AOV"
[attr aov_id8]
page STRING "AOV"
[attr id1]
page STRING "AOV"
[attr id2]
page STRING "AOV"
[attr id3]
page STRING "AOV"
[attr id4]
page STRING "AOV"
[attr id5]
page STRING "AOV"
[attr id6]
page STRING "AOV"
[attr id7]
page STRING "AOV"
[attr id8]
page STRING "AOV"

[node osl]

# In Gaffer, you should load OSL shaders in Gaffer, or use OSLCode, which will be
Expand Down
10 changes: 5 additions & 5 deletions python/GafferArnoldUI/ArnoldShaderUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,15 @@ def __translateNodeMetadata( nodeEntry ) :
__metadata[parent]["layout:section:%s:collapsed" % page] = collapsed

# Label from OSL "label"
defaultLabel = " ".join( [ i.capitalize() for i in paramName.split( "_" ) ] )
label = __aiMetadataGetStr( nodeEntry, paramName, "label" )
if label is None :
# Label from Arnold naming convention
# Arnold uses snake_case rather than camelCase for naming, so translate this into
# nice looking names
label = " ".join( [ i.capitalize() for i in paramName.split( "_" ) ] )
label = defaultLabel

__metadata[paramPath]["label"] = label
__metadata[paramPath]["noduleLayout:label"] = label
# Custom labels typically only make sense in the context of `page`, so we
# use the default label for the GraphEditor.
__metadata[paramPath]["noduleLayout:label"] = defaultLabel

if (
arnold.AiNodeEntryGetType( nodeEntry ) == arnold.AI_NODE_LIGHT and
Expand Down
9 changes: 9 additions & 0 deletions src/IECoreArnold/UniverseBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ namespace

void loadMetadata( const std::string &pluginPaths )
{
// Arnold issues warnings for non-existent nodes referenced in `.mtd` files,
// which is very inconvenient if wanting to author metadata for use across
// multiple Arnold versions. So we disable warnings while loading the metadata
// and restore them at the end of this function.
const int flags = AiMsgGetConsoleFlags( nullptr );
AiMsgSetConsoleFlags( nullptr, AI_LOG_ERRORS );

using Tokenizer = boost::tokenizer<boost::char_separator<char> >;
#ifdef _WIN32
const char *separator = ";";
Expand Down Expand Up @@ -84,6 +91,8 @@ void loadMetadata( const std::string &pluginPaths )
IECore::msg( IECore::Msg::Debug, "UniverseBlock", e.what() );
}
}

AiMsgSetConsoleFlags( nullptr, flags );
}

void begin()
Expand Down

0 comments on commit b7773c9

Please sign in to comment.