Skip to content

Commit 356caab

Browse files
authored
Merge pull request #1406 from johnhaddon/lightsSet
USDScene : Support round-tripping of non-UsdLux lights
2 parents 3590653 + 87bd62d commit 356caab

File tree

5 files changed

+85
-68
lines changed

5 files changed

+85
-68
lines changed

Changes

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
10.5.x.x (relative to 10.5.6.0)
22
========
33

4-
54
Improvements
65
------------
76

87
- DisplayDriverServer : Fixed delays connecting to the server on Windows.
98

9+
Fixes
10+
-----
11+
12+
- USDScene : Fixed round-tripping of `__lights` set membership for non-UsdLux lights.
13+
1014
Build
1115
-----
1216

1317
- SConstruct : Support detection of OpenEXR versions with a patch version containing multiple digits.
1418

19+
1520
10.5.6.0 (relative to 10.5.5.0)
1621
========
1722

contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ IECore::PathMatcher localSet( const pxr::UsdPrim &prim, const pxr::TfToken &name
247247
{
248248
result.addPath( std::vector<IECore::InternedString>() );
249249
}
250-
return result;
251250
}
252251

253252
const size_t prefixSize = prim.GetPath().GetPathElementCount();

contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3973,5 +3973,33 @@ def testReadFromStageCache( self ) :
39733973
self.assertEqual( root.childNames(), [ "sphere" ] )
39743974
self.assertIsInstance( root.child( "sphere" ).readObject( 0 ), IECoreScene.SpherePrimitive )
39753975

3976+
def testRoundTripArnoldLight( self ) :
3977+
3978+
lightShader = IECoreScene.ShaderNetwork(
3979+
shaders = {
3980+
"light" : IECoreScene.Shader( "distant_light", parameters = { "exposure" : 2.0 } )
3981+
},
3982+
output = "light",
3983+
)
3984+
3985+
root = IECoreScene.SceneInterface.create(
3986+
os.path.join( self.temporaryDirectory(), "test.usda" ),
3987+
IECore.IndexedIO.OpenMode.Write
3988+
)
3989+
light = root.createChild( "light" )
3990+
light.writeAttribute( "ai:light", lightShader, 0 )
3991+
root.writeSet( "__lights", IECore.PathMatcher( [ "/light" ] ) )
3992+
del root, light
3993+
3994+
root = IECoreScene.SceneInterface.create(
3995+
os.path.join( self.temporaryDirectory(), "test.usda" ),
3996+
IECore.IndexedIO.OpenMode.Read
3997+
)
3998+
light = root.child( "light" )
3999+
self.assertIn( "ai:light", light.attributeNames() )
4000+
self.assertEqual( light.readAttribute( "ai:light", 0 ), lightShader )
4001+
self.assertIn( "__lights", root.setNames() )
4002+
self.assertEqual( root.readSet( "__lights" ), IECore.PathMatcher( [ "/light" ] ) )
4003+
39764004
if __name__ == "__main__":
39774005
unittest.main()
Lines changed: 44 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,53 @@
11
#usda 1.0
2-
# Source: https://graphics.pixar.com/usd/docs/api/_usd_skel__schema_overview.html
2+
#Source: https://graphics.pixar.com/usd/docs/api/_usd_skel__schema_overview.html
33
(
4-
startTimeCode = 1
5-
endTimeCode = 10
4+
endTimeCode = 10
5+
startTimeCode = 1
6+
upAxis = "Y"
67
)
8+
79
def SkelRoot "Model" (
8-
prepend apiSchemas = ["SkelBindingAPI"]
10+
prepend apiSchemas = ["SkelBindingAPI"]
911
)
1012
{
11-
def Skeleton "Skel" {
12-
uniform token[] joints = ["Shoulder", "Shoulder/Elbow", "Shoulder/Elbow/Hand"]
13-
uniform matrix4d[] bindTransforms = [
14-
((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1)),
15-
((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,2,1)),
16-
((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,4,1))
17-
]
18-
uniform matrix4d[] restTransforms = [
19-
((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1)),
20-
((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,2,1)),
21-
((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,2,1))
22-
]
23-
def SkelAnimation "Anim" {
24-
uniform token[] joints = ["Shoulder/Elbow"]
13+
def Skeleton "Skel" (
14+
prepend apiSchemas = ["SkelBindingAPI"]
15+
)
16+
{
17+
uniform matrix4d[] bindTransforms = [( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 2, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 4, 1) )]
18+
uniform token[] joints = ["Shoulder", "Shoulder/Elbow", "Shoulder/Elbow/Hand"]
19+
uniform matrix4d[] restTransforms = [( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 2, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 2, 1) )]
20+
rel skel:animationSource = </Model/Skel/Anim>
2521

26-
float3[] translations = [(0,0,2)]
27-
quatf[] rotations.timeSamples = {
28-
1: [(1,0,0,0)],
29-
10: [(0.7071, 0.7071, 0, 0)]
30-
}
31-
half3[] scales = [(1,1,1)]
32-
}
22+
def SkelAnimation "Anim"
23+
{
24+
uniform token[] joints = ["Shoulder/Elbow"]
25+
quatf[] rotations.timeSamples = {
26+
1: [(1, 0, 0, 0)],
27+
10: [(0.7071, 0.7071, 0, 0)],
28+
}
29+
half3[] scales = [(1, 1, 1)]
30+
float3[] translations = [(0, 0, 2)]
31+
}
32+
}
3333

34-
rel skel:animationSource = <Anim>
35-
}
36-
def Mesh "Arm" (
37-
prepend apiSchemas = ["SkelBindingAPI"]
38-
)
39-
{
40-
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
41-
int[] faceVertexIndices = [
42-
2, 3, 1, 0,
43-
6, 7, 5, 4,
44-
8, 9, 7, 6,
45-
3, 2, 9, 8,
46-
10, 11, 4, 5,
47-
0, 1, 11, 10,
48-
7, 9, 10, 5,
49-
9, 2, 0, 10,
50-
3, 8, 11, 1,
51-
8, 6, 4, 11
52-
]
53-
point3f[] points = [
54-
(0.5, -0.5, 4), (-0.5, -0.5, 4), (0.5, 0.5, 4), (-0.5, 0.5, 4),
55-
(-0.5, -0.5, 0), (0.5, -0.5, 0), (-0.5, 0.5, 0), (0.5, 0.5, 0),
56-
(-0.5, 0.5, 2), (0.5, 0.5, 2), (0.5, -0.5, 2), (-0.5, -0.5, 2)
57-
]
58-
rel skel:skeleton = </Model/Skel>
59-
int[] primvars:skel:jointIndices = [
60-
2,2,2,2, 0,0,0,0, 1,1,1,1
61-
] (
62-
interpolation = "vertex"
63-
elementSize = 1
64-
)
65-
float[] primvars:skel:jointWeights = [
66-
1,1,1,1, 1,1,1,1, 1,1,1,1
67-
] (
68-
interpolation = "vertex"
69-
elementSize = 1
70-
)
71-
matrix4d primvars:skel:geomBindTransform = ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1))
72-
}
34+
def Mesh "Arm" (
35+
prepend apiSchemas = ["SkelBindingAPI"]
36+
)
37+
{
38+
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
39+
int[] faceVertexIndices = [2, 3, 1, 0, 6, 7, 5, 4, 8, 9, 7, 6, 3, 2, 9, 8, 10, 11, 4, 5, 0, 1, 11, 10, 7, 9, 10, 5, 9, 2, 0, 10, 3, 8, 11, 1, 8, 6, 4, 11]
40+
point3f[] points = [(0.5, -0.5, 4), (-0.5, -0.5, 4), (0.5, 0.5, 4), (-0.5, 0.5, 4), (-0.5, -0.5, 0), (0.5, -0.5, 0), (-0.5, 0.5, 0), (0.5, 0.5, 0), (-0.5, 0.5, 2), (0.5, 0.5, 2), (0.5, -0.5, 2), (-0.5, -0.5, 2)]
41+
matrix4d primvars:skel:geomBindTransform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
42+
int[] primvars:skel:jointIndices = [2, 2, 2, 2, 0, 0, 0, 0, 1, 1, 1, 1] (
43+
elementSize = 1
44+
interpolation = "vertex"
45+
)
46+
float[] primvars:skel:jointWeights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] (
47+
elementSize = 1
48+
interpolation = "vertex"
49+
)
50+
rel skel:skeleton = </Model/Skel>
51+
}
7352
}
53+

contrib/IECoreUSD/test/IECoreUSD/data/shaderNameConflict.usda

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#usda 1.0
2+
(
3+
upAxis = "Y"
4+
)
25

3-
def Xform "shaderLocation"
6+
def Xform "shaderLocation" (
7+
prepend apiSchemas = ["MaterialBindingAPI"]
8+
)
49
{
5-
rel material:binding = </shaderLocation/materials/testMat>
610
custom float arnold:surface = 7
11+
rel material:binding = </shaderLocation/materials/testMat>
712

813
def Scope "materials"
914
{

0 commit comments

Comments
 (0)