mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
Rename NodeKind to NodeCategory across codebase
- Rename enum NodeKind -> NodeCategory - Rename Node::kind -> Node::category - Update to_string(NodeKind) -> to_string(NodeCategory) - Update GetNodeKindFromType -> GetNodeCategoryFromType - Update dump output from "kind" to "category" - Update web binding to use nodeCategory - Update JavaScript dump-usdlux-cli.js to use nodeCategory 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -100,14 +100,14 @@ std::string to_string(ColorSpace cty) {
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string to_string(NodeKind kind) {
|
||||
switch (kind) {
|
||||
case NodeKind::Group: return "group";
|
||||
case NodeKind::Geom: return "geom";
|
||||
case NodeKind::Light: return "light";
|
||||
case NodeKind::Camera: return "camera";
|
||||
case NodeKind::Material: return "material";
|
||||
case NodeKind::Skeleton: return "skeleton";
|
||||
std::string to_string(NodeCategory category) {
|
||||
switch (category) {
|
||||
case NodeCategory::Group: return "group";
|
||||
case NodeCategory::Geom: return "geom";
|
||||
case NodeCategory::Light: return "light";
|
||||
case NodeCategory::Camera: return "camera";
|
||||
case NodeCategory::Material: return "material";
|
||||
case NodeCategory::Skeleton: return "skeleton";
|
||||
}
|
||||
return "???";
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace tinyusdz {
|
||||
namespace tydra {
|
||||
|
||||
// forward decl.
|
||||
enum class NodeKind;
|
||||
enum class NodeCategory;
|
||||
enum class NodeType;
|
||||
enum class ComponentType;
|
||||
enum class VertexAttributeFormat;
|
||||
@@ -21,7 +21,7 @@ struct UVTexture;
|
||||
|
||||
// to_string functions for various enum types
|
||||
std::string to_string(VertexVariability variability);
|
||||
std::string to_string(NodeKind kind);
|
||||
std::string to_string(NodeCategory category);
|
||||
std::string to_string(NodeType ntype);
|
||||
std::string to_string(ComponentType ty);
|
||||
std::string to_string(VertexAttributeFormat f);
|
||||
|
||||
@@ -8623,17 +8623,17 @@ bool RenderSceneConverter::ExtractXformOpAnimation(
|
||||
return !anim_out->channels.empty();
|
||||
}
|
||||
|
||||
// Helper to get NodeKind from NodeType
|
||||
static NodeKind GetNodeKindFromType(NodeType nodeType) {
|
||||
// Helper to get NodeCategory from NodeType
|
||||
static NodeCategory GetNodeCategoryFromType(NodeType nodeType) {
|
||||
switch (nodeType) {
|
||||
case NodeType::Xform:
|
||||
return NodeKind::Group;
|
||||
return NodeCategory::Group;
|
||||
case NodeType::Mesh:
|
||||
return NodeKind::Geom;
|
||||
return NodeCategory::Geom;
|
||||
case NodeType::Camera:
|
||||
return NodeKind::Camera;
|
||||
return NodeCategory::Camera;
|
||||
case NodeType::Skeleton:
|
||||
return NodeKind::Skeleton;
|
||||
return NodeCategory::Skeleton;
|
||||
case NodeType::PointLight:
|
||||
case NodeType::DirectionalLight:
|
||||
case NodeType::EnvmapLight:
|
||||
@@ -8641,9 +8641,9 @@ static NodeKind GetNodeKindFromType(NodeType nodeType) {
|
||||
case NodeType::DiskLight:
|
||||
case NodeType::CylinderLight:
|
||||
case NodeType::GeometryLight:
|
||||
return NodeKind::Light;
|
||||
return NodeCategory::Light;
|
||||
}
|
||||
return NodeKind::Group; // Default
|
||||
return NodeCategory::Group; // Default
|
||||
}
|
||||
|
||||
bool RenderSceneConverter::BuildNodeHierarchyImpl(
|
||||
@@ -8808,8 +8808,8 @@ bool RenderSceneConverter::BuildNodeHierarchyImpl(
|
||||
rnode.nodeType = NodeType::Xform;
|
||||
}
|
||||
|
||||
// Set kind based on nodeType
|
||||
rnode.kind = GetNodeKindFromType(rnode.nodeType);
|
||||
// Set category based on nodeType
|
||||
rnode.category = GetNodeCategoryFromType(rnode.nodeType);
|
||||
}
|
||||
|
||||
for (const auto &child : node.children) {
|
||||
@@ -9944,7 +9944,7 @@ std::string DumpNode(const Node &node, uint32_t indent) {
|
||||
|
||||
ss << pprint::Indent(indent) << "node {\n";
|
||||
|
||||
ss << pprint::Indent(indent + 1) << "kind " << quote(to_string(node.kind))
|
||||
ss << pprint::Indent(indent + 1) << "category " << quote(to_string(node.category))
|
||||
<< "\n";
|
||||
ss << pprint::Indent(indent + 1) << "type " << quote(to_string(node.nodeType))
|
||||
<< "\n";
|
||||
|
||||
@@ -227,7 +227,7 @@ enum class NodeType {
|
||||
};
|
||||
|
||||
// High-level categorization of USD Prim types
|
||||
enum class NodeKind {
|
||||
enum class NodeCategory {
|
||||
Group, // Organizational: Xform, Scope, Model
|
||||
Geom, // Geometry: Mesh, Points, Curves, etc.
|
||||
Light, // Lights: RectLight, DomeLight, SphereLight, etc.
|
||||
@@ -959,7 +959,7 @@ struct Node {
|
||||
std::string abs_path; // Absolute prim path
|
||||
std::string display_name; // `displayName` prim meta
|
||||
|
||||
NodeKind kind{NodeKind::Group}; // High-level category (Group, Geom, Light, Camera, etc.)
|
||||
NodeCategory category{NodeCategory::Group}; // High-level category (Group, Geom, Light, Camera, etc.)
|
||||
NodeType nodeType{NodeType::Xform}; // Specific type within the category
|
||||
|
||||
int32_t id{-1}; // Index to node content(e.g. meshes[id] when nodeTypes ==
|
||||
|
||||
@@ -154,7 +154,7 @@ std::string DumpNode(const Node &node, uint32_t indent) {
|
||||
|
||||
ss << pprint::Indent(indent) << "node {\n";
|
||||
|
||||
ss << pprint::Indent(indent + 1) << "kind " << quote(to_string(node.kind))
|
||||
ss << pprint::Indent(indent + 1) << "category " << quote(to_string(node.category))
|
||||
<< "\n";
|
||||
ss << pprint::Indent(indent + 1) << "type " << quote(to_string(node.nodeType))
|
||||
<< "\n";
|
||||
|
||||
@@ -3251,8 +3251,8 @@ class TinyUSDZLoaderNative {
|
||||
node.set("displayName", rnode.display_name);
|
||||
node.set("absPath", rnode.abs_path);
|
||||
|
||||
std::string nodeKindStr = to_string(rnode.kind);
|
||||
node.set("nodeKind", nodeKindStr);
|
||||
std::string nodeCategoryStr = to_string(rnode.category);
|
||||
node.set("nodeCategory", nodeCategoryStr);
|
||||
|
||||
std::string nodeTypeStr = to_string(rnode.nodeType);
|
||||
node.set("nodeType", nodeTypeStr);
|
||||
|
||||
@@ -109,7 +109,7 @@ Options:
|
||||
-a, --all Show all optional data (meshes, materials, transform, spectral, nodes)
|
||||
-t, --show-transform Include transform matrices in output
|
||||
-s, --show-spectral Include spectral emission data (LTE SpectralAPI)
|
||||
-n, --show-nodes Show node hierarchy with kind/type info
|
||||
-n, --show-nodes Show node hierarchy with category/type info
|
||||
--show-meshes Include mesh geometry data for mesh lights
|
||||
--show-materials Include material data for mesh lights
|
||||
--serialized Use serialized format from WASM (required for XML)
|
||||
@@ -149,10 +149,10 @@ Examples:
|
||||
# Dump mesh lights with geometry and material info
|
||||
node dump-usdlux-cli.js tests/feat/lux/06_mesh_lights.usda --show-meshes --show-materials
|
||||
|
||||
# Dump with node hierarchy (shows nodeKind for each node)
|
||||
# Dump with node hierarchy (shows nodeCategory for each node)
|
||||
node dump-usdlux-cli.js tests/feat/lux/04_complete_scene.usda -f summary --show-nodes
|
||||
|
||||
# Dump JSON with node hierarchy including nodeKind
|
||||
# Dump JSON with node hierarchy including nodeCategory
|
||||
node dump-usdlux-cli.js tests/feat/lux/04_complete_scene.usda -f json --show-nodes
|
||||
`);
|
||||
}
|
||||
@@ -252,11 +252,11 @@ function formatSpectralEmission(spectral, indent = '│ ') {
|
||||
function formatNodeRec(node, indent = ' ', depth = 0) {
|
||||
let output = '';
|
||||
const prefix = indent.repeat(depth);
|
||||
const kindStr = node.nodeKind ? `[${node.nodeKind}]` : '';
|
||||
const categoryStr = node.nodeCategory ? `[${node.nodeCategory}]` : '';
|
||||
const typeStr = node.nodeType || 'unknown';
|
||||
const idStr = node.contentId >= 0 ? `#${node.contentId}` : '';
|
||||
|
||||
output += `${prefix}├── ${node.primName} ${kindStr} (${typeStr}) ${idStr}\n`;
|
||||
output += `${prefix}├── ${node.primName} ${categoryStr} (${typeStr}) ${idStr}\n`;
|
||||
output += `${prefix}│ Path: ${node.absPath}\n`;
|
||||
|
||||
if (node.displayName) {
|
||||
@@ -276,7 +276,7 @@ function formatNodeRec(node, indent = ' ', depth = 0) {
|
||||
function formatNodeHierarchy(usd) {
|
||||
let output = '';
|
||||
output += `\n ╔════════════════════════════════════════════════════════════════╗\n`;
|
||||
output += ` ║ Node Hierarchy (with Kind) ║\n`;
|
||||
output += ` ║ Node Hierarchy (with Category) ║\n`;
|
||||
output += ` ╚════════════════════════════════════════════════════════════════╝\n\n`;
|
||||
|
||||
const numRootNodes = usd.numRootNodes();
|
||||
|
||||
Reference in New Issue
Block a user