diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdnative/gd_native_library_editor.cpp | 94 | ||||
-rw-r--r-- | modules/gdnative/gd_native_library_editor.h | 39 | ||||
-rw-r--r-- | modules/gdnative/register_types.cpp | 4 | ||||
-rw-r--r-- | modules/visual_script/visual_script_builtin_funcs.cpp | 59 | ||||
-rw-r--r-- | modules/visual_script/visual_script_func_nodes.cpp | 20 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 15 |
6 files changed, 190 insertions, 41 deletions
diff --git a/modules/gdnative/gd_native_library_editor.cpp b/modules/gdnative/gd_native_library_editor.cpp index 8aa931d6c9..cc2c2b69a6 100644 --- a/modules/gdnative/gd_native_library_editor.cpp +++ b/modules/gdnative/gd_native_library_editor.cpp @@ -1,9 +1,39 @@ +/*************************************************************************/ +/* gd_native_library_editor.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* 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. */ +/*************************************************************************/ +#ifdef TOOLS_ENABLED #include "gd_native_library_editor.h" + #include "gdnative.h" void GDNativeLibraryEditor::_find_gdnative_singletons(EditorFileSystemDirectory *p_dir, const Set<String> &enabled_list) { - // check children for (int i = 0; i < p_dir->get_file_count(); i++) { @@ -17,48 +47,45 @@ void GDNativeLibraryEditor::_find_gdnative_singletons(EditorFileSystemDirectory if (lib.is_valid() && lib->is_singleton_gdnative()) { String path = p_dir->get_file_path(i); TreeItem *ti = libraries->create_item(libraries->get_root()); - ti->set_text(0,path.get_file()); - ti->set_tooltip(0,path); - ti->set_metadata(0,path); - ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE); - ti->set_text(1,"Disabled,Enabled"); - bool enabled = enabled_list.has(path)?true:false; - - ti->set_range(1,enabled?1:0); - ti->set_custom_color(1,enabled?Color(0,1,0):Color(1,0,0)); + ti->set_text(0, path.get_file()); + ti->set_tooltip(0, path); + ti->set_metadata(0, path); + ti->set_cell_mode(1, TreeItem::CELL_MODE_RANGE); + ti->set_text(1, "Disabled,Enabled"); + bool enabled = enabled_list.has(path) ? true : false; + + ti->set_range(1, enabled ? 1 : 0); + ti->set_custom_color(1, enabled ? Color(0, 1, 0) : Color(1, 0, 0)); } } // check subdirectories for (int i = 0; i < p_dir->get_subdir_count(); i++) { - _find_gdnative_singletons(p_dir->get_subdir(i),enabled_list); + _find_gdnative_singletons(p_dir->get_subdir(i), enabled_list); } - - } void GDNativeLibraryEditor::_update_libraries() { - updating=true; + updating = true; libraries->clear(); libraries->create_item(); //rppt Vector<String> enabled_paths; if (ProjectSettings::get_singleton()->has("gdnative/singletons")) { - enabled_paths=ProjectSettings::get_singleton()->get("gdnative/singletons"); + enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons"); } Set<String> enabled_list; - for(int i=0;i<enabled_paths.size();i++) { + for (int i = 0; i < enabled_paths.size(); i++) { enabled_list.insert(enabled_paths[i]); } EditorFileSystemDirectory *fs = EditorFileSystem::get_singleton()->get_filesystem(); if (fs) { - _find_gdnative_singletons(fs,enabled_list); + _find_gdnative_singletons(fs, enabled_list); } - updating=false; - + updating = false; } void GDNativeLibraryEditor::_item_edited() { @@ -74,11 +101,11 @@ void GDNativeLibraryEditor::_item_edited() { Vector<String> enabled_paths; if (ProjectSettings::get_singleton()->has("gdnative/singletons")) { - enabled_paths=ProjectSettings::get_singleton()->get("gdnative/singletons"); + enabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons"); } if (enabled) { - if (enabled_paths.find(path)==-1) { + if (enabled_paths.find(path) == -1) { enabled_paths.push_back(path); } } else { @@ -86,15 +113,15 @@ void GDNativeLibraryEditor::_item_edited() { } if (enabled_paths.size()) { - ProjectSettings::get_singleton()->set("gdnative/singletons",enabled_paths); + ProjectSettings::get_singleton()->set("gdnative/singletons", enabled_paths); } else { - ProjectSettings::get_singleton()->set("gdnative/singletons",Variant()); + ProjectSettings::get_singleton()->set("gdnative/singletons", Variant()); } } void GDNativeLibraryEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { if (is_visible_in_tree()) { _update_libraries(); } @@ -103,18 +130,19 @@ void GDNativeLibraryEditor::_notification(int p_what) { void GDNativeLibraryEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_item_edited"),&GDNativeLibraryEditor::_item_edited); + ClassDB::bind_method(D_METHOD("_item_edited"), &GDNativeLibraryEditor::_item_edited); } -GDNativeLibraryEditor::GDNativeLibraryEditor() -{ - libraries = memnew( Tree ); +GDNativeLibraryEditor::GDNativeLibraryEditor() { + libraries = memnew(Tree); libraries->set_columns(2); libraries->set_column_titles_visible(true); - libraries->set_column_title(0,TTR("Library")); - libraries->set_column_title(1,TTR("Status")); + libraries->set_column_title(0, TTR("Library")); + libraries->set_column_title(1, TTR("Status")); libraries->set_hide_root(true); - add_margin_child(TTR("Libraries: "),libraries,true); - updating=false; - libraries->connect("item_edited",this,"_item_edited"); + add_margin_child(TTR("Libraries: "), libraries, true); + updating = false; + libraries->connect("item_edited", this, "_item_edited"); } + +#endif // TOOLS_ENABLED diff --git a/modules/gdnative/gd_native_library_editor.h b/modules/gdnative/gd_native_library_editor.h index a6c8f31790..a11c4620dd 100644 --- a/modules/gdnative/gd_native_library_editor.h +++ b/modules/gdnative/gd_native_library_editor.h @@ -1,23 +1,52 @@ +/*************************************************************************/ +/* gd_native_library_editor.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* 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. */ +/*************************************************************************/ #ifndef GD_NATIVE_LIBRARY_EDITOR_H #define GD_NATIVE_LIBRARY_EDITOR_H #ifdef TOOLS_ENABLED -#include "editor/project_settings_editor.h" #include "editor/editor_file_system.h" +#include "editor/project_settings_editor.h" -class GDNativeLibraryEditor : public VBoxContainer -{ +class GDNativeLibraryEditor : public VBoxContainer { Tree *libraries; bool updating; void _update_libraries(); - void _find_gdnative_singletons(EditorFileSystemDirectory *p_dir,const Set<String>& enabled_list); + void _find_gdnative_singletons(EditorFileSystemDirectory *p_dir, const Set<String> &enabled_list); void _item_edited(); -protected: +protected: void _notification(int p_what); static void _bind_methods(); + public: GDNativeLibraryEditor(); }; diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index dc0da5021d..997c342045 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -99,7 +99,6 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) { void actual_discoverer_handler() { EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem(); - Set<String> file_paths = get_gdnative_singletons(dir); Array files; @@ -118,11 +117,10 @@ GDNativeSingletonDiscover *discoverer = NULL; static void editor_init_callback() { - GDNativeLibraryEditor *library_editor = memnew( GDNativeLibraryEditor ); + GDNativeLibraryEditor *library_editor = memnew(GDNativeLibraryEditor); library_editor->set_name(TTR("GDNative")); ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(library_editor); - discoverer = memnew(GDNativeSingletonDiscover); EditorFileSystem::get_singleton()->connect("filesystem_changed", discoverer, "get_class"); } diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 2c8796820e..972be5f5a4 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -1175,6 +1175,65 @@ void VisualScriptBuiltinFunc::_bind_methods() { cc += func_name[i]; } ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, cc), "set_func", "get_func"); + + BIND_ENUM_CONSTANT(MATH_SIN); + BIND_ENUM_CONSTANT(MATH_COS); + BIND_ENUM_CONSTANT(MATH_TAN); + BIND_ENUM_CONSTANT(MATH_SINH); + BIND_ENUM_CONSTANT(MATH_COSH); + BIND_ENUM_CONSTANT(MATH_TANH); + BIND_ENUM_CONSTANT(MATH_ASIN); + BIND_ENUM_CONSTANT(MATH_ACOS); + BIND_ENUM_CONSTANT(MATH_ATAN); + BIND_ENUM_CONSTANT(MATH_ATAN2); + BIND_ENUM_CONSTANT(MATH_SQRT); + BIND_ENUM_CONSTANT(MATH_FMOD); + BIND_ENUM_CONSTANT(MATH_FPOSMOD); + BIND_ENUM_CONSTANT(MATH_FLOOR); + BIND_ENUM_CONSTANT(MATH_CEIL); + BIND_ENUM_CONSTANT(MATH_ROUND); + BIND_ENUM_CONSTANT(MATH_ABS); + BIND_ENUM_CONSTANT(MATH_SIGN); + BIND_ENUM_CONSTANT(MATH_POW); + BIND_ENUM_CONSTANT(MATH_LOG); + BIND_ENUM_CONSTANT(MATH_EXP); + BIND_ENUM_CONSTANT(MATH_ISNAN); + BIND_ENUM_CONSTANT(MATH_ISINF); + BIND_ENUM_CONSTANT(MATH_EASE); + BIND_ENUM_CONSTANT(MATH_DECIMALS); + BIND_ENUM_CONSTANT(MATH_STEPIFY); + BIND_ENUM_CONSTANT(MATH_LERP); + BIND_ENUM_CONSTANT(MATH_DECTIME); + BIND_ENUM_CONSTANT(MATH_RANDOMIZE); + BIND_ENUM_CONSTANT(MATH_RAND); + BIND_ENUM_CONSTANT(MATH_RANDF); + BIND_ENUM_CONSTANT(MATH_RANDOM); + BIND_ENUM_CONSTANT(MATH_SEED); + BIND_ENUM_CONSTANT(MATH_RANDSEED); + BIND_ENUM_CONSTANT(MATH_DEG2RAD); + BIND_ENUM_CONSTANT(MATH_RAD2DEG); + BIND_ENUM_CONSTANT(MATH_LINEAR2DB); + BIND_ENUM_CONSTANT(MATH_DB2LINEAR); + BIND_ENUM_CONSTANT(LOGIC_MAX); + BIND_ENUM_CONSTANT(LOGIC_MIN); + BIND_ENUM_CONSTANT(LOGIC_CLAMP); + BIND_ENUM_CONSTANT(LOGIC_NEAREST_PO2); + BIND_ENUM_CONSTANT(OBJ_WEAKREF); + BIND_ENUM_CONSTANT(FUNC_FUNCREF); + BIND_ENUM_CONSTANT(TYPE_CONVERT); + BIND_ENUM_CONSTANT(TYPE_OF); + BIND_ENUM_CONSTANT(TYPE_EXISTS); + BIND_ENUM_CONSTANT(TEXT_CHAR); + BIND_ENUM_CONSTANT(TEXT_STR); + BIND_ENUM_CONSTANT(TEXT_PRINT); + BIND_ENUM_CONSTANT(TEXT_PRINTERR); + BIND_ENUM_CONSTANT(TEXT_PRINTRAW); + BIND_ENUM_CONSTANT(VAR_TO_STR); + BIND_ENUM_CONSTANT(STR_TO_VAR); + BIND_ENUM_CONSTANT(VAR_TO_BYTES); + BIND_ENUM_CONSTANT(BYTES_TO_VAR); + BIND_ENUM_CONSTANT(COLORN); + BIND_ENUM_CONSTANT(FUNC_MAX); } VisualScriptBuiltinFunc::VisualScriptBuiltinFunc() { diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 5fcc5b0ad9..267946750f 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -748,6 +748,13 @@ void VisualScriptFunctionCall::_bind_methods() { BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH); BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE); BIND_ENUM_CONSTANT(CALL_MODE_BASIC_TYPE); + BIND_ENUM_CONSTANT(CALL_MODE_SINGLETON); + + BIND_ENUM_CONSTANT(RPC_DISABLED); + BIND_ENUM_CONSTANT(RPC_RELIABLE); + BIND_ENUM_CONSTANT(RPC_UNRELIABLE); + BIND_ENUM_CONSTANT(RPC_RELIABLE_TO_ID); + BIND_ENUM_CONSTANT(RPC_UNRELIABLE_TO_ID); } class VisualScriptNodeInstanceFunctionCall : public VisualScriptNodeInstance { @@ -1487,6 +1494,19 @@ void VisualScriptPropertySet::_bind_methods() { BIND_ENUM_CONSTANT(CALL_MODE_SELF); BIND_ENUM_CONSTANT(CALL_MODE_NODE_PATH); BIND_ENUM_CONSTANT(CALL_MODE_INSTANCE); + BIND_ENUM_CONSTANT(CALL_MODE_BASIC_TYPE); + + BIND_ENUM_CONSTANT(ASSIGN_OP_NONE); + BIND_ENUM_CONSTANT(ASSIGN_OP_ADD); + BIND_ENUM_CONSTANT(ASSIGN_OP_SUB); + BIND_ENUM_CONSTANT(ASSIGN_OP_MUL); + BIND_ENUM_CONSTANT(ASSIGN_OP_DIV); + BIND_ENUM_CONSTANT(ASSIGN_OP_MOD); + BIND_ENUM_CONSTANT(ASSIGN_OP_SHIFT_LEFT); + BIND_ENUM_CONSTANT(ASSIGN_OP_SHIFT_RIGHT); + BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_AND); + BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_OR); + BIND_ENUM_CONSTANT(ASSIGN_OP_BIT_XOR); } class VisualScriptNodeInstancePropertySet : public VisualScriptNodeInstance { diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 39f23fcf50..b617c11bab 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1882,6 +1882,16 @@ void VisualScriptMathConstant::_bind_methods() { cc += const_name[i]; } ADD_PROPERTY(PropertyInfo(Variant::INT, "constant", PROPERTY_HINT_ENUM, cc), "set_math_constant", "get_math_constant"); + + BIND_ENUM_CONSTANT(MATH_CONSTANT_ONE); + BIND_ENUM_CONSTANT(MATH_CONSTANT_PI); + BIND_ENUM_CONSTANT(MATH_CONSTANT_2PI); + BIND_ENUM_CONSTANT(MATH_CONSTANT_HALF_PI); + BIND_ENUM_CONSTANT(MATH_CONSTANT_E); + BIND_ENUM_CONSTANT(MATH_CONSTANT_SQRT2); + BIND_ENUM_CONSTANT(MATH_CONSTANT_INF); + BIND_ENUM_CONSTANT(MATH_CONSTANT_NAN); + BIND_ENUM_CONSTANT(MATH_CONSTANT_MAX); } VisualScriptMathConstant::VisualScriptMathConstant() { @@ -3535,6 +3545,11 @@ void VisualScriptInputAction::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action_name", "get_action_name"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Pressed,Released,JustPressed,JustReleased"), "set_action_mode", "get_action_mode"); + + BIND_ENUM_CONSTANT(MODE_PRESSED); + BIND_ENUM_CONSTANT(MODE_RELEASED); + BIND_ENUM_CONSTANT(MODE_JUST_PRESSED); + BIND_ENUM_CONSTANT(MODE_JUST_RELEASED); } VisualScriptInputAction::VisualScriptInputAction() { |