Skip to content

Commit a132a00

Browse files
committed
Some SceneViewInspector enhancements, and added mesh light visual (every mesh assigned an emission shader will become a light).
1 parent 09c317c commit a132a00

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

src/GafferCycles/CyclesShader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ void CyclesShader::loadShader( const std::string &shaderName, bool keepExistingV
162162
{
163163
typePlug()->setValue( "ccl:aov:" );
164164
}
165+
else if( shaderName == "emission" )
166+
{
167+
typePlug()->setValue( "ccl:light" );
168+
}
165169
else
166170
{
167171
typePlug()->setValue( "ccl:surface" );

startup/GafferScene/cyclesLights.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,8 @@
7979
Gaffer.Metadata.registerValue( "ccl:light:background_light", "exposureParameter", "exposure" )
8080
Gaffer.Metadata.registerValue( "ccl:light:background_light", "colorParameter", "color" )
8181
Gaffer.Metadata.registerValue( "ccl:light:background_light", "visualiserOrientation", imath.M44f().rotate( imath.V3f( 0, -0.5 * math.pi, 0 ) ) )
82+
83+
Gaffer.Metadata.registerValue( "ccl:light:emission", "intensityParameter", "intensity" )
84+
Gaffer.Metadata.registerValue( "ccl:light:emission", "exposureParameter", "exposure" )
85+
Gaffer.Metadata.registerValue( "ccl:light:emission", "colorParameter", "color" )
86+
Gaffer.Metadata.registerValue( "ccl:light:emission", "type", "mesh" )
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
##########################################################################
2+
#
3+
# Copyright (c) 2020, Alex Fuller. All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are
7+
# met:
8+
#
9+
# * Redistributions of source code must retain the above
10+
# copyright notice, this list of conditions and the following
11+
# disclaimer.
12+
#
13+
# * Redistributions in binary form must reproduce the above
14+
# copyright notice, this list of conditions and the following
15+
# disclaimer in the documentation and/or other materials provided with
16+
# the distribution.
17+
#
18+
# * Neither the name of Alex Fuller. nor the names of
19+
# any other contributors to this software may be used to endorse or
20+
# promote products derived from this software without specific prior
21+
# written permission.
22+
#
23+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24+
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34+
#
35+
##########################################################################
36+
37+
import GafferSceneUI
38+
39+
40+
for p in [ "intensity", "exposure", "color", "size", "coneAngle", "penumbraAngle", "samples" ] :
41+
GafferSceneUI._SceneViewInspector.registerShaderParameter( "ccl:light", p )
42+
43+
for p in ["base_color", "subsurface_color", "metallic", "subsurface", "subsurface_radius", "specular", "roughness", "specular_tint" ] :
44+
GafferSceneUI._SceneViewInspector.registerShaderParameter( "ccl:surface", p )

0 commit comments

Comments
 (0)