File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1110.6.x.x (relative to 10.6.1.0)
22========
33
4+ Fixes
5+ -----
46
7+ - ShaderNetwork::hashSubstitutions : Fixed shader string substitutions that are escaped with backslashes ( ie. `myText\<substitutionHandledByArnold\>` ).
58
6910.6.1.0 (relative to 10.6.0.2)
710========
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ class IECORESCENE_API ShaderNetwork : public IECore::BlindDataHolder
197197 // /
198198 // / We support special syntax that allows you to substitute string attributes
199199 // / into the values of string parameters on shaders.
200- // /
200+ // /
201201 // / If a string parameter, or string vector parameter, contains the token
202202 // / <attr:PARAMETER_NAME>, then it will be subsituted with the value of a
203203 // / string attribute named PARAMETER_NAME. If there is no attribute named
@@ -208,7 +208,7 @@ class IECORESCENE_API ShaderNetwork : public IECore::BlindDataHolder
208208 // / you can escape the angle brackets with backslashes, like
209209 // / "\<attr:PARAMETER_NAME\>"
210210
211- // / Appends all attributes used by ` applySubstitutions()` into the hash .
211+ // / Appends to the hash to reflect all changes made by applySubstitutions( attributes ) .
212212 void hashSubstitutions ( const IECore::CompoundObject *attributes, IECore::MurmurHash &h ) const ;
213213
214214 // / Apply substitutions to all string and string vector parameters in the network,
Original file line number Diff line number Diff line change @@ -447,6 +447,13 @@ class ShaderNetwork::Implementation
447447 h.append ( 0 );
448448 }
449449 }
450+
451+ if ( m_parmsNeedingSubstitution.size () && !m_neededSubstitutions.size () )
452+ {
453+ // We don't depend on any attributes, but some parameters have escaped substitutions.
454+ // Modify hash to reflect the fact that applySubstitutions() will remove the escaping.
455+ h.append ( true );
456+ }
450457 }
451458
452459 void applySubstitutions ( const CompoundObject *attributes )
@@ -745,7 +752,10 @@ class ShaderNetwork::Implementation
745752 }
746753 }
747754
748- m_parmsNeedingSubstitution[ node.handle ] = parmsNeedingSub;
755+ if ( parmsNeedingSub.size () )
756+ {
757+ m_parmsNeedingSubstitution[ node.handle ] = parmsNeedingSub;
758+ }
749759 }
750760
751761 m_hash.append ( m_output.shader );
Original file line number Diff line number Diff line change @@ -591,6 +591,8 @@ def testSubstitutions( self ) :
591591 } ) )
592592 ( h6 , sSubst6 ) = self .__hashAndSubstitution ( s , {} )
593593 ( h7 , sSubst7 ) = self .__hashAndSubstitution ( s , allAttributes )
594+ self .assertNotEqual ( h6 , IECore .MurmurHash () )
595+ self .assertNotEqual ( h7 , IECore .MurmurHash () )
594596 self .assertEqual ( h6 , h7 )
595597 self .assertEqual ( sSubst6 , sSubst7 )
596598 self .assertEqual ( sSubst6 .parameters ["a" ].value , "pre<attr:fred>post" )
You can’t perform that action at this time.
0 commit comments