From 3cbdd9cfa18cddfdd0efa75fb4057950b64b0220 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 11 Aug 2022 10:59:22 +0200 Subject: [PATCH] Removed Module prefix / infix from the skeleton editor's classes. Also now the module only has one EditorPlugin. --- modules/skeleton_editor/SCsub | 1 - modules/skeleton_editor/register_types.cpp | 5 +- .../skeleton_editor_module_plugin.cpp | 35 -------- .../skeleton_editor_module_plugin.h | 42 ---------- .../skeleton_editor_plugin.cpp | 84 ++++++++++--------- .../skeleton_editor/skeleton_editor_plugin.h | 39 +++++---- .../skeleton_editor/spatial_editor_gizmos.cpp | 10 +-- .../skeleton_editor/spatial_editor_gizmos.h | 6 +- 8 files changed, 76 insertions(+), 146 deletions(-) delete mode 100644 modules/skeleton_editor/skeleton_editor_module_plugin.cpp delete mode 100644 modules/skeleton_editor/skeleton_editor_module_plugin.h diff --git a/modules/skeleton_editor/SCsub b/modules/skeleton_editor/SCsub index 4cd534945..c587a40f6 100644 --- a/modules/skeleton_editor/SCsub +++ b/modules/skeleton_editor/SCsub @@ -5,5 +5,4 @@ env.add_source_files(env.modules_sources,"register_types.cpp") if env["tools"]: env.add_source_files(env.modules_sources, "skeleton_editor_plugin.cpp") env.add_source_files(env.modules_sources, "spatial_editor_gizmos.cpp") - env.add_source_files(env.modules_sources, "skeleton_editor_module_plugin.cpp") diff --git a/modules/skeleton_editor/register_types.cpp b/modules/skeleton_editor/register_types.cpp index e66395fa6..f8b8b8e72 100644 --- a/modules/skeleton_editor/register_types.cpp +++ b/modules/skeleton_editor/register_types.cpp @@ -23,16 +23,13 @@ SOFTWARE. #include "register_types.h" #ifdef TOOLS_ENABLED -#include "skeleton_editor_module_plugin.h" #include "skeleton_editor_plugin.h" #include "spatial_editor_gizmos.h" #endif void register_skeleton_editor_types() { #ifdef TOOLS_ENABLED - EditorPlugins::add_by_type(); - - EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); #endif } diff --git a/modules/skeleton_editor/skeleton_editor_module_plugin.cpp b/modules/skeleton_editor/skeleton_editor_module_plugin.cpp deleted file mode 100644 index 78d017a33..000000000 --- a/modules/skeleton_editor/skeleton_editor_module_plugin.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (c) 2020 Péter Magyar - -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 "skeleton_editor_module_plugin.h" - -#include "scene/3d/skeleton.h" -#include "spatial_editor_gizmos.h" - -SkeletonEditorModulePlugin::SkeletonEditorModulePlugin(EditorNode *p_node) { -} - -void SkeletonEditorModulePlugin::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { - add_spatial_gizmo_plugin(Ref(memnew(ModuleSkeletonSpatialGizmoPlugin))); - } -} diff --git a/modules/skeleton_editor/skeleton_editor_module_plugin.h b/modules/skeleton_editor/skeleton_editor_module_plugin.h deleted file mode 100644 index 4a4d85021..000000000 --- a/modules/skeleton_editor/skeleton_editor_module_plugin.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef SKELETON_EDITOR_MODULE_PLUGIN_H -#define SKELETON_EDITOR_MODULE_PLUGIN_H -/* -Copyright (c) 2020 Péter Magyar - -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 "editor/editor_node.h" -#include "editor/editor_plugin.h" - -class SkeletonEditorModulePlugin : public EditorPlugin { - GDCLASS(SkeletonEditorModulePlugin, EditorPlugin); - -public: - bool has_main_screen() const { return false; } - - virtual String get_name() const { return "SkeletonEditorModulePlugin"; } - - SkeletonEditorModulePlugin(EditorNode *p_node); - -protected: - void _notification(int p_what); -}; - -#endif diff --git a/modules/skeleton_editor/skeleton_editor_plugin.cpp b/modules/skeleton_editor/skeleton_editor_plugin.cpp index b7b2a99d7..5f920ed86 100644 --- a/modules/skeleton_editor/skeleton_editor_plugin.cpp +++ b/modules/skeleton_editor/skeleton_editor_plugin.cpp @@ -55,6 +55,8 @@ #include "scene/resources/capsule_shape.h" #include "scene/resources/sphere_shape.h" +#include "spatial_editor_gizmos.h" + #define DISTANCE_DEFAULT 4 #define GIZMO_ARROW_SIZE 0.35 @@ -79,7 +81,7 @@ #define MIN_FOV 0.01 #define MAX_FOV 179 -void ModuleBoneTransformEditor::create_editors() { +void BoneTransformEditor::create_editors() { const Color section_color = get_color("prop_subsection", "Editor"); section = memnew(EditorInspectorSection); @@ -140,7 +142,7 @@ void ModuleBoneTransformEditor::create_editors() { transform_section->get_vbox()->add_child(transform_property); } -void ModuleBoneTransformEditor::_notification(int p_what) { +void BoneTransformEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { create_editors(); @@ -202,7 +204,7 @@ void ModuleBoneTransformEditor::_notification(int p_what) { } } -void ModuleBoneTransformEditor::_value_changed(const double p_value) { +void BoneTransformEditor::_value_changed(const double p_value) { if (updating) return; @@ -210,7 +212,7 @@ void ModuleBoneTransformEditor::_value_changed(const double p_value) { _change_transform(tform); } -void ModuleBoneTransformEditor::_value_changed_vector3(const String &p_property, const Variant &p_value, const String &p_field, bool p_changing) { +void BoneTransformEditor::_value_changed_vector3(const String &p_property, const Variant &p_value, const String &p_field, bool p_changing) { if (updating) { return; } @@ -219,7 +221,7 @@ void ModuleBoneTransformEditor::_value_changed_vector3(const String &p_property, _change_transform(tform); } -Transform ModuleBoneTransformEditor::compute_transform_from_vector3s() const { +Transform BoneTransformEditor::compute_transform_from_vector3s() const { // Convert rotation from degrees to radians. Vector3 prop_rotation = rotation_property->get_vector(); prop_rotation.x = Math::deg2rad(prop_rotation.x); @@ -231,7 +233,7 @@ Transform ModuleBoneTransformEditor::compute_transform_from_vector3s() const { translation_property->get_vector()); } -void ModuleBoneTransformEditor::_value_changed_transform(const String &p_property, const Variant &p_value, const String &p_field, bool p_changing) { +void BoneTransformEditor::_value_changed_transform(const String &p_property, const Variant &p_value, const String &p_field, bool p_changing) { if (updating) { return; } @@ -241,7 +243,7 @@ void ModuleBoneTransformEditor::_value_changed_transform(const String &p_propert _change_transform(transform); } -void ModuleBoneTransformEditor::_change_transform(Transform p_new_transform) { +void BoneTransformEditor::_change_transform(Transform p_new_transform) { if (property.get_slicec('/', 0) != "bones") { return; } @@ -265,7 +267,7 @@ void ModuleBoneTransformEditor::_change_transform(Transform p_new_transform) { } } -void ModuleBoneTransformEditor::update_enabled_checkbox() { +void BoneTransformEditor::update_enabled_checkbox() { if (property == "") { return; } @@ -277,19 +279,19 @@ void ModuleBoneTransformEditor::update_enabled_checkbox() { } } -void ModuleBoneTransformEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_key_button_pressed"), &ModuleBoneTransformEditor::_key_button_pressed); - ClassDB::bind_method(D_METHOD("_checkbox_toggled", "toggled"), &ModuleBoneTransformEditor::_checkbox_toggled); +void BoneTransformEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("_key_button_pressed"), &BoneTransformEditor::_key_button_pressed); + ClassDB::bind_method(D_METHOD("_checkbox_toggled", "toggled"), &BoneTransformEditor::_checkbox_toggled); - ClassDB::bind_method(D_METHOD("_value_changed"), &ModuleBoneTransformEditor::_value_changed); - ClassDB::bind_method(D_METHOD("_value_changed_vector3"), &ModuleBoneTransformEditor::_value_changed_vector3); - ClassDB::bind_method(D_METHOD("_value_changed_transform"), &ModuleBoneTransformEditor::_value_changed_transform); - ClassDB::bind_method(D_METHOD("_change_transform"), &ModuleBoneTransformEditor::_change_transform); + ClassDB::bind_method(D_METHOD("_value_changed"), &BoneTransformEditor::_value_changed); + ClassDB::bind_method(D_METHOD("_value_changed_vector3"), &BoneTransformEditor::_value_changed_vector3); + ClassDB::bind_method(D_METHOD("_value_changed_transform"), &BoneTransformEditor::_value_changed_transform); + ClassDB::bind_method(D_METHOD("_change_transform"), &BoneTransformEditor::_change_transform); - //ClassDB::bind_method(D_METHOD("update_joint_tree"), &ModuleBoneTransformEditor::update_joint_tree); + //ClassDB::bind_method(D_METHOD("update_joint_tree"), &BoneTransformEditor::update_joint_tree); } -void ModuleBoneTransformEditor::_update_properties() { +void BoneTransformEditor::_update_properties() { if (updating) return; @@ -302,7 +304,7 @@ void ModuleBoneTransformEditor::_update_properties() { _update_transform_properties(tform); } -void ModuleBoneTransformEditor::_update_custom_pose_properties() { +void BoneTransformEditor::_update_custom_pose_properties() { if (updating) return; @@ -321,7 +323,7 @@ void ModuleBoneTransformEditor::_update_custom_pose_properties() { _update_transform_properties(tform); } -void ModuleBoneTransformEditor::_update_transform_properties(Transform tform) { +void BoneTransformEditor::_update_transform_properties(Transform tform) { Basis rotation_basis = tform.get_basis(); Vector3 rotation_radians = rotation_basis.get_rotation_euler(); Vector3 rotation_degrees = Vector3(Math::rad2deg(rotation_radians.x), Math::rad2deg(rotation_radians.y), Math::rad2deg(rotation_radians.z)); @@ -337,7 +339,7 @@ void ModuleBoneTransformEditor::_update_transform_properties(Transform tform) { updating = false; } -ModuleBoneTransformEditor::ModuleBoneTransformEditor(Skeleton *p_skeleton) : +BoneTransformEditor::BoneTransformEditor(Skeleton *p_skeleton) : skeleton(p_skeleton), key_button(nullptr), enabled_checkbox(nullptr), @@ -347,25 +349,25 @@ ModuleBoneTransformEditor::ModuleBoneTransformEditor(Skeleton *p_skeleton) : undo_redo = EditorNode::get_undo_redo(); } -void ModuleBoneTransformEditor::set_target(const String &p_prop) { +void BoneTransformEditor::set_target(const String &p_prop) { property = p_prop; } -void ModuleBoneTransformEditor::set_keyable(const bool p_keyable) { +void BoneTransformEditor::set_keyable(const bool p_keyable) { keyable = p_keyable; if (key_button) { key_button->set_visible(p_keyable); } } -void ModuleBoneTransformEditor::set_toggle_enabled(const bool p_enabled) { +void BoneTransformEditor::set_toggle_enabled(const bool p_enabled) { toggle_enabled = p_enabled; if (enabled_checkbox) { enabled_checkbox->set_visible(p_enabled); } } -void ModuleBoneTransformEditor::_key_button_pressed() { +void BoneTransformEditor::_key_button_pressed() { if (skeleton == nullptr) return; @@ -381,7 +383,7 @@ void ModuleBoneTransformEditor::_key_button_pressed() { AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_transform_key(skeleton, name, tform); } -void ModuleBoneTransformEditor::_checkbox_toggled(const bool p_toggled) { +void BoneTransformEditor::_checkbox_toggled(const bool p_toggled) { if (enabled_checkbox) { const String path = "bones/" + property.get_slicec('/', 1) + "/enabled"; skeleton->set(path, p_toggled); @@ -864,19 +866,19 @@ void ModuleSkeletonEditor::create_editors() { joint_tree->set_drag_forwarding(this); s_con->add_child(joint_tree); - pose_editor = memnew(ModuleBoneTransformEditor(skeleton)); + pose_editor = memnew(BoneTransformEditor(skeleton)); pose_editor->set_label(TTR("Bone Pose")); pose_editor->set_keyable(AnimationPlayerEditor::get_singleton()->get_track_editor()->has_keying()); // pose_editor->set_toggle_enabled(true); pose_editor->set_visible(false); add_child(pose_editor); - rest_editor = memnew(ModuleBoneTransformEditor(skeleton)); + rest_editor = memnew(BoneTransformEditor(skeleton)); rest_editor->set_label(TTR("Bone Rest")); rest_editor->set_visible(false); add_child(rest_editor); - custom_pose_editor = memnew(ModuleBoneTransformEditor(skeleton)); + custom_pose_editor = memnew(BoneTransformEditor(skeleton)); custom_pose_editor->set_label(TTR("Bone Custom Pose")); custom_pose_editor->set_visible(false); add_child(custom_pose_editor); @@ -982,7 +984,7 @@ void ModuleSkeletonEditor::rest_mode_toggled(const bool pressed) { // Prevent that bone pose will be undo during rest mode. // However ModuleSkeletonEditor will be memdeleted, // so it need to record in SpatialEditor with calling method in - // ModuleEditorInspectorPluginSkeleton and it will not be memdeleted. + // EditorInspectorPluginSkeleton and it will not be memdeleted. UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Toggled Rest Mode")); set_rest_mode_toggled(pressed); @@ -1005,7 +1007,7 @@ void ModuleSkeletonEditor::set_rest_mode_toggled(const bool pressed) { set_keyable(AnimationPlayerEditor::get_singleton()->get_track_editor()->has_keying() && !rest_mode); } -ModuleSkeletonEditor::ModuleSkeletonEditor(ModuleEditorInspectorPluginSkeleton *e_plugin, EditorNode *p_editor, Skeleton *p_skeleton) : +ModuleSkeletonEditor::ModuleSkeletonEditor(EditorInspectorPluginSkeleton *e_plugin, EditorNode *p_editor, Skeleton *p_skeleton) : editor(p_editor), editor_plugin(e_plugin), skeleton(p_skeleton) { @@ -1595,15 +1597,15 @@ void ModuleSkeletonEditor::_bind_tool_popup_methods() { ClassDB::bind_method(D_METHOD("_rename_bone_callback"), &ModuleSkeletonEditor::_rename_bone_callback); } -void ModuleEditorInspectorPluginSkeleton::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_rest_mode_toggled"), &ModuleEditorInspectorPluginSkeleton::set_rest_mode_toggled); +void EditorInspectorPluginSkeleton::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_rest_mode_toggled"), &EditorInspectorPluginSkeleton::set_rest_mode_toggled); } -bool ModuleEditorInspectorPluginSkeleton::can_handle(Object *p_object) { +bool EditorInspectorPluginSkeleton::can_handle(Object *p_object) { return Object::cast_to(p_object) != nullptr; } -void ModuleEditorInspectorPluginSkeleton::parse_begin(Object *p_object) { +void EditorInspectorPluginSkeleton::parse_begin(Object *p_object) { Skeleton *skeleton = Object::cast_to(p_object); ERR_FAIL_COND(!skeleton); @@ -1611,25 +1613,31 @@ void ModuleEditorInspectorPluginSkeleton::parse_begin(Object *p_object) { add_custom_control(skel_editor); } -void ModuleEditorInspectorPluginSkeleton::set_rest_mode_toggled(const bool p_pressed) { +void EditorInspectorPluginSkeleton::set_rest_mode_toggled(const bool p_pressed) { if (SpatialEditor::get_singleton()->get_single_selected_node()->get_class() == "Skeleton" && skel_editor) { skel_editor->set_rest_mode_toggled(p_pressed); } } -ModuleSkeletonEditorPlugin::ModuleSkeletonEditorPlugin(EditorNode *p_node) { +SkeletonEditorPlugin::SkeletonEditorPlugin(EditorNode *p_node) { editor = p_node; - skeleton_plugin = memnew(ModuleEditorInspectorPluginSkeleton); + skeleton_plugin = memnew(EditorInspectorPluginSkeleton); skeleton_plugin->editor = editor; EditorInspector::add_inspector_plugin(skeleton_plugin); } -bool ModuleSkeletonEditorPlugin::handles(Object *p_object) const { +bool SkeletonEditorPlugin::handles(Object *p_object) const { return p_object->is_class("Skeleton"); } +void SkeletonEditorPlugin::_notification(int p_what) { + if (p_what == NOTIFICATION_ENTER_TREE) { + add_spatial_gizmo_plugin(Ref(memnew(SkeletonSpatialGizmoPlugin))); + } +} + void ModuleSkeletonEditor::_compute_edit(int p_index, const Point2 &p_point) { SpatialEditor *se = SpatialEditor::get_singleton(); SpatialEditorViewport *sev = se->get_editor_viewport(p_index); diff --git a/modules/skeleton_editor/skeleton_editor_plugin.h b/modules/skeleton_editor/skeleton_editor_plugin.h index cad475b53..34b409380 100644 --- a/modules/skeleton_editor/skeleton_editor_plugin.h +++ b/modules/skeleton_editor/skeleton_editor_plugin.h @@ -39,10 +39,10 @@ #include "scene/3d/mesh_instance.h" #include "scene/3d/skeleton.h" -class ModuleEditorInspectorPluginSkeleton; +class EditorInspectorPluginSkeleton; class Joint; class PhysicalBone; -class ModuleSkeletonEditorPlugin; +class SkeletonEditorPlugin; class Button; class CheckBox; class EditorSpinSlider; @@ -56,8 +56,8 @@ class VSeparator; class EditorPropertyTransform; class EditorPropertyVector3; -class ModuleBoneTransformEditor : public VBoxContainer { - GDCLASS(ModuleBoneTransformEditor, VBoxContainer); +class BoneTransformEditor : public VBoxContainer { + GDCLASS(BoneTransformEditor, VBoxContainer); EditorInspectorSection *section; @@ -103,7 +103,7 @@ protected: static void _bind_methods(); public: - ModuleBoneTransformEditor(Skeleton *p_skeleton); + BoneTransformEditor(Skeleton *p_skeleton); // Which transform target to modify void set_target(const String &p_prop); @@ -129,7 +129,7 @@ public: class ModuleSkeletonEditor : public VBoxContainer { GDCLASS(ModuleSkeletonEditor, VBoxContainer); - friend class ModuleSkeletonEditorPlugin; + friend class SkeletonEditorPlugin; enum Menu { MENU_OPTION_INIT_POSE, @@ -168,14 +168,14 @@ class ModuleSkeletonEditor : public VBoxContainer { }; EditorNode *editor; - ModuleEditorInspectorPluginSkeleton *editor_plugin; + EditorInspectorPluginSkeleton *editor_plugin; Skeleton *skeleton; Tree *joint_tree; - ModuleBoneTransformEditor *rest_editor; - ModuleBoneTransformEditor *pose_editor; - ModuleBoneTransformEditor *custom_pose_editor; + BoneTransformEditor *rest_editor; + BoneTransformEditor *pose_editor; + BoneTransformEditor *custom_pose_editor; VSeparator *separators[2]; MenuButton *options; @@ -251,7 +251,7 @@ public: void _update_properties(); - ModuleSkeletonEditor(ModuleEditorInspectorPluginSkeleton *e_plugin, EditorNode *p_editor, Skeleton *skeleton); + ModuleSkeletonEditor(EditorInspectorPluginSkeleton *e_plugin, EditorNode *p_editor, Skeleton *skeleton); ~ModuleSkeletonEditor(); void add_bone(); @@ -272,10 +272,10 @@ public: ConfirmationDialog *_bone_remove_dialog; }; -class ModuleEditorInspectorPluginSkeleton : public EditorInspectorPlugin { - GDCLASS(ModuleEditorInspectorPluginSkeleton, EditorInspectorPlugin); +class EditorInspectorPluginSkeleton : public EditorInspectorPlugin { + GDCLASS(EditorInspectorPluginSkeleton, EditorInspectorPlugin); - friend class ModuleSkeletonEditorPlugin; + friend class SkeletonEditorPlugin; ModuleSkeletonEditor *skel_editor; EditorNode *editor; @@ -293,10 +293,10 @@ public: UndoRedo *get_undo_redo() { return undo_redo; } }; -class ModuleSkeletonEditorPlugin : public EditorPlugin { - GDCLASS(ModuleSkeletonEditorPlugin, EditorPlugin); +class SkeletonEditorPlugin : public EditorPlugin { + GDCLASS(SkeletonEditorPlugin, EditorPlugin); - ModuleEditorInspectorPluginSkeleton *skeleton_plugin; + EditorInspectorPluginSkeleton *skeleton_plugin; EditorNode *editor; public: @@ -311,7 +311,10 @@ public: virtual String get_name() const { return "Skeleton"; } - ModuleSkeletonEditorPlugin(EditorNode *p_node); + SkeletonEditorPlugin(EditorNode *p_node); + +protected: + void _notification(int p_what); }; #endif // SKELETON_EDITOR_PLUGIN_H diff --git a/modules/skeleton_editor/spatial_editor_gizmos.cpp b/modules/skeleton_editor/spatial_editor_gizmos.cpp index 93c544cbc..b38af0e50 100644 --- a/modules/skeleton_editor/spatial_editor_gizmos.cpp +++ b/modules/skeleton_editor/spatial_editor_gizmos.cpp @@ -35,7 +35,7 @@ #include "scene/resources/skin.h" #include "scene/resources/surface_tool.h" -ModuleSkeletonSpatialGizmoPlugin::ModuleSkeletonSpatialGizmoPlugin() { +SkeletonSpatialGizmoPlugin::SkeletonSpatialGizmoPlugin() { skeleton_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/skeleton", Color(1, 0.8, 0.4)); selected_bone_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/selected_bone", Color(1, 0, 0)); bone_axis_length = EDITOR_DEF("editors/3d_gizmos/gizmo_settings/bone_axis_length", (float)0.015); @@ -67,19 +67,19 @@ ModuleSkeletonSpatialGizmoPlugin::ModuleSkeletonSpatialGizmoPlugin() { selected_mat->set_shader(selected_sh); } -bool ModuleSkeletonSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) { +bool SkeletonSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) { return Object::cast_to(p_spatial) != NULL; } -String ModuleSkeletonSpatialGizmoPlugin::get_gizmo_name() const { +String SkeletonSpatialGizmoPlugin::get_gizmo_name() const { return "Skeleton"; } -int ModuleSkeletonSpatialGizmoPlugin::get_priority() const { +int SkeletonSpatialGizmoPlugin::get_priority() const { return -1; } -void ModuleSkeletonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { +void SkeletonSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { Skeleton *skel = Object::cast_to(p_gizmo->get_spatial_node()); skel->force_update_all_bone_transforms(); diff --git a/modules/skeleton_editor/spatial_editor_gizmos.h b/modules/skeleton_editor/spatial_editor_gizmos.h index dcfce3767..59b26daeb 100644 --- a/modules/skeleton_editor/spatial_editor_gizmos.h +++ b/modules/skeleton_editor/spatial_editor_gizmos.h @@ -36,8 +36,8 @@ class Camera; -class ModuleSkeletonSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { - GDCLASS(ModuleSkeletonSpatialGizmoPlugin, EditorSpatialGizmoPlugin); +class SkeletonSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { + GDCLASS(SkeletonSpatialGizmoPlugin, EditorSpatialGizmoPlugin); Color skeleton_color = Color(1, 0.8, 0.4); Color selected_bone_color = Color(1, 0, 0); float bone_axis_length = 0.015; @@ -50,7 +50,7 @@ public: int get_priority() const; void redraw(EditorSpatialGizmo *p_gizmo); - ModuleSkeletonSpatialGizmoPlugin(); + SkeletonSpatialGizmoPlugin(); }; #endif // SPATIAL_EDITOR_GIZMOS_H