kitgit

tirbofish/dropbear · diff

a0917a8 · Thribhu K

wip: finally got eucalyptus-core all smoothened out, need to fix up the editor now.

Unverified

diff --git a/crates/dropbear-engine/src/animation.rs b/crates/dropbear-engine/src/animation.rs
index 135b58a..26634a0 100644
--- a/crates/dropbear-engine/src/animation.rs
+++ b/crates/dropbear-engine/src/animation.rs
@@ -1,13 +1,14 @@
-use dropbear_traits::SerializableComponent;
+use dropbear_traits::{Component, ComponentDescriptor, ComponentInitContext, ComponentInitFuture, InsertBundle, SerializableComponent};
 use std::collections::HashMap;
 use std::sync::Arc;
+use egui::{CollapsingHeader, Ui};
 use glam::Mat4;
 use wgpu::util::DeviceExt;
-use dropbear_macro::SerializableComponent;
 use crate::graphics::SharedGraphicsContext;
 use crate::model::{AnimationInterpolation, ChannelValues, Model, NodeTransform};
+use std::any::Any;
 
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, SerializableComponent)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
 pub struct AnimationComponent {
     #[serde(default)]
     pub active_animation_index: Option<usize>,
@@ -31,6 +32,49 @@ pub struct AnimationComponent {
     pub bind_group: Option<wgpu::BindGroup>,
 }
 
+impl Component for AnimationComponent {
+    type Serialized = AnimationComponent;
+
+    fn static_descriptor() -> ComponentDescriptor {
+        ComponentDescriptor {
+            fqtn: "dropbear_engine::animation::AnimationComponent".to_string(),
+            type_name: "AnimationComponent".to_string(),
+            category: Some("Animation".to_string()),
+            description: Some("A component that allows playback of a component".to_string()),
+        }
+    }
+
+    fn deserialize(serialized: &Self::Serialized) -> Self {
+        serialized.clone()
+    }
+
+    fn serialize(&self) -> Self::Serialized {
+        self.clone()
+    }
+
+    fn inspect(&mut self, ui: &mut Ui) {
+        CollapsingHeader::new("Animation").default_open(true).show(ui, |ui| {
+            ui.label("Active animation:");
+            let mut enabled = self.active_animation_index.is_some();

Large diffs are not rendered by default. Showing the first 50 of 5514 lines. Show full diff