tirbofish/dropbear · commit
5734766f3d3179f7c4e327a5466317c40a6851a4
fix: general editor fixes, improvements to components and optimised the model rendering (as well as animations playing).
Signature present but could not be verified.
Unverified
@@ -3,7 +3,7 @@ use std::sync::Arc; use glam::Mat4; use wgpu::util::DeviceExt; use crate::graphics::SharedGraphicsContext; -use crate::model::{Animation, AnimationInterpolation, ChannelValues, Model, NodeTransform}; +use crate::model::{AnimationInterpolation, ChannelValues, Model, NodeTransform}; #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct AnimationComponent { @@ -245,6 +245,13 @@ impl AssetRegistry { } pub fn update_model(&mut self, handle: Handle<Model>, model: Model) -> Option<Model> { + if let Some(existing) = self.models.get(&handle.id) { + if existing.label.eq_ignore_ascii_case("light cube") { + log::warn!("Attempted to update protected model '{}'", existing.label); + return None; + } + } + self.models.insert(handle.id, model) } @@ -252,6 +259,10 @@ impl AssetRegistry { self.models.get(&handle.id) } + pub fn get_model_mut(&mut self, handle: Handle<Model>) -> Option<&mut Model> { + self.models.get_mut(&handle.id) + } + pub fn get_model_by_label(&self, label: &str) -> Option<&Model> { self.model_labels .get(label) @@ -7,10 +7,10 @@ use std::{ }; use crate::{
Large diffs are not rendered by default. Showing the first 50 of 2650 lines. Show full diff