mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
Support all of usdGeom/usdShade/usdLux API tokens.
This commit is contained in:
@@ -2074,14 +2074,42 @@ std::string to_string(const APISchemas::APIName &name) {
|
||||
std::string s;
|
||||
|
||||
switch (name) {
|
||||
case APISchemas::APIName::VisibilityAPI: {
|
||||
s = "VisibilityAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::XformCommonAPI: {
|
||||
s = "XformCommonAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::SkelBindingAPI: {
|
||||
s = "SkelBindingAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::MotionAPI: {
|
||||
s = "MotionAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::PrimvarsAPI: {
|
||||
s = "PrimvarsAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::CollectionAPI: {
|
||||
s = "CollectionAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::ConnectableAPI: {
|
||||
s = "ConnectableAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::CoordSysAPI: {
|
||||
s = "CoordSysAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::NodeDefAPI: {
|
||||
s = "NodeDefAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::MaterialBindingAPI: {
|
||||
s = "MaterialBindingAPI";
|
||||
break;
|
||||
@@ -2090,6 +2118,34 @@ std::string to_string(const APISchemas::APIName &name) {
|
||||
s = "ShapingAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::ShadowAPI: {
|
||||
s = "ShadowAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::GeomModelAPI: {
|
||||
s = "GeomModelAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::ListAPI: {
|
||||
s = "ListAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::LightAPI: {
|
||||
s = "LightAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::LightListAPI: {
|
||||
s = "LightListAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::VolumeLightAPI: {
|
||||
s = "VolumeLightAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::MeshLightAPI: {
|
||||
s = "MeshLightAPI";
|
||||
break;
|
||||
}
|
||||
case APISchemas::APIName::Preliminary_AnchoringAPI: {
|
||||
s = "Preliminary_AnchoringAPI";
|
||||
break;
|
||||
|
||||
@@ -893,10 +893,32 @@ struct AssetInfo {
|
||||
struct APISchemas {
|
||||
// TinyUSDZ does not allow user-supplied API schema for now
|
||||
enum class APIName {
|
||||
// usdShade
|
||||
MaterialBindingAPI, // "MaterialBindingAPI"
|
||||
SkelBindingAPI, // "SkelBindingAPI"
|
||||
ShapingAPI, // "ShapingAPI"(usdLux)
|
||||
ConnectableAPI, // "ConnectableAPI"
|
||||
CoordSysAPI, // "CoordSysAPI"
|
||||
NodeDefAPI, // "NodeDefAPI"
|
||||
|
||||
CollectionAPI, // "CollectionAPI"
|
||||
// usdGeom
|
||||
GeomModelAPI, // "GeomModelAPI"
|
||||
MotionAPI, // "MotionAPI"
|
||||
PrimvarsAPI, // "PrimvarsAPI"
|
||||
VisibilityAPI, // "VisibilityAPI"
|
||||
XformCommonAPI, // "XformCommonAPI"
|
||||
|
||||
// usdLux
|
||||
LightAPI, // "LightAPI"
|
||||
LightListAPI, // "LightListAPI"
|
||||
ListAPI, // "ListAPI"
|
||||
MeshLightAPI, // "MeshLightAPI"
|
||||
ShapingAPI, // "ShapingAPI"
|
||||
ShadowAPI, // "ShadowAPI"
|
||||
VolumeLightAPI, // "VolumeLightAPI"
|
||||
|
||||
// usdSkel
|
||||
SkelBindingAPI, // "SkelBindingAPI"
|
||||
|
||||
// USDZ AR extensions
|
||||
Preliminary_AnchoringAPI,
|
||||
Preliminary_PhysicsColliderAPI,
|
||||
|
||||
@@ -728,6 +728,10 @@ class USDAReader::Impl {
|
||||
"MaterialBindingAPI"),
|
||||
std::make_pair(APISchemas::APIName::ShapingAPI,
|
||||
"ShapingAPI"),
|
||||
std::make_pair(APISchemas::APIName::ShadowAPI,
|
||||
"ShadowAPI"),
|
||||
std::make_pair(APISchemas::APIName::VolumeLightAPI,
|
||||
"VolumeLightAPI"),
|
||||
std::make_pair(APISchemas::APIName::Preliminary_PhysicsMaterialAPI,
|
||||
"Preliminary_PhysicsMaterialAPI"),
|
||||
std::make_pair(APISchemas::APIName::Preliminary_PhysicsRigidBodyAPI,
|
||||
@@ -735,7 +739,31 @@ class USDAReader::Impl {
|
||||
std::make_pair(APISchemas::APIName::Preliminary_PhysicsColliderAPI,
|
||||
"Preliminary_PhysicsColliderAPI"),
|
||||
std::make_pair(APISchemas::APIName::Preliminary_AnchoringAPI,
|
||||
"Preliminary_AnchoringAPI")
|
||||
"Preliminary_AnchoringAPI"),
|
||||
std::make_pair(APISchemas::APIName::LightAPI,
|
||||
"LightAPI"),
|
||||
std::make_pair(APISchemas::APIName::MeshLightAPI,
|
||||
"MeshLightAPI"),
|
||||
std::make_pair(APISchemas::APIName::LightListAPI,
|
||||
"LightListAPI"),
|
||||
std::make_pair(APISchemas::APIName::ListAPI,
|
||||
"ListAPI"),
|
||||
std::make_pair(APISchemas::APIName::MotionAPI,
|
||||
"MotionAPI"),
|
||||
std::make_pair(APISchemas::APIName::PrimvarsAPI,
|
||||
"PrimvarsAPI"),
|
||||
std::make_pair(APISchemas::APIName::GeomModelAPI,
|
||||
"GeomModelAPI"),
|
||||
std::make_pair(APISchemas::APIName::VisibilityAPI,
|
||||
"VisibilityAPI"),
|
||||
std::make_pair(APISchemas::APIName::XformCommonAPI,
|
||||
"XformCommonAPI"),
|
||||
std::make_pair(APISchemas::APIName::NodeDefAPI,
|
||||
"NodeDefAPI"),
|
||||
std::make_pair(APISchemas::APIName::CoordSysAPI,
|
||||
"CoordSysAPI"),
|
||||
std::make_pair(APISchemas::APIName::ConnectableAPI,
|
||||
"ConnectableAPI")
|
||||
};
|
||||
return EnumHandler<APISchemas::APIName>("apiSchemas", tok, enums);
|
||||
};
|
||||
|
||||
@@ -582,8 +582,42 @@ nonstd::expected<APISchemas, std::string> USDCReader::Impl::ToAPISchemas(
|
||||
[](const value::token &tok) -> nonstd::optional<APISchemas::APIName> {
|
||||
if (tok.str() == "MaterialBindingAPI") {
|
||||
return APISchemas::APIName::MaterialBindingAPI;
|
||||
} else if (tok.str() == "NodeDefAPI") {
|
||||
return APISchemas::APIName::NodeDefAPI;
|
||||
} else if (tok.str() == "CoordSysAPI") {
|
||||
return APISchemas::APIName::CoordSysAPI;
|
||||
} else if (tok.str() == "ConnectableAPI") {
|
||||
return APISchemas::APIName::ConnectableAPI;
|
||||
} else if (tok.str() == "CollectionAPI") {
|
||||
return APISchemas::APIName::CollectionAPI;
|
||||
} else if (tok.str() == "SkelBindingAPI") {
|
||||
return APISchemas::APIName::SkelBindingAPI;
|
||||
} else if (tok.str() == "VisibilityAPI") {
|
||||
return APISchemas::APIName::VisibilityAPI;
|
||||
} else if (tok.str() == "GeomModelAPI") {
|
||||
return APISchemas::APIName::GeomModelAPI;
|
||||
} else if (tok.str() == "MotionAPI") {
|
||||
return APISchemas::APIName::MotionAPI;
|
||||
} else if (tok.str() == "PrimvarsAPI") {
|
||||
return APISchemas::APIName::PrimvarsAPI;
|
||||
} else if (tok.str() == "XformCommonAPI") {
|
||||
return APISchemas::APIName::XformCommonAPI;
|
||||
} else if (tok.str() == "ListAPI") {
|
||||
return APISchemas::APIName::ListAPI;
|
||||
} else if (tok.str() == "LightListAPI") {
|
||||
return APISchemas::APIName::LightListAPI;
|
||||
} else if (tok.str() == "LightAPI") {
|
||||
return APISchemas::APIName::LightAPI;
|
||||
} else if (tok.str() == "MeshLightAPI") {
|
||||
return APISchemas::APIName::MeshLightAPI;
|
||||
} else if (tok.str() == "VolumeLightAPI") {
|
||||
return APISchemas::APIName::VolumeLightAPI;
|
||||
} else if (tok.str() == "ConnectableAPI") {
|
||||
return APISchemas::APIName::ConnectableAPI;
|
||||
} else if (tok.str() == "ShadowAPI") {
|
||||
return APISchemas::APIName::ShadowAPI;
|
||||
} else if (tok.str() == "ShapingAPI") {
|
||||
return APISchemas::APIName::ShapingAPI;
|
||||
} else if (tok.str() == "Preliminary_AnchoringAPI") {
|
||||
return APISchemas::APIName::Preliminary_AnchoringAPI;
|
||||
} else if (tok.str() == "Preliminary_PhysicsColliderAPI") {
|
||||
|
||||
15
tests/usda/apishcema-001.usda
Normal file
15
tests/usda/apishcema-001.usda
Normal file
@@ -0,0 +1,15 @@
|
||||
#usda 1.0
|
||||
(
|
||||
metersPerUnit = 1
|
||||
upAxis = "Y"
|
||||
defaultPrim = "hello"
|
||||
)
|
||||
|
||||
def Cone "hello"
|
||||
(
|
||||
prepend apiSchemas = ["GeomModelAPI", "MotionAPI", "ListAPI", "LightListAPI"]
|
||||
)
|
||||
{
|
||||
uniform token axis = "X"
|
||||
double height = 1.2
|
||||
}
|
||||
BIN
tests/usdc/apischema-001.usdc
Normal file
BIN
tests/usdc/apischema-001.usdc
Normal file
Binary file not shown.
Reference in New Issue
Block a user