Skip to content

Commit

Permalink
Merge pull request #10 from AlexSchwank/feature/apple_assets_contribu…
Browse files Browse the repository at this point in the history
…tion_1

added schema tests and foundation tests
  • Loading branch information
meshula authored Aug 31, 2022
2 parents 6d80b04 + 4d772d8 commit 10cd18e
Show file tree
Hide file tree
Showing 193 changed files with 2,996 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test_assets/_common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Common Assets

This set of common support assets is reused by multiple test assets through referencing.
This allows test files to reduce their size and use a consistent, known base.
Also included is an error image that can be used to indicate an application or render issue.

## Animated Cube Translation

![screenshot](screenshots/animated_cube_translation_usdrecord_22.08.png)
_usdrecord 22.08_

## Axis

![screenshot](screenshots/axis_usdrecord_22.08.png)
_usdrecord 22.08_

## Error Image

![error](error.png)
38 changes: 38 additions & 0 deletions test_assets/_common/animated_cube_translation.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def Xform "World"
{
def Mesh "animatedCube"
{
double3 xformOp:translate = (0, 0, 0)
double3 xformOp:translate.timeSamples = {
0: (0, 0, 0),
100: (100, 0, 0),
}
uniform token[] xformOpOrder = ["xformOp:translate"]

int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 4, 6, 2, 0, 1, 5, 4, 4, 5, 7, 6, 3, 7, 5, 1, 6, 7, 3, 2, 2, 3, 1, 0]
point3f[] points = [(-0.5, -0.5, -0.5), (0.5, -0.5, -0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (-0.5, -0.5, 0.5), (0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5)]
float3[] extent = [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)]
uniform token subdivisionScheme = "none"
}

def Camera "camera"
{
float2 clippingRange = (1.0, 2000000.0)
float focalLength = 218.12925720214844
float focusDistance = 1129.03515625
float fStop = 5.6
float horizontalAperture = 24.0519962310791
float verticalAperture = 20.954999923706055
custom Matrix4d xformOp:transform = ((1.0, 0.0, 0.0, 0.0),(0.0, 1.0, 0.0, 0.0),(0.0, 0.0, 1.0, 0.0),(50.0, 0.0, 1129.0351765518724, 1.0))
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}
34 changes: 34 additions & 0 deletions test_assets/_common/axis.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def Xform "World"
{
def Cube "X"
{
color3f[] primvars:displayColor = [(1, 0, 0)]
float3 xformOp:scale = (1, 0.1, 0.1)
double3 xformOp:translate = (1.1, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:scale"]
}

def Cube "Y"
{
color3f[] primvars:displayColor = [(0, 1, 0)]
float3 xformOp:scale = (0.1, 1, 0.1)
double3 xformOp:translate = (0, 1.1, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:scale"]
}

def Cube "Z"
{
color3f[] primvars:displayColor = [(0, 0, 1)]
float3 xformOp:scale = (0.1, 0.1, 1)
double3 xformOp:translate = (0, 0, 1.1)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:scale"]
}
}
Binary file added test_assets/_common/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions test_assets/foundation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Foundation Tests

This set of assets is aimed at testing and providing examples for foundational USD concepts such as composition and stage metadatas.
Schema specific assets can be found in [schemaTests](../schemaTests/) instead.
55 changes: 55 additions & 0 deletions test_assets/foundation/stage_composition/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Stage Composition

These assets show and test how compositon arcs and related concepts work.

## Payload

[payload](./payload/) contains assets to test payloading files and prims.

## Reference

[reference](./reference/) contains assets to test referencing files and prims.

## SubLayer

[subLayer](./subLayer/) contains assets to test sublayering files.

## Active

[active.usda](./active.usda) shows an example of the `active` prim metadata. One inactive (`active = false`), red cube and one active (`active = true`), green cube exist in the stage.

![screenshot](screenshots/active_usdrecord_22.08.png)
_active.usda, usdrecord 22.08_

## Classes

[class_inherit.usda](./class_inherit.usda) shows how to use a `class` and what effect overriding a class attribute has in an inheriting prim.

![screenshot](screenshots/class_inherit_usdrecord_22.08.png)
_class\_inherit.usda, usdrecord 22.08_

## Inherit and Specialize

[inherit_and_specialize.usda](./inherit_and_specialize.usda) shows the difference between `inherits` and `specializes`.

![screenshot](screenshots/inherit_and_specialize_usdrecord_22.08.png)
_inherit\_and\_specialize.usda, usdrecord 22.08_

## Over

[over.usda](./over.usda) shows the difference between `over`s and `def`s.

![screenshot](screenshots/class_inherit_usdrecord_22.08.png)
_over.usda, usdrecord 22.08_

## Purpose

[purpose.usda](./purpose.usda) shows an example of the `purpose` prim attribute. There are four cubes with different `purpose` tokens set:

- `CubeIsGuide` with `token purpose = "guide"`, colored red
- `CubeIsRender` with `token purpose = "render"`, colored green
- `CubeIsProxy` with `token purpose = "proxy"`, colored blue
- `CubeIsOther` with `token purpose = "other"`, colored yellow

![screenshot](screenshots/purpose_usdrecord_22.08.png)
_purpose.usda, usdrecord 22.08_
14 changes: 14 additions & 0 deletions test_assets/foundation/stage_composition/_parent_stage.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def Scope "World"
{
def Cube "Cube"
{
}
}
28 changes: 28 additions & 0 deletions test_assets/foundation/stage_composition/active.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def Scope "World"
{
def Cube "CubeInactive" (
active=false
)
{
color3f[] primvars:displayColor = [(0.8, 0, 0)]
}

def Cube "CubeActive" (
active=true
)
{
color3f[] primvars:displayColor = [(0, 0.8, 0)]

double3 xformOp:translate = (3, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
}

30 changes: 30 additions & 0 deletions test_assets/foundation/stage_composition/class_inherit.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

class "_myClass"
{
color3f[] primvars:displayColor = [(0, 0.8, 0)]
}

def Scope "World" {
def Cube "cubeWithoutSetColor" (
inherits = </_myClass>
)
{
}

def Cube "cubeWithSetColor" (
inherits = </_myClass>
)
{
color3f[] primvars:displayColor = [(0.8, 0, 0)]

double3 xformOp:translate = (3, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def Scope "World" {

def Xform "cubeScene" {
def Cube "source" {
color3f[] primvars:displayColor = [(0.8, 0, 0)]
}

def Cube "specializes" (
specializes = </World/cubeScene/source>
)
{
color3f[] primvars:displayColor = [(0.8, 0.8, 0)]

double3 xformOp:translate = (3, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}

def Cube "inherits" (
inherits = </World/cubeScene/source>
)
{
color3f[] primvars:displayColor = [(0.8, 0.8, 0)]

double3 xformOp:translate = (6, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
}

def Xform "cubeSceneReferenced" (
references = </World/cubeScene>
)
{
double3 xformOp:translate = (0, 3, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]

def "source"
{
color3f[] primvars:displayColor = [(0, 0.8, 0)]
}
}
}
26 changes: 26 additions & 0 deletions test_assets/foundation/stage_composition/over.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#usda 1.0
(
subLayers = [
@_parent_stage.usda@
]
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

over "World"
{
over "Cube" {
color3f[] primvars:displayColor = [(0, 0, 0.8)]
}

def Cube "definedCube" {
double3 xformOp:translate = (3, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}

over Cube "undefinedCube" {
double3 xformOp:translate = (6, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
}
11 changes: 11 additions & 0 deletions test_assets/foundation/stage_composition/payload/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Payload

These files `payload` stages from different locations on disk. If loaded successfully, a single cube should be visible.

![screenshot](screenshots/payload_same_folder_usdrecord_22.08.png)
_usdrecord 22.08_

- file in child folder: [payload_child_folder.usda](payload_child_folder.usda)
- invalid file: [payload_invalid.usda](payload_invalid.usda)
- file in parent folder: [payload_parent_folder.usda](payload_parent_folder.usda)
- file in same folder: [payload_same_folder.usda](payload_same_folder.usda)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def Scope "World"
{
def Cube "Cube"
{
}
}
14 changes: 14 additions & 0 deletions test_assets/foundation/stage_composition/payload/_stage.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#usda 1.0
(
defaultPrim = "World"
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def Scope "World"
{
def Cube "Cube"
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#usda 1.0
(
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def "World" (
payload = [@_children/_child_stage.usda@]
)
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#usda 1.0
(
customLayerData = {
string copyright = '''Copyright 2022 Apple Inc. All rights reserved.'''
}
)

def "World"
{
def "invalid_payload" (
payload = [@file_does_not_exist.usda@]
)
{
}

def Cube "cube"
{
}
}
Loading

0 comments on commit 10cd18e

Please sign in to comment.