kitgit

tirbofish/dropbear · diff

a9ef897 · tk

basic changes, switching to PC

Unverified

diff --git a/Cargo.toml b/Cargo.toml
index 13950d8..c7145dd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ package.repository = "https://github.com/4tkbytes/dropbear-engine"
 package.readme = "README.md"
 
 resolver = "3"
-members = ["deny_query_one_mut_lint", "dropbear-engine", "eucalyptus-core", "eucalyptus-editor"]
+members = [ "dropbear-engine", "eucalyptus-core", "eucalyptus-editor"]
 # members = ["dropbear-engine", "eucalyptus-core", "eucalyptus-editor", "redback-runtime"]
 
 
diff --git a/deny_query_one_mut_lint/Cargo.toml b/deny_query_one_mut_lint/Cargo.toml
deleted file mode 100644
index 30fe50b..0000000
--- a/deny_query_one_mut_lint/Cargo.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-[package]
-name = "deny_query_one_mut_lint"
-version.workspace = true
-edition.workspace = true
-license = "MIT"
-repository.workspace = true
-readme = "README.md"
-
-[lib]
-crate-type = ["dylib"]
-
-[dependencies]
-
-
-[features]
-default = []
diff --git a/deny_query_one_mut_lint/README.md b/deny_query_one_mut_lint/README.md
deleted file mode 100644
index 09f8231..0000000
--- a/deny_query_one_mut_lint/README.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# deny_query_one_mut_lint
-
-A custom lint for all codebases in the dropbear-engine that check if the usage of [`hecs::World::query_one_mut`] 
-is used. 
-
-### Cause
-
-The editor is required to have the world be threadsafe. This is achieved with the help of `Arc<RwLock<T>>`. 
-This is a great way to achieve threadsafety, however writing to the world often creates a 
-[deadlock](https://en.wikipedia.org/wiki/Deadlock_(computer_science)). A deadlock in Rust is undetectable during
-compile-time and when ran during runtime, it can cause the program to freeze and not respond. 
-
-### Fix
-
-To solve this conundrum, I have implemented a couple of fixes:
-1. Using a [`std::sync::Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) allows for locking, which allows 
-for mutability but blocks that thread. Furthermore, it cannot/shouldn't be used in threads where a mutex uses `Send`. 
-To fix this, I switched to [`parking_lot::RwLock`](https://docs.rs/parking_lot/latest/parking_lot/type.RwLock.html), 
-which doesn't use `Send` (making it even more threadsafe).
-Conveniently, it also includes deadlock detection (as an enabled feature), which can point out if a deadlock is in progress or if an expensive
-operation is being run. 
-2. I have switched from `hecs::World::query_one_mut` to `hecs::World::query_one` to use only the `RwLock::read(&self)`,
-which doesn't require a mutable reference from `self.world`. 
-
-Even with such fixes, deadlocks are inevitable in the codebase. This crate aims to fix this by creating a custom rustc
-lint. 
-
-Note: https://blog.guillaume-gomez.fr/articles/2024-01-18+Writing+your+own+Rust+linter
\ No newline at end of file
diff --git a/deny_query_one_mut_lint/src/lib.rs b/deny_query_one_mut_lint/src/lib.rs
deleted file mode 100644
index b93cf3f..0000000
--- a/deny_query_one_mut_lint/src/lib.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-pub fn add(left: u64, right: u64) -> u64 {
-    left + right
-}
-
-#[cfg(test)]
-mod tests {
-    use super::*;
-
-    #[test]
-    fn it_works() {
-        let result = add(2, 2);
-        assert_eq!(result, 4);
-    }
-}
diff --git a/dropbear-engine/src/lib.rs b/dropbear-engine/src/lib.rs
index 8ad56cf..a44eda2 100644
--- a/dropbear-engine/src/lib.rs
+++ b/dropbear-engine/src/lib.rs
@@ -511,10 +511,14 @@ impl App {
 
         // log::debug!("OUT_DIR: {}", std::env!("OUT_DIR"));
         log::info!("======================================================================");
-        log::info!("dropbear-engine v{} compiled with rustc {}", env!("CARGO_PKG_VERSION"),
+        log::info!("dropbear-engine v{} compiled with {}", env!("CARGO_PKG_VERSION"),
             rustc_version_runtime::version_meta().short_version_string);
         log::info!("Made by tk with love at https://github.com/4tkbytes/dropbear <3");
         log::info!("======================================================================");
+        #[cfg(debug_assertions)]
+        {
+            log::warn!("⚠️ Just a heads up: this is compiled with the debug profile. Expect shit to be slow...");
+        }
         log::info!("dropbear-engine running...");
         let ad = app_dirs2::get_app_root(AppDataType::UserData, &config.app_info);
         match ad {
diff --git a/eucalyptus-editor/src/build/gleam.rs b/eucalyptus-editor/src/build/gleam.rs
index b6c6814..d572eb5 100644
--- a/eucalyptus-editor/src/build/gleam.rs
+++ b/eucalyptus-editor/src/build/gleam.rs
@@ -57,7 +57,7 @@ impl GleamScriptCompiler {
             let _ = s.send(InstallStatus::NotStarted);
         }
 
-        println!("Checking dependencies...");
+        log::info!("Checking dependencies...");
 
         if let Some(ref s) = sender {
             let _ = s.send(InstallStatus::InProgress {
@@ -72,7 +72,7 @@ impl GleamScriptCompiler {
         let javy_available = Self::check_tool_in_path("javy").await;
 
         if gleam_available && bun_available && javy_available {
-            println!("All dependencies found in PATH");
+            log::info!("All dependencies found in PATH");
             if let Some(ref s) = sender {
                 let _ = s.send(InstallStatus::Success);
             }
@@ -162,7 +162,7 @@ impl GleamScriptCompiler {
             let _ = s.send(InstallStatus::Success);
         }
 
-        println!(
+        log::info!(
             "All {} dependencies installed successfully",
             installed_count
         );
@@ -192,7 +192,7 @@ impl GleamScriptCompiler {
             .join(GLEAM_VERSION);
 
         if gleam_dir.exists() {
-            println!(
+            log::info!(
                 "Gleam v{} already cached at {}",
                 GLEAM_VERSION,
                 app_dir.display()
@@ -200,12 +200,12 @@ impl GleamScriptCompiler {
             return Ok(());
         }
 
-        println!("Downloading Gleam v{}...", GLEAM_VERSION);
+        log::info!("Downloading Gleam v{}...", GLEAM_VERSION);
 
         let gleam_link = Self::get_gleam_download_url()?;
         Self::download_and_extract(&gleam_link, &gleam_dir, "gleam", sender).await?;
 
-        println!("Gleam v{} downloaded successfully", GLEAM_VERSION);
+        log::info!("Gleam v{} downloaded successfully", GLEAM_VERSION);
         Ok(())
     }
 
@@ -216,7 +216,7 @@ impl GleamScriptCompiler {
         let bun_dir = app_dir.join("dependencies").join("bun").join(BUN_VERSION);
 
         if bun_dir.exists() {
-            println!(
+            log::info!(
                 "Bun v{} already cached at {}",
                 BUN_VERSION,
                 app_dir.display()
@@ -224,12 +224,12 @@ impl GleamScriptCompiler {
             return Ok(());
         }
 
-        println!("Downloading Bun v{}...", BUN_VERSION);
+        log::info!("Downloading Bun v{}...", BUN_VERSION);
 
         let bun_link = Self::get_bun_download_url()?;
         Self::download_and_extract(&bun_link, &bun_dir, "bun", sender).await?;
 
-        println!("Bun v{} downloaded successfully", BUN_VERSION);
+        log::info!("Bun v{} downloaded successfully", BUN_VERSION);
         Ok(())
     }
 
@@ -240,7 +240,7 @@ impl GleamScriptCompiler {
         let javy_dir = app_dir.join("dependencies").join("javy").join(JAVY_VERSION);
 
         if javy_dir.exists() {
-            println!(
+            log::info!(
                 "Javy v{} already cached at {}",
                 JAVY_VERSION,
                 app_dir.display()
@@ -248,12 +248,12 @@ impl GleamScriptCompiler {
             return Ok(());
         }
 
-        println!("Downloading Javy v{}...", JAVY_VERSION);
+        log::info!("Downloading Javy v{}...", JAVY_VERSION);
 
         let javy_link = Self::get_javy_download_url()?;
         Self::download_and_extract(&javy_link, &javy_dir, "javy", sender).await?;
 
-        println!("Javy v{} downloaded successfully", JAVY_VERSION);
+        log::info!("Javy v{} downloaded successfully", JAVY_VERSION);
         Ok(())
     }
 
diff --git a/eucalyptus-editor/src/editor/component.rs b/eucalyptus-editor/src/editor/component.rs
index 0523a14..c439108 100644
--- a/eucalyptus-editor/src/editor/component.rs
+++ b/eucalyptus-editor/src/editor/component.rs
@@ -13,10 +13,11 @@ use glam::Vec3;
 use hecs::Entity;
 use std::time::Instant;
 
+/// A trait that can added to any component that allows you to inspect the value in the editor.
 pub trait InspectableComponent {
     fn inspect(
         &mut self,
-        entity: &mut hecs::Entity,
+        entity: &mut Entity,
         cfg: &mut StaticallyKept,
         ui: &mut Ui,
         undo_stack: &mut Vec<UndoableAction>,
diff --git a/eucalyptus-editor/src/editor/scene.rs b/eucalyptus-editor/src/editor/scene.rs
index a9b755d..7660bb0 100644
--- a/eucalyptus-editor/src/editor/scene.rs
+++ b/eucalyptus-editor/src/editor/scene.rs
@@ -227,7 +227,7 @@ impl Scene for Editor {
                     }
                 }
             }
-            
+
         }
 
         match &self.signal {
@@ -265,7 +265,7 @@ impl Scene for Editor {
                                                 ModelProperties::default(),
                                             ))
                                         };
-                                        
+
 
                                         self.selected_entity = Some(entity_id);
                                         log::debug!(
@@ -319,7 +319,7 @@ impl Scene for Editor {
                             ModelProperties::default(),
                         ))
                     };
-                    
+
                     self.selected_entity = Some(entity_id);
                     log::debug!(
                         "Successfully paste-spawned {} with ID {:?}",
@@ -1184,7 +1184,7 @@ impl Scene for Editor {
                     }
                 }
             }
-            
+
         }
 
         let camera_follow_data: Vec<(Entity, String, glam::Vec3)> = {
@@ -1203,7 +1203,7 @@ impl Scene for Editor {
                 })
                 .collect()
         };
-        
+
 
         for (camera_entity, target_label, offset) in camera_follow_data {
             let target_position = {
@@ -1219,7 +1219,7 @@ impl Scene for Editor {
                         }
                     })
             };
-            
+
 
             if let Some(pos) = target_position {
                 let world = self.world.read();
@@ -1230,7 +1230,7 @@ impl Scene for Editor {
                     }
                 }
             }
-            
+
         }
 
         {
@@ -1243,7 +1243,7 @@ impl Scene for Editor {
                 camera.update(graphics.shared.clone());
             }
         }
-        
+
         {
             {
                 let mut world = self.world.write();
@@ -1253,7 +1253,7 @@ impl Scene for Editor {
                     entity.update(graphics.shared.clone(), transform);
                 }
             }
-            
+
 
             {
                 let mut world = self.world.write();
@@ -1407,7 +1407,7 @@ impl Scene for Editor {
                 log_once::error_once!("No active camera found");
             }
         } else {
-            log_once::error_once!("No render pipeline exists");
+            log_once::warn_once!("No render pipeline exists");
         }
     }
 
diff --git a/redback-runtime b/redback-runtime
index 5cb98c0..ba32a23 160000
--- a/redback-runtime
+++ b/redback-runtime
@@ -1 +1 @@
-Subproject commit 5cb98c0d508c7f8fd7d6a268d101d6e0fde0f41f
+Subproject commit ba32a2319d7b302c0d294311a9ad3135e9eb8503