Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 32 additions & 33 deletions native/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2021"
crate-type = ["cdylib"]

[dependencies]
godot = { version = "0.4.5", features = ["experimental-threads", "api-4-5", "register-docs"] }
godot-rust-script = { git = "https://github.com/titannano/godot-rust-script", rev = "26f10ece493d9cc8cdbe2799fba60f0420e41f65" }
godot = { version = "0.5.0", features = ["experimental-threads", "api-4-5", "register-docs"] }
godot-rust-script = { git = "https://github.com/titannano/godot-rust-script", rev = "ca89cf182f6b9e051b66e1e52e23489e25f9077c" }
lerp = "0.4.0"
backtrace = "0.3.64"
num = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion native/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.92.0"
channel = "1.94.0"
components = [ "rustfmt", "clippy" ]
profile = "default"

11 changes: 4 additions & 7 deletions native/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ use godot::classes::{
ConfigFile, EditorPlugin, EditorSettings, GDExtensionManager, GltfDocument, IEditorPlugin,
ProjectSettings,
};
use godot::global::{self, godot_error, godot_print, PropertyHint};
use godot::global::{self, godot_error, godot_print};
use godot::meta::{AsArg, FromGodot};
use godot::obj::{Base, Gd, NewGd, OnReady, Singleton as _, WithBaseField};
use godot::register::info::PropertyHint;
use godot::register::{godot_api, GodotClass};

use building_imports::SetupBuildingImports;
Expand Down Expand Up @@ -133,11 +134,7 @@ impl IEditorPlugin for EditorExtension {
let ao_baker = {
let base = self.base();

AoBaker::new(
editor_interface.clone(),
base.get_tree()
.expect("SceneTree should be available after entering the tree"),
)
AoBaker::new(editor_interface.clone(), base.get_tree())
};

self.ao_baker.init(ao_baker);
Expand Down Expand Up @@ -272,4 +269,4 @@ impl EngineSettings for Gd<EditorSettings> {
fn add_property_info(&mut self, property_info: &VarDictionary) {
self.deref_mut().add_property_info(property_info);
}
}
}
26 changes: 10 additions & 16 deletions native/src/editor/ao_baker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@ use std::{
process::{Command, Stdio},
};

use godot::{
builtin::{GString, PackedStringArray, VariantType},
classes::{EditorInterface, ProjectSettings, RefCounted, SceneTree},
global::PropertyHint,
obj::{Base, Gd, Singleton},
prelude::{godot_api, GodotClass},
task,
};
use godot::builtin::{GString, PackedStringArray, VariantType};
use godot::classes::{EditorInterface, ProjectSettings, RefCounted, SceneTree};
use godot::obj::{Base, Gd, Singleton};
use godot::prelude::{godot_api, GodotClass};
use godot::register::info::PropertyHint;
use godot::task;

use crate::{
editor::{
new_non_zero,
ui::{ForgroundProcess, ProgressDialog},
},
util::logger,
};
use crate::editor::new_non_zero;
use crate::editor::ui::{ForgroundProcess, ProgressDialog};
use crate::util::logger;

#[derive(GodotClass)]
#[class(base = RefCounted, no_init)]
Expand Down Expand Up @@ -245,4 +239,4 @@ impl AoBaker {

dialog.queue_free();
}
}
}
28 changes: 13 additions & 15 deletions native/src/editor/building_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@

use std::collections::VecDeque;

use godot::{
builtin::{GString, VarDictionary, Vector2i},
classes::{
editor_file_dialog, ConfigFile, DirAccess, EditorFileDialog, EditorInterface, FileAccess,
MeshInstance3D, Object, PackedScene, ResourceLoader,
},
global::Error,
meta::ToGodot,
obj::{Base, Gd, GodotClass, NewAlloc, NewGd, Singleton as _, WithBaseField},
register::{godot_api, GodotClass},
use godot::builtin::{GString, VarDictionary, Vector2i};
use godot::classes::{
editor_file_dialog, ConfigFile, DirAccess, EditorFileDialog, EditorInterface, FileAccess,
MeshInstance3D, Object, PackedScene, ResourceLoader,
};
use godot::global::Error;
use godot::meta::ToGodot;
use godot::obj::{Base, Gd, GodotClass, NewAlloc, NewGd, Singleton as _, WithBaseField};
use godot::register::{godot_api, GodotClass};
use pomsky_macro::pomsky;
use regex::Regex;

Expand Down Expand Up @@ -113,7 +111,7 @@ impl SetupBuildingImports {

while let Some(dir_path) = dir_queue.pop_front() {
logger::info!("Traversing dir \"{}\"...", dir_path);
let Some(mut dir) = DirAccess::open(&dir_path) else {
let Some(dir) = DirAccess::open(&dir_path) else {
logger::error!("Directory not accessible: {}", root_dir);
return;
};
Expand Down Expand Up @@ -218,7 +216,7 @@ impl SetupBuildingImports {
.for_each(|index| {
let path = scene_state.get_node_path(index);
let mut config: VarDictionary = nodes
.get(path.clone())
.get(&path)
.map(|value| value.try_to())
.transpose()
.inspect_err(|err| {
Expand All @@ -235,11 +233,11 @@ impl SetupBuildingImports {

nodes.set(
format!("PATH:{}", path.to_string().trim_start_matches("./")),
config,
&config,
);
});

subresources.set("nodes", nodes);
subresources.set("nodes", &nodes);

file.set_value("params", "_subresources", &subresources.to_variant());

Expand All @@ -253,4 +251,4 @@ impl SetupBuildingImports {
);
}
}
}
}
9 changes: 5 additions & 4 deletions native/src/editor/gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

use anyhow::Context;
use godot::builtin::{
Array, GString, PackedInt32Array, PackedVector3Array, VarDictionary, Variant, Vector3,
Array, GString, PackedInt32Array, PackedVector3Array, StringName, VarDictionary, Variant,
Vector3,
};
use godot::classes::decal::DecalTexture;
use godot::classes::mesh::ArrayType;
Expand Down Expand Up @@ -125,7 +126,7 @@ fn fix_ao_uv2(state: &mut Gd<GltfState>) -> Result<(), global::Error> {
return false;
};

material.get_name() == name.to()
material.get_name() == name.to::<GString>()
})
.map(|mat| mat.to::<VarDictionary>());

Expand Down Expand Up @@ -208,7 +209,7 @@ fn use_gd_node(
};

Ok(node?.map(|mut node| {
node.set_name(gltf_node.get_name().arg());
node.set_name(&StringName::from(&gltf_node.get_name()));
node
}))
}
Expand Down Expand Up @@ -385,4 +386,4 @@ fn create_occluder_node(
node.set_occluder(&mesh);

Ok(Some(node.upcast()))
}
}
2 changes: 1 addition & 1 deletion native/src/editor/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

mod progress_dialog;

pub use progress_dialog::*;
pub use progress_dialog::*;
2 changes: 1 addition & 1 deletion native/src/editor/ui/progress_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ fn add_margin_child(
}

mc
}
}
2 changes: 1 addition & 1 deletion native/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

pub(crate) mod node_3d;
pub(crate) mod node_3d;
Loading
Loading