Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ serde = ["dep:serde", "half/serde"]

[dependencies]
anyhow = "1.0.79"
bitflags = "2.11.1"
bytemuck = { version = "1.14.0", features = ["derive"] }
strum = { version = "0.28.0", features = ["derive"] }
thiserror = "2"
Expand Down
4 changes: 2 additions & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ Legend: :white_check_mark: Supported | :construction: Planned | :thinking: Consi
| Ordered property children | `11.3.2` | :white_check_mark: | `0.2.0` | Merged `propertyChildren` |
| Ordered property children (`propertyOrder` reordering) | `11.3.2` | :white_check_mark: | `main` | Strongest opinion applied via `sdf::apply_ordering` |
| [Scene graph instancing](https://openusd.org/release/glossary.html#usdglossary-instancing) | `11.3.3` | :construction: | | `instanceable` readable; shared representation not implemented |
| Model hierarchy (kind) | `11.4` | :construction: | | `kind` readable; hierarchy validation not implemented |
| [Stage queries](https://openusd.org/release/api/prim_flags_8h.html) (Active, Loaded, Defined, Abstract, Instance) | `11.5` | :construction: | | Predicate flags for traversal filtering |
| Model hierarchy (kind) | `11.4` | :white_check_mark: | `main` | `Stage::is_model`/`is_group`/`is_component`/`is_subcomponent` validate the contiguous kind hierarchy |
| [Stage queries](https://openusd.org/release/api/prim_flags_8h.html) (Active, Loaded, Defined, Abstract, Instance) | `11.5` | :white_check_mark: | `main` | `Stage::is_active`/`is_loaded`/`is_defined`/`is_abstract`/`is_instance` and `prim_status`; load rules pending |
| [Session layer](https://openusd.org/release/glossary.html#usdglossary-sessionlayer) | `11.2` | :white_check_mark: | `0.3.0` | `StageBuilder::session_layer` |

## Value Resolution (Spec 12)
Expand Down
91 changes: 91 additions & 0 deletions fixtures/stage_queries.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#usda 1.0
(
defaultPrim = "World"
)

def Scope "World" (
kind = "assembly"
)
{
def Scope "ActiveParent"
{
def Scope "Child"
{
}
}

def Scope "InactiveParent" (
active = false
)
{
def Scope "Child" (
active = true
)
{
}
}

over "OverOnly"
{
}

over "OverParent"
{
def Scope "Child"
{
}
}

class "ClassParent"
{
def Scope "Child"
{
}
}

def Scope "Group" (
kind = "group"
)
{
def Scope "Component" (
kind = "component"
)
{
}

def Scope "Subcomponent" (
kind = "subcomponent"
)
{
}
}

def Scope "InvalidComponentParent"
{
def Scope "Component" (
kind = "component"
)
{
}
}

def Scope "Instance" (
instanceable = true
references = </World/Prototype>
)
{
}

def Scope "InstanceableNoArc" (
instanceable = true
)
{
}

def Scope "Prototype"
{
def Scope "ReferencedChild"
{
}
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub mod usdz;

pub use half::f16;
pub use layer::{DependencyKind, LayerFormat};
pub use stage::{Stage, StageBuilder};
pub use stage::{PrimStatus, Stage, StageBuilder};

/// A recoverable error encountered during stage composition.
///
Expand Down
6 changes: 6 additions & 0 deletions src/pcp/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ impl Cache {
Ok(None)
}

/// Returns `true` if the composed prim index contains any non-local arc.
pub(crate) fn has_composition_arc(&mut self, path: &Path) -> Result<bool> {
self.ensure_index(path)?;
Ok(self.indices.get(path).is_some_and(|index| index.has_composition_arc()))
}

/// Resolves a field value from the strongest opinion across all composition nodes.
pub fn resolve_field(&mut self, path: &Path, field: &str) -> Result<Option<Value>> {
if path.is_property_path() {
Expand Down
5 changes: 5 additions & 0 deletions src/pcp/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ impl PrimIndex {
self.graph.is_empty()
}

/// Returns `true` if any node was introduced by a composition arc.
pub(crate) fn has_composition_arc(&self) -> bool {
self.nodes().iter().any(|node| node.arc != ArcType::Root)
}

/// Returns the nodes in strength order (index 0 = strongest).
pub fn nodes(&self) -> &[Node] {
&self.graph
Expand Down
1 change: 1 addition & 0 deletions src/sdf/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ impl_try_from_value!(i64, try_as_int_64, "Int64");
impl_try_from_value!(u64, try_as_uint_64, "Uint64");
impl_try_from_value!(f32, try_as_float, "Float");
impl_try_from_value!(f64, try_as_double, "Double");
impl_try_from_value!(Specifier, try_as_specifier, "Specifier");
impl_try_from_value!(ReferenceListOp, try_as_reference_list_op, "ReferenceListOp");
impl_try_from_value!(PayloadListOp, try_as_payload_list_op, "PayloadListOp");
impl_try_from_value!(PathListOp, try_as_path_list_op, "PathListOp");
Expand Down
Loading
Loading