diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-14 20:53:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-14 20:53:15 +0200 |
commit | f90047f1583cdb8f4d7346a626b4992406761331 (patch) | |
tree | 69155a28d9ff5e90258d16766de78e36dc4b40cf /editor/plugins/skeleton_3d_editor_plugin.h | |
parent | 472ff40f7104873ffbd4d98c96e5415107923001 (diff) | |
parent | 8e9897b6dee2c46c9376a13fe82b39c347ab0547 (diff) |
Merge pull request #53786 from TokageItLab/fix-skeleton-editor-methods
Diffstat (limited to 'editor/plugins/skeleton_3d_editor_plugin.h')
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.h | 60 |
1 files changed, 16 insertions, 44 deletions
diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h index 2c21aab739..3b4dd362fb 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.h +++ b/editor/plugins/skeleton_3d_editor_plugin.h @@ -52,21 +52,22 @@ class BoneTransformEditor : public VBoxContainer { EditorInspectorSection *section = nullptr; - EditorPropertyVector3 *translation_property = nullptr; - EditorPropertyVector3 *rotation_property = nullptr; + EditorPropertyCheck *enabled_checkbox = nullptr; + EditorPropertyVector3 *position_property = nullptr; + EditorPropertyQuaternion *rotation_property = nullptr; EditorPropertyVector3 *scale_property = nullptr; - EditorInspectorSection *transform_section = nullptr; - EditorPropertyTransform3D *transform_property = nullptr; + + EditorInspectorSection *rest_section = nullptr; + EditorPropertyTransform3D *rest_matrix = nullptr; Rect2 background_rects[5]; Skeleton3D *skeleton; - String property; + // String property; UndoRedo *undo_redo; - Button *key_button = nullptr; - CheckBox *enabled_checkbox = nullptr; + // Button *key_button = nullptr; bool keyable = false; bool toggle_enabled = false; @@ -76,20 +77,7 @@ class BoneTransformEditor : public VBoxContainer { void create_editors(); - // Called when one of the EditorSpinSliders are changed. - void _value_changed(const double p_value); - // Called when the one of the EditorPropertyVector3 are updated. - void _value_changed_vector3(const String p_property_name, const Vector3 p_vector, const StringName p_edited_property_name, const bool p_boolean); - // Called when the transform_property is updated. - void _value_changed_transform(const String p_property_name, const Transform3D p_transform, const StringName p_edited_property_name, const bool p_boolean); - // Changes the transform to the given transform and updates the UI accordingly. - void _change_transform(Transform3D p_new_transform); - // Update it is truely keyable then. - void _update_key_button(const bool p_keyable); - // Creates a Transform using the EditorPropertyVector3 properties. - Transform3D compute_transform_from_vector3s() const; - - void update_enabled_checkbox(); + void _value_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing); protected: void _notification(int p_what); @@ -102,23 +90,6 @@ public: void set_label(const String &p_label) { label = p_label; } void _update_properties(); - void _update_transform_properties(Transform3D p_transform); - - // Transform can be keyed, whether or not to show the button. - void set_keyable(const bool p_keyable); - - // When rest mode, pose editor are diasbled. - void set_properties_read_only(const bool p_readonly); - void set_transform_read_only(const bool p_readonly); - - // Bone can be toggled enabled or disabled, whether or not to show the checkbox. - void set_toggle_enabled(const bool p_enabled); - - // Key Transform Button pressed. - void _key_button_pressed(); - - // Bone Enabled Checkbox toggled. - void _checkbox_pressed(); }; class Skeleton3DEditor : public VBoxContainer { @@ -197,13 +168,12 @@ class Skeleton3DEditor : public VBoxContainer { Ref<ShaderMaterial> handle_material; Ref<Shader> handle_shader; - Transform3D bone_original; - - void _update_pose_enabled(int p_bone = -1); - void _update_show_rest_only(); + Vector3 bone_original_position; + Quaternion bone_original_rotation; + Vector3 bone_original_scale; - void _update_gizmo_transform(); void _update_gizmo_visible(); + void _bone_enabled_changed(const int p_bone_id); void _hide_handles(); @@ -237,7 +207,9 @@ public: bool is_edit_mode() const { return edit_mode; } void update_bone_original(); - Transform3D get_bone_original() { return bone_original; }; + Vector3 get_bone_original_position() const { return bone_original_position; }; + Quaternion get_bone_original_rotation() const { return bone_original_rotation; }; + Vector3 get_bone_original_scale() const { return bone_original_scale; }; Skeleton3DEditor(EditorInspectorPluginSkeleton *e_plugin, EditorNode *p_editor, Skeleton3D *skeleton); ~Skeleton3DEditor(); |