diff --git a/bevy_gltf_kun/src/extensions/omi_physics/export.rs b/bevy_gltf_kun/src/extensions/omi_physics/export.rs index 60fe25a..b3e5180 100644 --- a/bevy_gltf_kun/src/extensions/omi_physics/export.rs +++ b/bevy_gltf_kun/src/extensions/omi_physics/export.rs @@ -13,7 +13,7 @@ use gltf_kun::{ OmiPhysicsShape, }, }, - graph::{ByteNode, Property}, + graph::{ByteNode, Extensions}, }; use crate::export::{extensions::BevyExtensionExport, gltf::ExportContext}; diff --git a/bevy_gltf_kun/src/extensions/omi_physics/import.rs b/bevy_gltf_kun/src/extensions/omi_physics/import.rs index 302f8a8..143663e 100644 --- a/bevy_gltf_kun/src/extensions/omi_physics/import.rs +++ b/bevy_gltf_kun/src/extensions/omi_physics/import.rs @@ -12,8 +12,6 @@ use gltf_kun::{ use crate::import::{extensions::NodeExtensionImport, gltf::document::ImportContext}; -/// Mark a collider to be added to the entity after asset loading. -/// This is needed because `Collider` doesn't implement `Reflect`. #[derive(Component, Reflect)] #[reflect(Component)] pub enum ColliderMarker { @@ -68,8 +66,6 @@ pub fn insert_rigid_bodies(mut commands: Commands, mut query: Query<(Entity, &Ri } } -/// Mark a rigid body to be added to the entity after asset loading. -/// While not necessary on its own, we want to spawn in the rigid body and collider at the same time. #[derive(Component, Reflect)] #[reflect(Component)] pub struct RigidBodyMarker { diff --git a/bevy_gltf_kun/src/import/extensions.rs b/bevy_gltf_kun/src/import/extensions.rs index e8ae278..7bcd27c 100644 --- a/bevy_gltf_kun/src/import/extensions.rs +++ b/bevy_gltf_kun/src/import/extensions.rs @@ -3,12 +3,22 @@ use gltf_kun::{ extensions::{DefaultExtensions, Extension}, graph::{ gltf::{document::GltfDocument, node::Node}, - Property, + Extensions, }, }; use crate::import::gltf::document::ImportContext; +pub trait RootExtensionImport: Extension { + fn maybe_import_root(context: &mut ImportContext) { + if let Some(ext) = context.doc.get_extension::(context.graph) { + Self::import_root(context, ext); + } + } + + fn import_root(context: &mut ImportContext, ext: Self); +} + pub trait NodeExtensionImport: Extension { fn maybe_import_node(context: &mut ImportContext, entity: &mut EntityWorldMut, node: Node) { if let Some(ext) = node.get_extension::(context.graph) { @@ -16,14 +26,19 @@ pub trait NodeExtensionImport: Extension { } } + /// Called when a node with this extension is imported. + /// This is called while the tree is being traversed, so the node's children may not have been imported yet. fn import_node(context: &mut ImportContext, entity: &mut EntityWorldMut, ext: Self); } pub trait BevyImportExtensions { + fn import_root(context: &mut ImportContext); fn import_node(context: &mut ImportContext, entity: &mut EntityWorldMut, node: Node); } impl BevyImportExtensions for DefaultExtensions { + fn import_root(_context: &mut ImportContext) {} + fn import_node(context: &mut ImportContext, entity: &mut EntityWorldMut, node: Node) { #[cfg(feature = "omi_physics")] { diff --git a/bevy_gltf_kun/src/import/gltf/document.rs b/bevy_gltf_kun/src/import/gltf/document.rs index 9f20686..bbae4d2 100644 --- a/bevy_gltf_kun/src/import/gltf/document.rs +++ b/bevy_gltf_kun/src/import/gltf/document.rs @@ -94,5 +94,8 @@ pub fn import_gltf_document>( context.gltf.scenes.insert(i, handle); } + // Load extensions. + E::import_root(context); + Ok(()) } diff --git a/bevy_gltf_kun/src/import/gltf/material.rs b/bevy_gltf_kun/src/import/gltf/material.rs index 5c351b7..b644384 100644 --- a/bevy_gltf_kun/src/import/gltf/material.rs +++ b/bevy_gltf_kun/src/import/gltf/material.rs @@ -5,14 +5,14 @@ use gltf_kun::graph::{ }; use thiserror::Error; -use crate::import::extensions::BevyImportExtensions; + use super::document::ImportContext; #[derive(Debug, Error)] pub enum MaterialImportError {} -pub fn import_material>( +pub fn import_material( context: &mut ImportContext, m: Material, is_scale_inverted: bool, diff --git a/bevy_gltf_kun/src/import/gltf/mesh.rs b/bevy_gltf_kun/src/import/gltf/mesh.rs index 2f69f1e..6c1888b 100644 --- a/bevy_gltf_kun/src/import/gltf/mesh.rs +++ b/bevy_gltf_kun/src/import/gltf/mesh.rs @@ -1,10 +1,10 @@ use bevy::prelude::*; use gltf_kun::graph::{ - gltf::{self, GltfDocument}, + gltf::{self}, GraphNodeWeight, }; -use crate::import::extensions::BevyImportExtensions; + use super::{ document::ImportContext, @@ -17,7 +17,7 @@ pub struct GltfMesh { pub extras: Option>, } -pub fn import_mesh>( +pub fn import_mesh( context: &mut ImportContext, entity: &mut EntityWorldMut, mut m: gltf::mesh::Mesh, @@ -33,7 +33,7 @@ pub fn import_mesh>( entity.with_children(|parent| { for (i, p) in m.primitives(context.graph).iter_mut().enumerate() { - match import_primitive::(context, parent, is_scale_inverted, m, &mesh_label, i, p) { + match import_primitive(context, parent, is_scale_inverted, m, &mesh_label, i, p) { Ok((ent, handle, weights)) => { morph_weights = weights; primitive_entities.push(ent); diff --git a/bevy_gltf_kun/src/import/gltf/node.rs b/bevy_gltf_kun/src/import/gltf/node.rs index 4b02072..c010d28 100644 --- a/bevy_gltf_kun/src/import/gltf/node.rs +++ b/bevy_gltf_kun/src/import/gltf/node.rs @@ -55,8 +55,7 @@ pub fn import_node>( let mesh = match n.mesh(context.graph) { Some(m) => { - let (ents, mesh, morph_weights) = - import_mesh::(context, &mut ent, m, is_scale_inverted); + let (ents, mesh, morph_weights) = import_mesh(context, &mut ent, m, is_scale_inverted); primitive_entities.extend(ents); @@ -109,6 +108,7 @@ pub fn import_node>( .node_primitive_entities .insert(handle.clone(), primitive_entities); + // Load extensions. E::import_node(context, &mut ent, *n); Ok(handle) diff --git a/bevy_gltf_kun/src/import/gltf/primitive.rs b/bevy_gltf_kun/src/import/gltf/primitive.rs index 81266f5..c1f2b03 100644 --- a/bevy_gltf_kun/src/import/gltf/primitive.rs +++ b/bevy_gltf_kun/src/import/gltf/primitive.rs @@ -22,13 +22,12 @@ use gltf_kun::graph::{ Accessor, ComponentType, GetAccessorSliceError, Type, }, primitive::{Mode, MorphTarget, Primitive, Semantic}, - GltfDocument, }, Graph, GraphNodeWeight, }; use thiserror::Error; -use crate::import::extensions::BevyImportExtensions; + use super::{ document::ImportContext, @@ -64,7 +63,7 @@ pub enum ImportPrimitiveError { MorphBuildError(#[from] MorphBuildError), } -pub fn import_primitive>( +pub fn import_primitive( context: &mut ImportContext, parent: &mut WorldChildBuilder, is_scale_inverted: bool, @@ -109,7 +108,7 @@ pub fn import_primitive>( if let Some(material) = context.materials.get(&(m, is_scale_inverted)) { material.clone() } else { - let material = import_material::(context, m, is_scale_inverted); + let material = import_material(context, m, is_scale_inverted); context .materials diff --git a/gltf_kun/src/extensions/omi_physics_body/export.rs b/gltf_kun/src/extensions/omi_physics_body/export.rs index 04c45d8..7c6c2b2 100644 --- a/gltf_kun/src/extensions/omi_physics_body/export.rs +++ b/gltf_kun/src/extensions/omi_physics_body/export.rs @@ -2,7 +2,7 @@ use std::error::Error; use crate::{ extensions::{omi_physics_shape::OmiPhysicsShape, ExtensionExport}, - graph::{gltf::document::GltfDocument, ByteNode, Property}, + graph::{gltf::document::GltfDocument, ByteNode, Extensions}, io::format::gltf::GltfFormat, }; diff --git a/gltf_kun/src/extensions/omi_physics_body/import.rs b/gltf_kun/src/extensions/omi_physics_body/import.rs index ef13fe1..a441334 100644 --- a/gltf_kun/src/extensions/omi_physics_body/import.rs +++ b/gltf_kun/src/extensions/omi_physics_body/import.rs @@ -4,7 +4,7 @@ use tracing::warn; use crate::{ extensions::{omi_physics_shape::OmiPhysicsShape, ExtensionImport}, - graph::{gltf::document::GltfDocument, ByteNode, Property}, + graph::{gltf::document::GltfDocument, ByteNode, Extensions}, io::format::gltf::GltfFormat, }; diff --git a/gltf_kun/src/extensions/omi_physics_shape/export.rs b/gltf_kun/src/extensions/omi_physics_shape/export.rs index 234c4df..6b350e8 100644 --- a/gltf_kun/src/extensions/omi_physics_shape/export.rs +++ b/gltf_kun/src/extensions/omi_physics_shape/export.rs @@ -1,6 +1,6 @@ use crate::{ extensions::ExtensionExport, - graph::{gltf::document::GltfDocument, ByteNode, Graph, Property}, + graph::{gltf::document::GltfDocument, ByteNode, Extensions, Graph}, io::format::gltf::GltfFormat, }; diff --git a/gltf_kun/src/extensions/omi_physics_shape/import.rs b/gltf_kun/src/extensions/omi_physics_shape/import.rs index f52f250..55134b8 100644 --- a/gltf_kun/src/extensions/omi_physics_shape/import.rs +++ b/gltf_kun/src/extensions/omi_physics_shape/import.rs @@ -1,6 +1,6 @@ use crate::{ extensions::ExtensionImport, - graph::{gltf::document::GltfDocument, Graph, Property}, + graph::{gltf::document::GltfDocument, Extensions, Graph}, io::format::gltf::GltfFormat, }; diff --git a/gltf_kun/src/graph/gltf/accessor/mod.rs b/gltf_kun/src/graph/gltf/accessor/mod.rs index f159338..b69a466 100644 --- a/gltf_kun/src/graph/gltf/accessor/mod.rs +++ b/gltf_kun/src/graph/gltf/accessor/mod.rs @@ -1,7 +1,7 @@ use petgraph::graph::NodeIndex; use thiserror::Error; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use self::iter::{AccessorElement, AccessorIter, AccessorIterCreateError}; @@ -114,7 +114,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Accessor {} impl GraphNodeEdges for Accessor {} -impl Property for Accessor {} +impl Extensions for Accessor {} impl Accessor { pub fn buffer(&self, graph: &Graph) -> Option { diff --git a/gltf_kun/src/graph/gltf/animation/channel.rs b/gltf_kun/src/graph/gltf/animation/channel.rs index 2947cdb..7b42011 100644 --- a/gltf_kun/src/graph/gltf/animation/channel.rs +++ b/gltf_kun/src/graph/gltf/animation/channel.rs @@ -2,7 +2,7 @@ use petgraph::graph::NodeIndex; use crate::graph::{ gltf::{GltfEdge, Node}, - Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight, + Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight, }; use super::{AnimationSampler, GltfWeight}; @@ -89,7 +89,7 @@ impl From for NodeIndex { impl GraphNodeWeight for AnimationChannel {} impl GraphNodeEdges for AnimationChannel {} -impl Property for AnimationChannel {} +impl Extensions for AnimationChannel {} impl AnimationChannel { pub fn sampler(&self, graph: &Graph) -> Option { diff --git a/gltf_kun/src/graph/gltf/animation/mod.rs b/gltf_kun/src/graph/gltf/animation/mod.rs index 446a5ca..01a75c2 100644 --- a/gltf_kun/src/graph/gltf/animation/mod.rs +++ b/gltf_kun/src/graph/gltf/animation/mod.rs @@ -1,7 +1,7 @@ use petgraph::graph::NodeIndex; use crate::graph::{ - gltf::GltfEdge, Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight, + gltf::GltfEdge, Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight, }; use super::GltfWeight; @@ -82,7 +82,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Animation {} impl GraphNodeEdges for Animation {} -impl Property for Animation {} +impl Extensions for Animation {} impl Animation { pub fn channels(&self, graph: &Graph) -> Vec { diff --git a/gltf_kun/src/graph/gltf/animation/sampler.rs b/gltf_kun/src/graph/gltf/animation/sampler.rs index 57a3dd1..5967d96 100644 --- a/gltf_kun/src/graph/gltf/animation/sampler.rs +++ b/gltf_kun/src/graph/gltf/animation/sampler.rs @@ -2,7 +2,7 @@ use petgraph::graph::NodeIndex; use crate::graph::{ gltf::{Accessor, GltfEdge, GltfWeight}, - Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight, + Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight, }; pub use gltf::animation::Interpolation; @@ -78,7 +78,7 @@ impl From for NodeIndex { impl GraphNodeWeight for AnimationSampler {} impl GraphNodeEdges for AnimationSampler {} -impl Property for AnimationSampler {} +impl Extensions for AnimationSampler {} impl AnimationSampler { pub fn input(&self, graph: &Graph) -> Option { diff --git a/gltf_kun/src/graph/gltf/buffer.rs b/gltf_kun/src/graph/gltf/buffer.rs index 68b9cf2..1630a2f 100644 --- a/gltf_kun/src/graph/gltf/buffer.rs +++ b/gltf_kun/src/graph/gltf/buffer.rs @@ -1,6 +1,6 @@ use petgraph::graph::NodeIndex; -use crate::graph::{GraphNodeWeight, Property, Weight}; +use crate::graph::{Extensions, GraphNodeWeight, Weight}; use super::GltfWeight; @@ -54,4 +54,4 @@ impl From for NodeIndex { } impl GraphNodeWeight for Buffer {} -impl Property for Buffer {} +impl Extensions for Buffer {} diff --git a/gltf_kun/src/graph/gltf/document.rs b/gltf_kun/src/graph/gltf/document.rs index 4714173..6329049 100644 --- a/gltf_kun/src/graph/gltf/document.rs +++ b/gltf_kun/src/graph/gltf/document.rs @@ -1,6 +1,6 @@ use petgraph::graph::NodeIndex; -use crate::graph::{gltf::GltfEdge, Edge, Graph, GraphNodeEdges, Property, Weight}; +use crate::graph::{gltf::GltfEdge, Edge, Extensions, Graph, GraphNodeEdges, Weight}; use super::{ Accessor, Animation, Buffer, GltfWeight, Image, Material, Mesh, Node, Scene, Skin, TextureInfo, @@ -52,7 +52,7 @@ impl From for NodeIndex { } impl GraphNodeEdges for GltfDocument {} -impl Property for GltfDocument {} +impl Extensions for GltfDocument {} impl GltfDocument { pub fn new(graph: &mut Graph) -> Self { diff --git a/gltf_kun/src/graph/gltf/image.rs b/gltf_kun/src/graph/gltf/image.rs index 332fc4b..63dbcb0 100644 --- a/gltf_kun/src/graph/gltf/image.rs +++ b/gltf_kun/src/graph/gltf/image.rs @@ -1,7 +1,7 @@ use petgraph::graph::NodeIndex; use crate::graph::{ - gltf::GltfEdge, Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight, + gltf::GltfEdge, Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight, }; use super::{buffer::Buffer, GltfWeight}; @@ -81,7 +81,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Image {} impl GraphNodeEdges for Image {} -impl Property for Image {} +impl Extensions for Image {} impl Image { pub fn buffer(&self, graph: &Graph) -> Option { diff --git a/gltf_kun/src/graph/gltf/material.rs b/gltf_kun/src/graph/gltf/material.rs index 15737e6..afe83bf 100644 --- a/gltf_kun/src/graph/gltf/material.rs +++ b/gltf_kun/src/graph/gltf/material.rs @@ -1,6 +1,6 @@ use petgraph::graph::NodeIndex; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use super::{texture_info::TextureInfo, GltfEdge, GltfWeight}; @@ -109,7 +109,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Material {} impl GraphNodeEdges for Material {} -impl Property for Material {} +impl Extensions for Material {} impl Material { pub fn base_color_texture_info(&self, graph: &Graph) -> Option { diff --git a/gltf_kun/src/graph/gltf/mesh.rs b/gltf_kun/src/graph/gltf/mesh.rs index b74d315..52dee20 100644 --- a/gltf_kun/src/graph/gltf/mesh.rs +++ b/gltf_kun/src/graph/gltf/mesh.rs @@ -1,6 +1,6 @@ use petgraph::graph::NodeIndex; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use super::{primitive::Primitive, GltfEdge, GltfWeight}; @@ -77,7 +77,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Mesh {} impl GraphNodeEdges for Mesh {} -impl Property for Mesh {} +impl Extensions for Mesh {} impl Mesh { pub fn primitives(&self, graph: &Graph) -> Vec { diff --git a/gltf_kun/src/graph/gltf/node.rs b/gltf_kun/src/graph/gltf/node.rs index 9f9eb7e..4153169 100644 --- a/gltf_kun/src/graph/gltf/node.rs +++ b/gltf_kun/src/graph/gltf/node.rs @@ -1,7 +1,7 @@ use glam::{Quat, Vec3}; use petgraph::{graph::NodeIndex, visit::EdgeRef}; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use super::{mesh::Mesh, GltfEdge, GltfWeight, Skin}; @@ -96,7 +96,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Node {} impl GraphNodeEdges for Node {} -impl Property for Node {} +impl Extensions for Node {} impl Node { pub fn children(&self, graph: &Graph) -> Vec { diff --git a/gltf_kun/src/graph/gltf/primitive/mod.rs b/gltf_kun/src/graph/gltf/primitive/mod.rs index 253b517..9c1c1a0 100644 --- a/gltf_kun/src/graph/gltf/primitive/mod.rs +++ b/gltf_kun/src/graph/gltf/primitive/mod.rs @@ -1,6 +1,6 @@ use petgraph::{graph::NodeIndex, visit::EdgeRef, Direction}; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use super::{accessor::Accessor, material::Material, GltfEdge, GltfWeight}; @@ -92,7 +92,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Primitive {} impl GraphNodeEdges for Primitive {} -impl Property for Primitive {} +impl Extensions for Primitive {} impl Primitive { pub fn attributes(&self, graph: &Graph) -> Vec<(Semantic, Accessor)> { diff --git a/gltf_kun/src/graph/gltf/primitive/morph_target.rs b/gltf_kun/src/graph/gltf/primitive/morph_target.rs index 482e053..e885a33 100644 --- a/gltf_kun/src/graph/gltf/primitive/morph_target.rs +++ b/gltf_kun/src/graph/gltf/primitive/morph_target.rs @@ -4,7 +4,7 @@ use thiserror::Error; use crate::graph::{ gltf::{accessor::iter::AccessorIterCreateError, Accessor, GltfEdge}, - Edge, Graph, GraphNodeEdges, Property, + Edge, Extensions, Graph, GraphNodeEdges, }; #[derive(Clone, Debug, PartialEq, Eq)] @@ -44,7 +44,7 @@ impl From for NodeIndex { } impl GraphNodeEdges for MorphTarget {} -impl Property for MorphTarget {} +impl Extensions for MorphTarget {} impl MorphTarget { pub fn attributes(&self, graph: &Graph) -> Vec<(Semantic, Accessor)> { diff --git a/gltf_kun/src/graph/gltf/scene.rs b/gltf_kun/src/graph/gltf/scene.rs index 2b2d337..ee4d631 100644 --- a/gltf_kun/src/graph/gltf/scene.rs +++ b/gltf_kun/src/graph/gltf/scene.rs @@ -1,6 +1,6 @@ use petgraph::graph::NodeIndex; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use super::{node::Node, GltfEdge, GltfWeight}; @@ -74,7 +74,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Scene {} impl GraphNodeEdges for Scene {} -impl Property for Scene {} +impl Extensions for Scene {} impl Scene { pub fn nodes(&self, graph: &Graph) -> Vec { diff --git a/gltf_kun/src/graph/gltf/skin.rs b/gltf_kun/src/graph/gltf/skin.rs index 9890ca3..c55bae7 100644 --- a/gltf_kun/src/graph/gltf/skin.rs +++ b/gltf_kun/src/graph/gltf/skin.rs @@ -1,6 +1,6 @@ use petgraph::{graph::NodeIndex, visit::EdgeRef, Direction}; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use super::{Accessor, GltfEdge, GltfWeight, Node}; @@ -76,7 +76,7 @@ impl From for NodeIndex { impl GraphNodeWeight for Skin {} impl GraphNodeEdges for Skin {} -impl Property for Skin {} +impl Extensions for Skin {} impl Skin { pub fn inverse_bind_matrices(&self, graph: &Graph) -> Option { diff --git a/gltf_kun/src/graph/gltf/texture_info.rs b/gltf_kun/src/graph/gltf/texture_info.rs index 33ea5f4..8153ed6 100644 --- a/gltf_kun/src/graph/gltf/texture_info.rs +++ b/gltf_kun/src/graph/gltf/texture_info.rs @@ -1,6 +1,6 @@ use petgraph::graph::NodeIndex; -use crate::graph::{Edge, Graph, GraphNodeEdges, GraphNodeWeight, Property, Weight}; +use crate::graph::{Edge, Extensions, Graph, GraphNodeEdges, GraphNodeWeight, Weight}; use super::{image::Image, GltfEdge, GltfWeight}; @@ -82,7 +82,7 @@ impl From for NodeIndex { impl GraphNodeWeight for TextureInfo {} impl GraphNodeEdges for TextureInfo {} -impl Property for TextureInfo {} +impl Extensions for TextureInfo {} impl TextureInfo { pub fn image(&self, graph: &Graph) -> Option { diff --git a/gltf_kun/src/graph/mod.rs b/gltf_kun/src/graph/mod.rs index 635825b..effa263 100644 --- a/gltf_kun/src/graph/mod.rs +++ b/gltf_kun/src/graph/mod.rs @@ -16,7 +16,7 @@ pub use byte_node::ByteNode; pub use graph_node::{GraphNodeEdges, GraphNodeWeight}; pub use other_edge::OtherEdgeHelpers; pub use petgraph::stable_graph::NodeIndex; -pub use property::Property; +pub use property::Extensions; use self::{ gltf::{GltfEdge, GltfWeight}, diff --git a/gltf_kun/src/graph/property.rs b/gltf_kun/src/graph/property.rs index d01432c..fb70657 100644 --- a/gltf_kun/src/graph/property.rs +++ b/gltf_kun/src/graph/property.rs @@ -8,8 +8,8 @@ use crate::extensions::Extension; use super::{Edge, Graph}; -/// A property is an object that can have extensions. -pub trait Property: Copy + Into { +/// An object that can have extensions. +pub trait Extensions: Copy + Into { fn extensions(&self, graph: &Graph) -> Vec<&str> { graph .edges_directed((*self).into(), Direction::Outgoing) diff --git a/gltf_kun/tests/physics_extensions.rs b/gltf_kun/tests/physics_extensions.rs index 671c96a..cd9ad1f 100644 --- a/gltf_kun/tests/physics_extensions.rs +++ b/gltf_kun/tests/physics_extensions.rs @@ -9,7 +9,7 @@ use gltf_kun::{ }, DefaultExtensions, Extension, }, - graph::{gltf::document::GltfDocument, ByteNode, Graph, Property}, + graph::{gltf::document::GltfDocument, ByteNode, Extensions, Graph}, io::format::gltf::{GltfExport, GltfImport}, }; use tracing_test::traced_test;