tirbofish/dropbear · diff
feature: animation scripting works.
jarvis, run github actions
Signature present but could not be verified.
Unverified
@@ -5,7 +5,13 @@ use dropbear_engine::animation::{AnimationComponent, AnimationSettings}; use dropbear_engine::asset::ASSET_REGISTRY; use dropbear_engine::entity::MeshRenderer; use dropbear_engine::graphics::SharedGraphicsContext; +use jni::objects::JObject; +use jni::JNIEnv; use crate::component::{Component, ComponentDescriptor, InspectableComponent, SerializedComponent}; +use crate::ptr::WorldPtr; +use crate::scripting::jni::utils::ToJObject; +use crate::scripting::native::DropbearNativeError; +use crate::scripting::result::DropbearNativeResult; #[typetag::serde] impl SerializedComponent for AnimationComponent {} @@ -75,14 +81,22 @@ impl InspectableComponent for AnimationComponent { "No Animations" }; + let mut selection_changed = false; ComboBox::from_label("Animation") .selected_text(selected_label) .show_ui(ui, |ui| { for (index, name) in self.available_animations.iter().enumerate() { - ui.selectable_value(&mut selected_index, index, name); + if ui.selectable_value(&mut selected_index, index, name).changed() { + selection_changed = true; + } } }); + if selection_changed && has_animations { + self.active_animation_index = Some(selected_index); + enabled = true; + } + ui.horizontal(|ui| { ui.label("Active"); @@ -138,4 +152,395 @@ impl InspectableComponent for AnimationComponent { } }); } +} + +fn collect_available_animations( + world: &World,
Large diffs are not rendered by default. Showing the first 50 of 930 lines. Show full diff