-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow querying the scripts of nodes in Godot
This allows you to get access to the underlying values stored in the scripts, which likely contain a lot of important information for the auto splitter.
- Loading branch information
Showing
40 changed files
with
1,282 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
mod object; | ||
mod script_instance; | ||
mod script_language; | ||
|
||
pub use object::*; | ||
pub use script_instance::*; | ||
pub use script_language::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//! <https://github.com/godotengine/godot/blob/07cf36d21c9056fb4055f020949fb90ebd795afb/core/object/script_instance.h> | ||
/// An instance of a [`Script`](super::Script). | ||
/// | ||
/// You need to cast this to a | ||
/// [`GDScriptInstance`](crate::game_engine::godot::GDScriptInstance) or | ||
/// [`CSharpScriptInstance`](crate::game_engine::godot::CSharpScriptInstance) to | ||
/// do anything meaningful with it. Make sure to verify the script language | ||
/// before casting. | ||
#[derive(Debug, Copy, Clone)] | ||
#[repr(transparent)] | ||
pub struct ScriptInstance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//! <https://github.com/godotengine/godot/blob/07cf36d21c9056fb4055f020949fb90ebd795afb/core/object/script_language.h> | ||
/// A class stored as a resource. | ||
/// | ||
/// [`Script`](https://docs.godotengine.org/en/4.2/classes/class_script.html) | ||
/// | ||
/// You need to cast this to a [`GDScript`](crate::game_engine::godot::GDScript) | ||
/// or [`CSharpScript`](crate::game_engine::godot::CSharpScript) to do anything | ||
/// meaningful with it. Make sure to verify the script language before casting. | ||
#[derive(Debug, Copy, Clone)] | ||
#[repr(transparent)] | ||
pub struct Script; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! <https://github.com/godotengine/godot/blob/07cf36d21c9056fb4055f020949fb90ebd795afb/core/templates/cowdata.h> | ||
use bytemuck::{Pod, Zeroable}; | ||
|
||
use crate::game_engine::godot::Ptr; | ||
|
||
/// A copy-on-write data type. This is not publicly exposed in Godot. | ||
#[repr(transparent)] | ||
pub struct CowData<T>(Ptr<T>); | ||
|
||
impl<T> Copy for CowData<T> {} | ||
|
||
impl<T> Clone for CowData<T> { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} | ||
|
||
// SAFETY: The type is transparent over a `Ptr`, which is `Pod`. | ||
unsafe impl<T: 'static> Pod for CowData<T> {} | ||
|
||
// SAFETY: The type is transparent over a `Ptr`, which is `Zeroable`. | ||
unsafe impl<T> Zeroable for CowData<T> {} | ||
|
||
impl<T> CowData<T> { | ||
/// Returns the pointer to the underlying data. | ||
pub fn ptr(self) -> Ptr<T> { | ||
self.0 | ||
} | ||
} |
Oops, something went wrong.