mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-10 12:59:40 +01:00
Removed Module prefix / infix from the skeleton editor's classes. Also now the module only has one EditorPlugin.
This commit is contained in:
parent
b6eb2db442
commit
3cbdd9cfa1
@ -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")
|
||||
|
||||
|
@ -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<SkeletonEditorModulePlugin>();
|
||||
|
||||
EditorPlugins::add_by_type<ModuleSkeletonEditorPlugin>();
|
||||
EditorPlugins::add_by_type<SkeletonEditorPlugin>();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -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<ModuleSkeletonSpatialGizmoPlugin>(memnew(ModuleSkeletonSpatialGizmoPlugin)));
|
||||
}
|
||||
}
|
@ -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
|
@ -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<Skeleton>(p_object) != nullptr;
|
||||
}
|
||||
|
||||
void ModuleEditorInspectorPluginSkeleton::parse_begin(Object *p_object) {
|
||||
void EditorInspectorPluginSkeleton::parse_begin(Object *p_object) {
|
||||
Skeleton *skeleton = Object::cast_to<Skeleton>(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<SkeletonSpatialGizmoPlugin>(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);
|
||||
|
@ -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
|
||||
|
@ -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<Skeleton>(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<Skeleton>(p_gizmo->get_spatial_node());
|
||||
|
||||
skel->force_update_all_bone_transforms();
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user