Trait IScriptLanguageExtension
pub trait IScriptLanguageExtension: GodotClass<Base = ScriptLanguageExtension> + You_forgot_the_attribute__godot_api {
Show 66 methods
// Required methods
fn get_name(&self) -> GString;
fn init_ext(&mut self);
fn get_type(&self) -> GString;
fn get_extension(&self) -> GString;
fn finish(&mut self);
fn get_reserved_words(&self) -> PackedStringArray;
fn is_control_flow_keyword(&self, keyword: GString) -> bool;
fn get_comment_delimiters(&self) -> PackedStringArray;
fn get_string_delimiters(&self) -> PackedStringArray;
fn make_template(
&self,
template: GString,
class_name: GString,
base_class_name: GString,
) -> Option<Gd<Script>>;
fn get_built_in_templates(&self, object: StringName) -> Array<Dictionary>;
fn is_using_templates(&mut self) -> bool;
fn validate(
&self,
script: GString,
path: GString,
validate_functions: bool,
validate_errors: bool,
validate_warnings: bool,
validate_safe_lines: bool,
) -> Dictionary;
fn validate_path(&self, path: GString) -> GString;
fn create_script(&self) -> Option<Gd<Object>>;
fn has_named_classes(&self) -> bool;
fn supports_builtin_mode(&self) -> bool;
fn supports_documentation(&self) -> bool;
fn can_inherit_from_file(&self) -> bool;
fn find_function(&self, function: GString, code: GString) -> i32;
fn make_function(
&self,
class_name: GString,
function_name: GString,
function_args: PackedStringArray,
) -> GString;
fn can_make_function(&self) -> bool;
fn open_in_external_editor(
&mut self,
script: Option<Gd<Script>>,
line: i32,
column: i32,
) -> Error;
fn overrides_external_editor(&mut self) -> bool;
fn preferred_file_name_casing(&self) -> ScriptNameCasing;
fn complete_code(
&self,
code: GString,
path: GString,
owner: Option<Gd<Object>>,
) -> Dictionary;
fn lookup_code(
&self,
code: GString,
symbol: GString,
path: GString,
owner: Option<Gd<Object>>,
) -> Dictionary;
fn auto_indent_code(
&self,
code: GString,
from_line: i32,
to_line: i32,
) -> GString;
fn add_global_constant(&mut self, name: StringName, value: Variant);
fn add_named_global_constant(&mut self, name: StringName, value: Variant);
fn remove_named_global_constant(&mut self, name: StringName);
fn thread_enter(&mut self);
fn thread_exit(&mut self);
fn debug_get_error(&self) -> GString;
fn debug_get_stack_level_count(&self) -> i32;
fn debug_get_stack_level_line(&self, level: i32) -> i32;
fn debug_get_stack_level_function(&self, level: i32) -> GString;
fn debug_get_stack_level_source(&self, level: i32) -> GString;
fn debug_get_stack_level_locals(
&mut self,
level: i32,
max_subitems: i32,
max_depth: i32,
) -> Dictionary;
fn debug_get_stack_level_members(
&mut self,
level: i32,
max_subitems: i32,
max_depth: i32,
) -> Dictionary;
unsafe fn debug_get_stack_level_instance(
&mut self,
level: i32,
) -> *mut c_void;
fn debug_get_globals(
&mut self,
max_subitems: i32,
max_depth: i32,
) -> Dictionary;
fn debug_parse_stack_level_expression(
&mut self,
level: i32,
expression: GString,
max_subitems: i32,
max_depth: i32,
) -> GString;
fn debug_get_current_stack_info(&mut self) -> Array<Dictionary>;
fn reload_all_scripts(&mut self);
fn reload_tool_script(
&mut self,
script: Option<Gd<Script>>,
soft_reload: bool,
);
fn get_recognized_extensions(&self) -> PackedStringArray;
fn get_public_functions(&self) -> Array<Dictionary>;
fn get_public_constants(&self) -> Dictionary;
fn get_public_annotations(&self) -> Array<Dictionary>;
fn profiling_start(&mut self);
fn profiling_stop(&mut self);
fn profiling_set_save_native_calls(&mut self, enable: bool);
unsafe fn profiling_get_accumulated_data(
&mut self,
info_array: *mut ScriptLanguageExtensionProfilingInfo,
info_max: i32,
) -> i32;
unsafe fn profiling_get_frame_data(
&mut self,
info_array: *mut ScriptLanguageExtensionProfilingInfo,
info_max: i32,
) -> i32;
fn frame(&mut self);
fn handles_global_class_type(&self, type_: GString) -> bool;
fn get_global_class_name(&self, path: GString) -> Dictionary;
// Provided methods
fn init(base: Base<Self::Base>) -> Self { ... }
fn to_string(&self) -> GString { ... }
fn on_notification(&mut self, what: ObjectNotification) { ... }
fn get_property(&self, property: StringName) -> Option<Variant> { ... }
fn set_property(&mut self, property: StringName, value: Variant) -> bool { ... }
fn get_property_list(&mut self) -> Vec<PropertyInfo> { ... }
fn property_get_revert(&self, property: StringName) -> Option<Variant> { ... }
fn get_doc_comment_delimiters(&self) -> PackedStringArray { ... }
}
Expand description
Virtual methods for class ScriptLanguageExtension
.
These methods represent constructors (init
) or callbacks invoked by the engine.
Required Methods§
fn get_name(&self) -> GString
fn init_ext(&mut self)
fn get_type(&self) -> GString
fn get_extension(&self) -> GString
fn finish(&mut self)
fn get_reserved_words(&self) -> PackedStringArray
fn is_control_flow_keyword(&self, keyword: GString) -> bool
fn get_comment_delimiters(&self) -> PackedStringArray
fn get_string_delimiters(&self) -> PackedStringArray
fn make_template( &self, template: GString, class_name: GString, base_class_name: GString, ) -> Option<Gd<Script>>
fn get_built_in_templates(&self, object: StringName) -> Array<Dictionary>
fn is_using_templates(&mut self) -> bool
fn validate( &self, script: GString, path: GString, validate_functions: bool, validate_errors: bool, validate_warnings: bool, validate_safe_lines: bool, ) -> Dictionary
fn validate_path(&self, path: GString) -> GString
fn create_script(&self) -> Option<Gd<Object>>
fn has_named_classes(&self) -> bool
fn supports_builtin_mode(&self) -> bool
fn supports_documentation(&self) -> bool
fn can_inherit_from_file(&self) -> bool
fn find_function(&self, function: GString, code: GString) -> i32
fn make_function( &self, class_name: GString, function_name: GString, function_args: PackedStringArray, ) -> GString
fn can_make_function(&self) -> bool
fn open_in_external_editor( &mut self, script: Option<Gd<Script>>, line: i32, column: i32, ) -> Error
fn overrides_external_editor(&mut self) -> bool
fn preferred_file_name_casing(&self) -> ScriptNameCasing
fn complete_code( &self, code: GString, path: GString, owner: Option<Gd<Object>>, ) -> Dictionary
fn lookup_code( &self, code: GString, symbol: GString, path: GString, owner: Option<Gd<Object>>, ) -> Dictionary
fn auto_indent_code( &self, code: GString, from_line: i32, to_line: i32, ) -> GString
fn add_global_constant(&mut self, name: StringName, value: Variant)
fn add_named_global_constant(&mut self, name: StringName, value: Variant)
fn remove_named_global_constant(&mut self, name: StringName)
fn thread_enter(&mut self)
fn thread_exit(&mut self)
fn debug_get_error(&self) -> GString
fn debug_get_stack_level_count(&self) -> i32
fn debug_get_stack_level_line(&self, level: i32) -> i32
fn debug_get_stack_level_function(&self, level: i32) -> GString
fn debug_get_stack_level_source(&self, level: i32) -> GString
fn debug_get_stack_level_locals( &mut self, level: i32, max_subitems: i32, max_depth: i32, ) -> Dictionary
fn debug_get_stack_level_members( &mut self, level: i32, max_subitems: i32, max_depth: i32, ) -> Dictionary
unsafe fn debug_get_stack_level_instance(&mut self, level: i32) -> *mut c_void
unsafe fn debug_get_stack_level_instance(&mut self, level: i32) -> *mut c_void
§Safety
This method has automatically been marked unsafe
because it accepts raw pointers as parameters.
If Godot does not document any safety requirements, make sure you understand the underlying semantics.
fn debug_get_globals(&mut self, max_subitems: i32, max_depth: i32) -> Dictionary
fn debug_parse_stack_level_expression( &mut self, level: i32, expression: GString, max_subitems: i32, max_depth: i32, ) -> GString
fn debug_get_current_stack_info(&mut self) -> Array<Dictionary>
fn reload_all_scripts(&mut self)
fn reload_tool_script(&mut self, script: Option<Gd<Script>>, soft_reload: bool)
fn get_recognized_extensions(&self) -> PackedStringArray
fn get_public_functions(&self) -> Array<Dictionary>
fn get_public_constants(&self) -> Dictionary
fn get_public_annotations(&self) -> Array<Dictionary>
fn profiling_start(&mut self)
fn profiling_stop(&mut self)
fn profiling_set_save_native_calls(&mut self, enable: bool)
unsafe fn profiling_get_accumulated_data(
&mut self,
info_array: *mut ScriptLanguageExtensionProfilingInfo,
info_max: i32,
) -> i32
unsafe fn profiling_get_accumulated_data( &mut self, info_array: *mut ScriptLanguageExtensionProfilingInfo, info_max: i32, ) -> i32
§Safety
This method has automatically been marked unsafe
because it accepts raw pointers as parameters.
If Godot does not document any safety requirements, make sure you understand the underlying semantics.
unsafe fn profiling_get_frame_data(
&mut self,
info_array: *mut ScriptLanguageExtensionProfilingInfo,
info_max: i32,
) -> i32
unsafe fn profiling_get_frame_data( &mut self, info_array: *mut ScriptLanguageExtensionProfilingInfo, info_max: i32, ) -> i32
§Safety
This method has automatically been marked unsafe
because it accepts raw pointers as parameters.
If Godot does not document any safety requirements, make sure you understand the underlying semantics.
fn frame(&mut self)
fn handles_global_class_type(&self, type_: GString) -> bool
fn get_global_class_name(&self, path: GString) -> Dictionary
Provided Methods§
fn init(base: Base<Self::Base>) -> Self
fn init(base: Base<Self::Base>) -> Self
Godot constructor, accepting an injected base
object.
base
refers to the base instance of the class, which can either be stored in a Base<T>
field or discarded.
This method returns a fully-constructed instance, which will then be moved into a Gd<T>
pointer.
If the class has a #[class(init)]
attribute, this method will be auto-generated and must not be overridden.
fn to_string(&self) -> GString
fn to_string(&self) -> GString
String representation of the Godot instance.
Override this method to define how the instance is represented as a string.
Used by impl Display for Gd<T>
, as well as str()
and print()
in GDScript.
fn on_notification(&mut self, what: ObjectNotification)
fn on_notification(&mut self, what: ObjectNotification)
Called when the object receives a Godot notification.
The type of notification can be identified through what
. The enum is designed to hold all possible NOTIFICATION_*
constants that the current class can handle. However, this is not validated in Godot, so an enum variant Unknown
exists
to represent integers out of known constants (mistakes or future additions).
This method is named _notification
in Godot, but on_notification
in Rust. To send notifications, use the
Object::notify
method.
See also in Godot docs:
fn get_property(&self, property: StringName) -> Option<Variant>
fn get_property(&self, property: StringName) -> Option<Variant>
Called whenever get()
is called or Godot gets the value of a property.
Should return the given property
’s value as Some(value)
, or None
if the property should be handled normally.
See also in Godot docs:
fn set_property(&mut self, property: StringName, value: Variant) -> bool
fn set_property(&mut self, property: StringName, value: Variant) -> bool
Called whenever Godot set()
is called or Godot sets the value of a property.
Should set property
to the given value
and return true
, or return false
to indicate the property
should be handled normally.
See also in Godot docs:
fn get_property_list(&mut self) -> Vec<PropertyInfo>
Available on since_api="4.3"
only.
fn get_property_list(&mut self) -> Vec<PropertyInfo>
since_api="4.3"
only.Called whenever Godot get_property_list()
is called, the returned vector here is
appended to the existing list of properties.
This should mainly be used for advanced purposes, such as dynamically updating the property list in the editor.
See also in Godot docs:
fn property_get_revert(&self, property: StringName) -> Option<Variant>
fn property_get_revert(&self, property: StringName) -> Option<Variant>
Called by Godot to tell if a property has a custom revert or not.
Return None
for no custom revert, and return Some(value)
to specify the custom revert.
This is a combination of Godot’s Object::_property_get_revert
and Object::_property_can_revert
. This means that this
function will usually be called twice by Godot to find the revert.
Note that this should be a pure function. That is, it should always return the same value for a property as long as self
remains unchanged. Otherwise, this may lead to unexpected (safe) behavior.