tirbofish/dropbear · diff
refactor: edit compiles, but no components being shown.
Signature present but could not be verified.
Unverified
@@ -1,9 +1,11 @@ -use dropbear_traits::{Component, ComponentDescriptor, ComponentInitContext, ComponentInitFuture, InsertBundle, SerializableComponent}; +use dropbear_traits::{Component, ComponentDescriptor, ComponentInitContext, ComponentInitFuture, ComponentUpdateContext, InsertBundle, SerializableComponent}; use std::collections::HashMap; use std::sync::Arc; use egui::{CollapsingHeader, Ui}; use glam::Mat4; use wgpu::util::DeviceExt; +use crate::asset::ASSET_REGISTRY; +use crate::entity::MeshRenderer; use crate::graphics::SharedGraphicsContext; use crate::model::{AnimationInterpolation, ChannelValues, Model, NodeTransform}; use std::any::Any; @@ -73,6 +75,29 @@ impl Component for AnimationComponent { // todo: complete some more }); } + + fn update(&mut self, ctx: &mut ComponentUpdateContext) { + let world = ctx.world(); + let Ok(renderer) = world.get::<&MeshRenderer>(ctx.entity) else { + return; + }; + + let handle = renderer.model(); + if handle.is_null() { + return; + } + + let registry = ASSET_REGISTRY.read(); + let Some(model) = registry.get_model(handle) else { + return; + }; + + self.update(ctx.dt, model); + + if let Some(graphics) = ctx.resources.get::<Arc<SharedGraphicsContext>>() { + self.prepare_gpu_resources(graphics.clone()); + } + } } impl Default for AnimationComponent {
Large diffs are not rendered by default. Showing the first 50 of 3694 lines. Show full diff