mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2025-12-31 21:48:42 +03:00
We've made several updates to improve our codebase and application performance. - Clang format was applied for better readability and consistency, aiding other developers in understanding and contributing to the code. - We resolved issues that were causing visual script compilation failure. The visual script now compiles successfully, ensuring application functionality. - Broken sections within the codebase were fixed, improving overall stability. - Built-in functions from the visual script were removed to simplify the code and enhance readability. - Generic search performance was improved to provide faster results, enhancing user experience. - Missing flow nodes were added to the Visual Script, ensuring all necessary components are present for correct functioning. In an effort to streamline the codebase: - `VisualScriptComment` class and related code were removed, reducing complexity and improving maintainability. - Error messages were optimized for quicker feedback when errors occur. - Licenses were updated to reflect recent changes, ensuring legal compliance and project transparency. - The `get_global_name()` override in `visual_script.h` was fixed, and `TYPE_BUILTIN_FUNC` in `visual_script_expression.h` was removed, improving code functionality. - Search logic was refactored to avoid double searching, enhancing performance. - Documentation was updated to reflect recent changes, providing accurate information to users and developers. - Property selection logic in `VisualScriptPropertySelector` was refactored for easier understanding and modification. - Code was refactored to avoid variable shadowing, improving readability and reducing potential errors. - `.clang-format` and `.clang-tidy` configuration files were added to ensure consistent code styling. To make the code more robust and easier to understand: - Variable names were corrected for clarity, and error handling in `visual_script_expression.cpp` was improved. - Function and variable names were refactored for better readability and maintainability. - Member editing logic in `VisualScriptEditor` was simplified. - Name variables were updated to be unique, avoiding potential conflicts and errors. - The `VisualScriptSubCall` class was refactored for simplicity and ease of understanding. For macOS workflow: - It was updated to use the latest version and correct path for installing Vulkan SDK, enabling the application to leverage the latest features and improvements from the Vulkan SDK. - Mac Vulkan SDK was installed to support Vulkan-based functionalities. Lastly, we made necessary changes to pass CI/CD tests, ensuring the code quality and stability of the application.
145 lines
6.0 KiB
C++
145 lines
6.0 KiB
C++
/**************************************************************************/
|
|
/* register_types.cpp */
|
|
/**************************************************************************/
|
|
/* This file is part of: */
|
|
/* GODOT ENGINE */
|
|
/* https://godotengine.org */
|
|
/**************************************************************************/
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
/* */
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
/* a copy of this software and associated documentation files (the */
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
/* the following conditions: */
|
|
/* */
|
|
/* The above copyright notice and this permission notice shall be */
|
|
/* included in all copies or substantial portions of the Software. */
|
|
/* */
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
/**************************************************************************/
|
|
|
|
#include "register_types.h"
|
|
|
|
#include "core/config/engine.h"
|
|
#include "core/io/resource_loader.h"
|
|
#include "visual_script.h"
|
|
#include "visual_script_expression.h"
|
|
#include "visual_script_flow_control.h"
|
|
#include "visual_script_func_nodes.h"
|
|
#include "visual_script_nodes.h"
|
|
#include "visual_script_yield_nodes.h"
|
|
|
|
VisualScriptLanguage *visual_script_language = nullptr;
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
#include "editor/visual_script_editor.h"
|
|
static VisualScriptCustomNodes *vs_custom_nodes_singleton = nullptr;
|
|
#endif
|
|
|
|
void initialize_visual_script_module(ModuleInitializationLevel p_level) {
|
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
|
visual_script_language = memnew(VisualScriptLanguage);
|
|
// script_language_gd->init();
|
|
ScriptServer::register_language(visual_script_language);
|
|
|
|
GDREGISTER_CLASS(VisualScript);
|
|
GDREGISTER_ABSTRACT_CLASS(VisualScriptNode);
|
|
GDREGISTER_CLASS(VisualScriptFunctionState);
|
|
GDREGISTER_CLASS(VisualScriptFunction);
|
|
GDREGISTER_ABSTRACT_CLASS(VisualScriptLists);
|
|
GDREGISTER_CLASS(VisualScriptComposeArray);
|
|
GDREGISTER_CLASS(VisualScriptOperator);
|
|
GDREGISTER_CLASS(VisualScriptVariableSet);
|
|
GDREGISTER_CLASS(VisualScriptVariableGet);
|
|
GDREGISTER_CLASS(VisualScriptConstant);
|
|
GDREGISTER_CLASS(VisualScriptIndexGet);
|
|
GDREGISTER_CLASS(VisualScriptIndexSet);
|
|
GDREGISTER_CLASS(VisualScriptGlobalConstant);
|
|
GDREGISTER_CLASS(VisualScriptClassConstant);
|
|
GDREGISTER_CLASS(VisualScriptMathConstant);
|
|
GDREGISTER_CLASS(VisualScriptBasicTypeConstant);
|
|
GDREGISTER_CLASS(VisualScriptEngineSingleton);
|
|
GDREGISTER_CLASS(VisualScriptSceneNode);
|
|
GDREGISTER_CLASS(VisualScriptSceneTree);
|
|
GDREGISTER_CLASS(VisualScriptResourcePath);
|
|
GDREGISTER_CLASS(VisualScriptSelf);
|
|
GDREGISTER_CLASS(VisualScriptCustomNode);
|
|
GDREGISTER_CLASS(VisualScriptSubCall);
|
|
GDREGISTER_CLASS(VisualScriptConstructor);
|
|
GDREGISTER_CLASS(VisualScriptLocalVar);
|
|
GDREGISTER_CLASS(VisualScriptLocalVarSet);
|
|
GDREGISTER_CLASS(VisualScriptInputAction);
|
|
GDREGISTER_CLASS(VisualScriptDeconstruct);
|
|
GDREGISTER_CLASS(VisualScriptPreload);
|
|
GDREGISTER_CLASS(VisualScriptTypeCast);
|
|
|
|
GDREGISTER_CLASS(VisualScriptFunctionCall);
|
|
GDREGISTER_CLASS(VisualScriptPropertySet);
|
|
GDREGISTER_CLASS(VisualScriptPropertyGet);
|
|
GDREGISTER_CLASS(VisualScriptEmitSignal);
|
|
|
|
GDREGISTER_CLASS(VisualScriptReturn);
|
|
GDREGISTER_CLASS(VisualScriptCondition);
|
|
GDREGISTER_CLASS(VisualScriptWhile);
|
|
GDREGISTER_CLASS(VisualScriptIterator);
|
|
GDREGISTER_CLASS(VisualScriptSequence);
|
|
GDREGISTER_CLASS(VisualScriptSwitch);
|
|
GDREGISTER_CLASS(VisualScriptSelect);
|
|
|
|
GDREGISTER_CLASS(VisualScriptYield);
|
|
GDREGISTER_CLASS(VisualScriptYieldSignal);
|
|
|
|
GDREGISTER_CLASS(VisualScriptExpression);
|
|
|
|
register_visual_script_nodes();
|
|
register_visual_script_func_nodes();
|
|
register_visual_script_flow_control_nodes();
|
|
register_visual_script_yield_nodes();
|
|
register_visual_script_expression_node();
|
|
}
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
|
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
GDREGISTER_CLASS(VisualScriptCustomNodes);
|
|
ClassDB::set_current_api(ClassDB::API_CORE);
|
|
vs_custom_nodes_singleton = memnew(VisualScriptCustomNodes);
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton(
|
|
"VisualScriptCustomNodes", VisualScriptCustomNodes::get_singleton()));
|
|
|
|
VisualScriptEditor::register_editor();
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void uninitialize_visual_script_module(ModuleInitializationLevel p_level) {
|
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
|
unregister_visual_script_nodes();
|
|
|
|
ScriptServer::unregister_language(visual_script_language);
|
|
|
|
if (visual_script_language) {
|
|
memdelete(visual_script_language);
|
|
}
|
|
}
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
|
VisualScriptEditor::free_clipboard();
|
|
if (vs_custom_nodes_singleton) {
|
|
memdelete(vs_custom_nodes_singleton);
|
|
}
|
|
}
|
|
#endif
|
|
}
|