Godot Engine – Multi-platform 2D and 3D game engine
Add skin_scale property to Bone in Skeleton3D
Silc Lizard (Tokage) Renewa5a337876c81
diff --git a/doc/classes/BoneSpreader3D.xml b/doc/classes/BoneSpreader3D.xmlnew file mode 100644index 00000000000..fa2f992e206--- /dev/null+++ b/doc/classes/BoneSpreader3D.xml@@ -0,0 +1,90 @@+<?xml version="1.0" encoding="UTF-8" ?>+<class name="BoneSpreader3D" inherits="SkeletonModifier3D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">+ <brief_description>+ Inputs a scale and converts it to the position of a child bone.+ </brief_description>+ <description>+ Inputs a scale and converts it to the position of a child bone. Intended for use in combination with [method Skeleton3D.set_bone_skin_scale].+ This modifier repositions child bones to follow the skin transformation by [method Skeleton3D.set_bone_skin_scale] in cases when you want to adjust bone length using [method Skeleton3D.set_bone_skin_scale] or when the bone has multiple child bones.+ </description>+ <tutorials>+ </tutorials>+ <methods>+ <method name="clear_setting">+ <return type="void" />+ <description>+ Clears all settings.+ </description>+ </method>+ <method name="get_bone" qualifiers="const">+ <return type="int" />+ <param index="0" name="index" type="int" />+ <description>+ Returns the scaled bone of the setting at [param index].+ </description>+ </method>+ <method name="get_bone_name" qualifiers="const">+ <return type="StringName" />+ <param index="0" name="index" type="int" />+ <description>+ Returns the scaled bone name of the setting at [param index].+ </description>+ </method>+ <method name="get_bone_scale" qualifiers="const">+ <return type="Vector3" />+ <param index="0" name="index" type="int" />+ <description>+ Returns the scale of the setting at [param index].+ </description>+ </method>+ <method name="is_using_bone_skin_scale" qualifiers="const">+ <return type="bool" />+ <param index="0" name="index" type="int" />+ <description>+ Returns whether to use the [code]skin_scale[/code] property of a [Skeleton3D]'s bone of the setting at [param index].+ </description>+ </method>+ <method name="set_bone">+ <return type="void" />+ <param index="0" name="index" type="int" />+ <param index="1" name="bone" type="int" />+ <description>+ Sets the scaled bone of the setting at [param index].+ </description>+ </method>+ <method name="set_bone_name">+ <return type="void" />+ <param index="0" name="index" type="int" />+ <param index="1" name="bone_name" type="StringName" />+ <description>+ Sets the scaled bone name of the setting at [param index].+ </description>+ </method>+ <method name="set_bone_scale">+ <return type="void" />+ <param index="0" name="index" type="int" />+ <param index="1" name="scale" type="Vector3" />+ <description>+ When [method is_using_bone_skin_scale] returns [code]false[/code], sets the scale of the setting at [param index].+ [b]Note:[/b] The [param scale] value is recommended to be non-zero.+ </description>+ </method>+ <method name="set_use_bone_skin_scale">+ <return type="void" />+ <param index="0" name="index" type="int" />+ <param index="1" name="enabled" type="bool" />+ <description>+ Sets whether to use the [code]skin_scale[/code] property of a [Skeleton3D]'s bone of the setting at [param index].+ </description>+ </method>+ </methods>+ <members>+ <member name="setting_size" type="int" setter="set_setting_size" getter="get_setting_size">+ The number of settings in the modifier.+ </member>+ <member name="use_bone_skin_scale_for_all_bones" type="bool" setter="set_use_bone_skin_scale_for_all_bones" getter="are_all_bones_using_bone_skin_scale" default="true">+ If [code]true[/code], this modifier processes all bones for which [method Skeleton3D.get_bone_skin_scale] is not [code]Vector3(1, 1, 1)[/code].+ If [code]false[/code], this modifier allows you to configure whether to process bone skin scaling individually in the settings.+ </member>+ </members>+</class>diff --git a/doc/classes/Skeleton3D.xml b/doc/classes/Skeleton3D.xmlindex c6c8754455e..e2dee5457c3 100644--- a/doc/classes/Skeleton3D.xml+++ b/doc/classes/Skeleton3D.xml@@ -173,6 +173,13 @@Returns the rest transform for a bone [param bone_idx].</description></method>+ <method name="get_bone_skin_scale" qualifiers="const">+ <return type="Vector3" />+ <param index="0" name="bone_idx" type="int" />+ <description>+ Returns the skin scale of the bone at [param bone_idx].+ </description>+ </method><method name="get_concatenated_bone_names" qualifiers="const"><return type="StringName" /><description>@@ -255,12 +262,14 @@<method name="reset_bone_pose"><return type="void" /><param index="0" name="bone_idx" type="int" />+ <param index="1" name="reset_bone_skin_scale" type="bool" default="false" /><description>Sets the bone pose to rest for [param bone_idx].</description></method><method name="reset_bone_poses"><return type="void" />+ <param index="0" name="reset_bone_skin_scale" type="bool" default="false" /><description>Sets all bone poses to rests.</description>@@ -360,6 +369,16 @@Sets the rest transform for bone [param bone_idx].</description></method>+ <method name="set_bone_skin_scale">+ <return type="void" />+ <param index="0" name="bone_idx" type="int" />+ <param index="1" name="skin_scale" type="Vector3" />+ <description>+ Sets the skin scale of the bone at [param bone_idx] to [param skin_scale]. This scale does not affect bone children. This is useful for modifying the visual thickness of a skin.+ Even if the skin is visually deformed, neither scaling nor repositioning of the bones occurs. This means that you may need to adjust the origin of the child bone to synchronize its joint position with the scaling by using [BoneSpreader3D].+ [b]Note:[/b] The skin scaling may corrupt the appearance of the gizmo for some SkeletonModifier classes, such as SpringBoneSimulator and IKModifier3D, which rely on bone lengths for skinning.+ </description>+ </method><method name="unparent_bone_and_rest"><return type="void" /><param index="0" name="bone_idx" type="int" />diff --git a/editor/icons/BoneSpreader3D.svg b/editor/icons/BoneSpreader3D.svgnew file mode 100644index 00000000000..6604c5fc1f0--- /dev/null+++ b/editor/icons/BoneSpreader3D.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-39.5 40.5 16 16"><g fill="#fc7f7f"><path d="M-36.023 43.793c.66-.327.929-1.126.603-1.785-.327-.66-1.126-.93-1.787-.603-.179.089-.335.217-.458.376-.683-.275-1.459.051-1.736.732s.052 1.461.733 1.736c.185.076.385.109.584.096l.704 2.629c-.658.326-.928 1.127-.601 1.785.328.658 1.126.928 1.787.603.18-.089.337-.219.459-.376.681.276 1.458-.051 1.735-.734.276-.682-.051-1.459-.733-1.735-.185-.075-.385-.108-.585-.096zM-35.668 54.729c.413.207.892.353 1.401.42v1.351h5.536v-1.352c1.871-.251 3.083-1.467 2.705-2.714-.377-1.248-2.199-2.054-4.069-1.806-.511.068-.991.214-1.406.423-1.522-.768-3.688-.568-4.84.448-1.151 1.017-.852 2.461.673 3.23zM-27.681 46.421c-.2-.013-.401.021-.585.096-.684.276-1.01 1.054-.734 1.735.277.684 1.055 1.011 1.736.734.122.157.279.287.459.376.66.325 1.459.056 1.787-.603.326-.658.057-1.459-.602-1.785l.703-2.629c.2.014.4-.02.585-.096.681-.275 1.01-1.055.733-1.736s-1.053-1.008-1.736-.732c-.123-.159-.279-.287-.458-.376-.661-.327-1.46-.058-1.787.603-.326.659-.058 1.458.603 1.785z"/><path d="m-28.026 44.342-.5-1.5c-.087-.261-.368-.404-.632-.316-.262.088-.403.371-.316.633l.207.62c-1.396-.69-3.068-.69-4.465 0l.207-.62c.087-.262-.054-.545-.316-.633-.265-.088-.545.056-.632.316l-.5 1.5c-.06.18-.013.378.121.512l1 1c.096.097.224.146.352.146s.256-.049.354-.146c.195-.195.195-.512 0-.707l-.355-.354c1.229-.708 2.774-.708 4.003 0l-.355.354c-.195.195-.195.512 0 .707.097.097.225.146.353.146s.256-.049.354-.146l1-1c.133-.134.18-.333.12-.512z"/></g></svg>diff --git a/editor/scene/3d/skeleton_3d_editor_plugin.cpp b/editor/scene/3d/skeleton_3d_editor_plugin.cppindex 9ea1051a4a6..97a07f4ef65 100644--- a/editor/scene/3d/skeleton_3d_editor_plugin.cpp+++ b/editor/scene/3d/skeleton_3d_editor_plugin.cpp@@ -121,6 +121,19 @@ void BonePropertiesEditor::create_editors() {rest_matrix->set_selectable(false);rest_section->get_vbox()->add_child(rest_matrix);+ // Skin section.+ skin_section = memnew(EditorInspectorSection);+ skin_section->setup("trf_properties_skin", "Skin", this, Color(0.0f, 0.0f, 0.0f), true);+ section->get_vbox()->add_child(skin_section);++ // Skin scale property.+ skin_scale_property = memnew(EditorPropertyVector3());+ skin_scale_property->setup(large_range_hint, true);+ skin_scale_property->set_label("Scale");+ skin_scale_property->set_selectable(false);+ skin_scale_property->connect("property_changed", callable_mp(this, &BonePropertiesEditor::_value_changed));+ skin_section->get_vbox()->add_child(skin_scale_property);+// Bone Metadata propertymeta_section = memnew(EditorInspectorSection);meta_section->setup("bone_meta", TTR("Bone Metadata"), this, Color(.0f, .0f, .0f), true);@@ -141,6 +154,7 @@ void BonePropertiesEditor::_notification(int p_what) {const Color section_color = get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor));section->set_bg_color(section_color);rest_section->set_bg_color(section_color);+ skin_section->set_bg_color(section_color);} break;}}@@ -260,6 +274,7 @@ void BonePropertiesEditor::set_skeleton(Skeleton3D *p_skeleton) {rotation_property->set_object_and_property(nullptr, String());scale_property->set_object_and_property(nullptr, String());rest_matrix->set_object_and_property(nullptr, String());+ skin_scale_property->set_object_and_property(nullptr, String());for (KeyValue<StringName, EditorProperty *> &E : meta_editors) {E.value->set_object_and_property(nullptr, String());@@ -281,6 +296,9 @@ void BonePropertiesEditor::set_target(const String &p_prop) {rest_matrix->set_object_and_property(skeleton, p_prop + "rest");rest_matrix->update_property();++ skin_scale_property->set_object_and_property(skeleton, p_prop + "skin_scale");+ skin_scale_property->update_property();}void BonePropertiesEditor::_property_keyed(const String &p_path, bool p_advance) {@@ -346,6 +364,12 @@ void BonePropertiesEditor::_update_properties() {rest_matrix->update_editor_property_status();rest_matrix->queue_redraw();}+ if (split[2] == "skin_scale") {+ skin_scale_property->set_read_only(E.usage & PROPERTY_USAGE_READ_ONLY);+ skin_scale_property->update_property();+ skin_scale_property->update_editor_property_status();+ skin_scale_property->queue_redraw();+ }if (split[2] == "bone_meta") {meta_seen.insert(E.name);if (!meta_editors.find(E.name)) {@@ -390,6 +414,7 @@ void Skeleton3DEditor::set_keyable(const bool p_keyable) {void Skeleton3DEditor::set_bone_options_enabled(const bool p_bone_options_enabled) {skeleton_options->get_popup()->set_item_disabled(SKELETON_OPTION_RESET_SELECTED_POSES, !p_bone_options_enabled);+ skeleton_options->get_popup()->set_item_disabled(SKELETON_OPTION_RESET_SELECTED_POSES_AND_SKIN_SCALES, !p_bone_options_enabled);skeleton_options->get_popup()->set_item_disabled(SKELETON_OPTION_SELECTED_POSES_TO_RESTS, !p_bone_options_enabled);}@@ -403,33 +428,33 @@ void Skeleton3DEditor::_on_click_skeleton_option(int p_skeleton_option) {switch (p_skeleton_option) {case SKELETON_OPTION_RESET_ALL_POSES: {- reset_pose(true);- break;- }+ reset_pose(true, false);+ } break;case SKELETON_OPTION_RESET_SELECTED_POSES: {- reset_pose(false);- break;- }+ reset_pose(false, false);+ } break;+ case SKELETON_OPTION_RESET_ALL_POSES_AND_SKIN_SCALES: {+ reset_pose(true, true);+ } break;+ case SKELETON_OPTION_RESET_SELECTED_POSES_AND_SKIN_SCALES: {+ reset_pose(false, true);+ } break;case SKELETON_OPTION_ALL_POSES_TO_RESTS: {pose_to_rest(true);- break;- }+ } break;case SKELETON_OPTION_SELECTED_POSES_TO_RESTS: {pose_to_rest(false);- break;- }+ } break;case SKELETON_OPTION_CREATE_PHYSICAL_SKELETON: {create_physical_skeleton();- break;- }+ } break;case SKELETON_OPTION_EXPORT_SKELETON_PROFILE: {export_skeleton_profile();- break;- }+ } break;}}-void Skeleton3DEditor::reset_pose(const bool p_all_bones) {+void Skeleton3DEditor::reset_pose(const bool p_all_bones, const bool p_reset_bone_skin_scale) {ERR_FAIL_COND(!skeleton);const int bone_count = skeleton->get_bone_count();@@ -444,8 +469,11 @@ void Skeleton3DEditor::reset_pose(const bool p_all_bones) {ur->add_undo_method(skeleton, "set_bone_pose_position", i, skeleton->get_bone_pose_position(i));ur->add_undo_method(skeleton, "set_bone_pose_rotation", i, skeleton->get_bone_pose_rotation(i));ur->add_undo_method(skeleton, "set_bone_pose_scale", i, skeleton->get_bone_pose_scale(i));+ if (p_reset_bone_skin_scale) {+ ur->add_undo_method(skeleton, "set_bone_skin_scale", i, skeleton->get_bone_skin_scale(i));+ }}- ur->add_do_method(skeleton, "reset_bone_poses");+ ur->add_do_method(skeleton, "reset_bone_poses", p_reset_bone_skin_scale);} else {// Todo: Do method with multiple bone selection.if (selected_bone == -1) {@@ -455,7 +483,10 @@ void Skeleton3DEditor::reset_pose(const bool p_all_bones) {ur->add_undo_method(skeleton, "set_bone_pose_position", selected_bone, skeleton->get_bone_pose_position(selected_bone));ur->add_undo_method(skeleton, "set_bone_pose_rotation", selected_bone, skeleton->get_bone_pose_rotation(selected_bone));ur->add_undo_method(skeleton, "set_bone_pose_scale", selected_bone, skeleton->get_bone_pose_scale(selected_bone));- ur->add_do_method(skeleton, "reset_bone_pose", selected_bone);+ if (p_reset_bone_skin_scale) {+ ur->add_undo_method(skeleton, "set_bone_skin_scale", selected_bone, skeleton->get_bone_skin_scale(selected_bone));+ }+ ur->add_do_method(skeleton, "reset_bone_pose", selected_bone, p_reset_bone_skin_scale);}ur->add_undo_method(this, "update_joint_tree");@@ -884,6 +915,7 @@ void Skeleton3DEditor::_joint_tree_button_clicked(Object *p_item, int p_column,String bone_rotation_property = tree_item_metadata + "/rotation";String bone_scale_property = tree_item_metadata + "/scale";String bone_rest_property = tree_item_metadata + "/rest";+ String bone_skin_scale_property = tree_item_metadata + "/skin_scale";Variant current_enabled = skeleton->get(bone_enabled_property);Variant current_parent = skeleton->get(bone_parent_property);@@ -892,6 +924,7 @@ void Skeleton3DEditor::_joint_tree_button_clicked(Object *p_item, int p_column,Variant current_rotation = skeleton->get(bone_rotation_property);Variant current_scale = skeleton->get(bone_scale_property);Variant current_rest = skeleton->get(bone_rest_property);+ Variant current_skin_scale = skeleton->get(bone_skin_scale_property);EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();ur->create_action(TTR("Revert Bone"));@@ -960,6 +993,15 @@ void Skeleton3DEditor::_joint_tree_button_clicked(Object *p_item, int p_column,ur->add_do_method(skeleton, "set", bone_rest_property, new_rest);}}+ bool can_revert_skin_scale = EditorPropertyRevert::can_property_revert(skeleton, bone_skin_scale_property, ¤t_skin_scale);+ if (can_revert_skin_scale) {+ bool is_valid = false;+ Variant new_skin_scale = EditorPropertyRevert::get_property_revert_value(skeleton, bone_skin_scale_property, &is_valid);+ if (is_valid) {+ ur->add_undo_method(skeleton, "set", bone_skin_scale_property, current_skin_scale);+ ur->add_do_method(skeleton, "set", bone_skin_scale_property, new_skin_scale);+ }+ }ur->add_undo_method(this, "update_all");ur->add_do_method(this, "update_all");@@ -1017,6 +1059,7 @@ void Skeleton3DEditor::update_joint_tree() {String bone_rotation_property = "bones/" + itos(current_bone_idx) + "/rotation";String bone_scale_property = "bones/" + itos(current_bone_idx) + "/scale";String bone_rest_property = "bones/" + itos(current_bone_idx) + "/rest";+ String bone_skin_scale_property = "bones/" + itos(current_bone_idx) + "/skin_scale";Variant current_enabled = skeleton->get(bone_enabled_property);Variant current_parent = skeleton->get(bone_parent_property);@@ -1025,6 +1068,7 @@ void Skeleton3DEditor::update_joint_tree() {Variant current_rotation = skeleton->get(bone_rotation_property);Variant current_scale = skeleton->get(bone_scale_property);Variant current_rest = skeleton->get(bone_rest_property);+ Variant current_skin_scale = skeleton->get(bone_skin_scale_property);bool can_revert_enabled = EditorPropertyRevert::can_property_revert(skeleton, bone_enabled_property, ¤t_enabled);bool can_revert_parent = EditorPropertyRevert::can_property_revert(skeleton, bone_parent_property, ¤t_parent);@@ -1033,8 +1077,9 @@ void Skeleton3DEditor::update_joint_tree() {bool can_revert_rotation = EditorPropertyRevert::can_property_revert(skeleton, bone_rotation_property, ¤t_rotation);bool can_revert_scale = EditorPropertyRevert::can_property_revert(skeleton, bone_scale_property, ¤t_scale);bool can_revert_rest = EditorPropertyRevert::can_property_revert(skeleton, bone_rest_property, ¤t_rest);+ bool can_revert_skin_scale = EditorPropertyRevert::can_property_revert(skeleton, bone_skin_scale_property, ¤t_skin_scale);- if (can_revert_enabled || can_revert_parent || can_revert_name || can_revert_position || can_revert_rotation || can_revert_scale || can_revert_rest) {+ if (can_revert_enabled || can_revert_parent || can_revert_name || can_revert_position || can_revert_rotation || can_revert_scale || can_revert_rest || can_revert_skin_scale) {joint_item->add_button(0, get_editor_theme_icon(SNAME("ReloadSmall")), JOINT_BUTTON_REVERT, false, TTR("Revert"));}@@ -1084,6 +1129,8 @@ void Skeleton3DEditor::create_editors() {PopupMenu *p = skeleton_options->get_popup();p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_all_poses", TTRC("Reset All Bone Poses")), SKELETON_OPTION_RESET_ALL_POSES);p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_selected_poses", TTRC("Reset Selected Poses")), SKELETON_OPTION_RESET_SELECTED_POSES);+ p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_all_poses_and_skin_scales", TTRC("Reset All Bone Poses & Skin Scales")), SKELETON_OPTION_RESET_ALL_POSES_AND_SKIN_SCALES);+ p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_selected_poses_and_skin_scales", TTRC("Reset Selected Poses & Skin Scales")), SKELETON_OPTION_RESET_SELECTED_POSES_AND_SKIN_SCALES);p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/all_poses_to_rests", TTRC("Apply All Poses to Rests")), SKELETON_OPTION_ALL_POSES_TO_RESTS);p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/selected_poses_to_rests", TTRC("Apply Selected Poses to Rests")), SKELETON_OPTION_SELECTED_POSES_TO_RESTS);p->add_item(TTR("Create Physical Skeleton"), SKELETON_OPTION_CREATE_PHYSICAL_SKELETON);diff --git a/editor/scene/3d/skeleton_3d_editor_plugin.h b/editor/scene/3d/skeleton_3d_editor_plugin.hindex 01a74316295..5927e8bb8c1 100644--- a/editor/scene/3d/skeleton_3d_editor_plugin.h+++ b/editor/scene/3d/skeleton_3d_editor_plugin.h@@ -63,11 +63,12 @@ class BonePropertiesEditor : public VBoxContainer {EditorInspectorSection *rest_section = nullptr;EditorPropertyTransform3D *rest_matrix = nullptr;+ EditorInspectorSection *skin_section = nullptr;+ EditorPropertyVector3 *skin_scale_property = nullptr;+EditorInspectorSection *meta_section = nullptr;AddMetadataDialog *add_meta_dialog = nullptr;- Rect2 background_rects[5];-Skeleton3D *skeleton = nullptr;// String property;@@ -114,6 +115,8 @@ class Skeleton3DEditor : public VBoxContainer {enum SkeletonOption {SKELETON_OPTION_RESET_ALL_POSES,SKELETON_OPTION_RESET_SELECTED_POSES,+ SKELETON_OPTION_RESET_ALL_POSES_AND_SKIN_SCALES,+ SKELETON_OPTION_RESET_SELECTED_POSES_AND_SKIN_SCALES,SKELETON_OPTION_ALL_POSES_TO_RESTS,SKELETON_OPTION_SELECTED_POSES_TO_RESTS,SKELETON_OPTION_CREATE_PHYSICAL_SKELETON,@@ -177,7 +180,7 @@ class Skeleton3DEditor : public VBoxContainer {void create_editors();- void reset_pose(const bool p_all_bones);+ void reset_pose(const bool p_all_bones, const bool p_reset_bone_skin_scale);void pose_to_rest(const bool p_all_bones);void _insert_keys(const bool p_all_bones);diff --git a/misc/extension_api_validation/4.7-stable/GH-120609.txt b/misc/extension_api_validation/4.7-stable/GH-120609.txtnew file mode 100644index 00000000000..99eb52dc13f--- /dev/null+++ b/misc/extension_api_validation/4.7-stable/GH-120609.txt@@ -0,0 +1,6 @@+GH-120609+--------------+Validate extension JSON: Error: Field 'classes/Skeleton3D/methods/reset_bone_pose/arguments': size changed value in new API, from 1 to 2.+Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/Skeleton3D/methods/reset_bone_poses': arguments++Added optional argument. Compatibility methods registered.diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cppindex 9d52b01dd39..1c2fb9fbebc 100644--- a/modules/gltf/gltf_document.cpp+++ b/modules/gltf/gltf_document.cpp@@ -6012,6 +6012,8 @@ void GLTFDocument::_convert_mesh_instances(Ref<GLTFState> p_state) {if (bind_name == StringName()) {bind_name = godot_skeleton->get_bone_name(bone_i);}+ Vector3 skin_scale = godot_skeleton->get_bone_skin_scale(bone_i);+ bind_pose = bind_pose.scaled(skin_scale);GLTFNodeIndex skeleton_bone_i = gltf_skeleton->joints[bone_i];gltf_skin->joints_original.push_back(skeleton_bone_i);gltf_skin->joints.push_back(skeleton_bone_i);diff --git a/scene/3d/bone_spreader_3d.cpp b/scene/3d/bone_spreader_3d.cppnew file mode 100644index 00000000000..4577e68163b--- /dev/null+++ b/scene/3d/bone_spreader_3d.cpp@@ -0,0 +1,253 @@+/**************************************************************************/+/* bone_spreader_3d.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 "bone_spreader_3d.h"++#include "core/object/class_db.h"++bool BoneSpreader3D::_set(const StringName &p_path, const Variant &p_value) {+ String path = p_path;++ if (path.begins_with("settings/")) {+ int which = path.get_slicec('/', 1).to_int();+ String what = path.get_slicec('/', 2);+ ERR_FAIL_INDEX_V(which, (int)settings.size(), false);++ if (what == "bone_name") {+ set_bone_name(which, p_value);+ } else if (what == "bone") {+ set_bone(which, p_value);+ } else if (what == "use_bone_skin_scale") {+ set_use_bone_skin_scale(which, p_value);+ } else if (what == "bone_scale") {+ set_bone_scale(which, p_value);+ } else {+ return false;+ }+ }+ return true;+}++bool BoneSpreader3D::_get(const StringName &p_path, Variant &r_ret) const {+ String path = p_path;++ if (path.begins_with("settings/")) {+ int which = path.get_slicec('/', 1).to_int();+ String what = path.get_slicec('/', 2);+ ERR_FAIL_INDEX_V(which, (int)settings.size(), false);++ if (what == "bone_name") {+ r_ret = get_bone_name(which);+ } else if (what == "bone") {+ r_ret = get_bone(which);+ } else if (what == "use_bone_skin_scale") {+ r_ret = is_using_bone_skin_scale(which);+ } else if (what == "bone_scale") {+ r_ret = get_bone_scale(which);+ } else {+ return false;+ }+ }+ return true;+}++void BoneSpreader3D::_get_property_list(List<PropertyInfo> *p_list) const {+ if (use_bone_skin_scale_for_all_bones) {+ return;+ }++ String enum_hint;+ Skeleton3D *skeleton = get_skeleton();+ if (skeleton) {+ enum_hint = skeleton->get_concatenated_bone_names();+ }++ LocalVector<PropertyInfo> props;++ for (uint32_t i = 0; i < settings.size(); i++) {+ String path = "settings/" + itos(i) + "/";+ props.push_back(PropertyInfo(Variant::STRING_NAME, path + "bone_name", PROPERTY_HINT_ENUM_SUGGESTION, enum_hint));+ props.push_back(PropertyInfo(Variant::INT, path + "bone", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));+ props.push_back(PropertyInfo(Variant::BOOL, path + "use_bone_skin_scale"));+ props.push_back(PropertyInfo(Variant::VECTOR3, path + "bone_scale"));+ }++ for (PropertyInfo &p : props) {+ _validate_dynamic_prop(p);+ p_list->push_back(p);+ }+}++void BoneSpreader3D::_validate_property(PropertyInfo &p_property) const {+ if (p_property.name == "setting_size" && use_bone_skin_scale_for_all_bones) {+ p_property.usage = PROPERTY_USAGE_NONE;+ }+}++void BoneSpreader3D::_validate_dynamic_prop(PropertyInfo &p_property) const {+ PackedStringArray split = p_property.name.split("/");+ if (split.size() > 2 && split[0] == "settings") {+ int which = split[1].to_int();+ if (split[2] == "bone_scale" && is_using_bone_skin_scale(which)) {+ p_property.usage = PROPERTY_USAGE_NONE;+ }+ }+}++void BoneSpreader3D::set_use_bone_skin_scale_for_all_bones(bool p_enabled) {+ use_bone_skin_scale_for_all_bones = p_enabled;+ notify_property_list_changed();+}++bool BoneSpreader3D::are_all_bones_using_bone_skin_scale() const {+ return use_bone_skin_scale_for_all_bones;+}++int BoneSpreader3D::get_setting_size() {+ return settings.size();+}++void BoneSpreader3D::set_setting_size(int p_size) {+ ERR_FAIL_COND(p_size < 0);+ settings.resize(p_size);+ notify_property_list_changed();+}++void BoneSpreader3D::clear_settings() {+ settings.clear();+}++void BoneSpreader3D::set_bone_name(int p_index, const StringName &p_bone_name) {+ ERR_FAIL_INDEX(p_index, (int)settings.size());+ settings[p_index].bone_name = p_bone_name;+ Skeleton3D *sk = get_skeleton();+ if (sk) {+ set_bone(p_index, sk->find_bone(settings[p_index].bone_name));+ }+}++StringName BoneSpreader3D::get_bone_name(int p_index) const {+ ERR_FAIL_INDEX_V(p_index, (int)settings.size(), StringName());+ return settings[p_index].bone_name;+}++void BoneSpreader3D::set_bone(int p_index, int p_bone) {+ ERR_FAIL_INDEX(p_index, (int)settings.size());+ settings[p_index].bone = p_bone;+ Skeleton3D *sk = get_skeleton();+ if (sk) {+ if (settings[p_index].bone <= -1 || settings[p_index].bone >= sk->get_bone_count()) {+ WARN_PRINT("Apply bone index out of range!");+ settings[p_index].bone = -1;+ } else {+ settings[p_index].bone_name = sk->get_bone_name(settings[p_index].bone);+ }+ }+}++int BoneSpreader3D::get_bone(int p_index) const {+ ERR_FAIL_INDEX_V(p_index, (int)settings.size(), -1);+ return settings[p_index].bone;+}++void BoneSpreader3D::set_use_bone_skin_scale(int p_index, bool p_enabled) {+ ERR_FAIL_INDEX(p_index, (int)settings.size());+ settings[p_index].use_bone_skin_scale = p_enabled;+ notify_property_list_changed();+}++bool BoneSpreader3D::is_using_bone_skin_scale(int p_index) const {+ ERR_FAIL_INDEX_V(p_index, (int)settings.size(), false);+ return settings[p_index].use_bone_skin_scale;+}++void BoneSpreader3D::set_bone_scale(int p_index, const Vector3 &p_scale) {+ ERR_FAIL_INDEX(p_index, (int)settings.size());+ ERR_FAIL_COND_MSG(Math::is_zero_approx(p_scale.x * p_scale.y * p_scale.z), "Scale must not be zero.");+ settings[p_index].scale = p_scale;+}++Vector3 BoneSpreader3D::get_bone_scale(int p_index) const {+ ERR_FAIL_INDEX_V(p_index, (int)settings.size(), Vector3(1, 1, 1));+ return settings[p_index].scale;+}++void BoneSpreader3D::_bind_methods() {+ ClassDB::bind_method(D_METHOD("set_use_bone_skin_scale_for_all_bones", "enabled"), &BoneSpreader3D::set_use_bone_skin_scale_for_all_bones);+ ClassDB::bind_method(D_METHOD("are_all_bones_using_bone_skin_scale"), &BoneSpreader3D::are_all_bones_using_bone_skin_scale);++ ClassDB::bind_method(D_METHOD("set_bone_name", "index", "bone_name"), &BoneSpreader3D::set_bone_name);+ ClassDB::bind_method(D_METHOD("get_bone_name", "index"), &BoneSpreader3D::get_bone_name);+ ClassDB::bind_method(D_METHOD("set_bone", "index", "bone"), &BoneSpreader3D::set_bone);+ ClassDB::bind_method(D_METHOD("get_bone", "index"), &BoneSpreader3D::get_bone);+ ClassDB::bind_method(D_METHOD("set_use_bone_skin_scale", "index", "enabled"), &BoneSpreader3D::set_use_bone_skin_scale);+ ClassDB::bind_method(D_METHOD("is_using_bone_skin_scale", "index"), &BoneSpreader3D::is_using_bone_skin_scale);+ ClassDB::bind_method(D_METHOD("set_bone_scale", "index", "scale"), &BoneSpreader3D::set_bone_scale);+ ClassDB::bind_method(D_METHOD("get_bone_scale", "index"), &BoneSpreader3D::get_bone_scale);++ ClassDB::bind_method(D_METHOD("set_setting_size", "size"), &BoneSpreader3D::set_setting_size);+ ClassDB::bind_method(D_METHOD("get_setting_size"), &BoneSpreader3D::get_setting_size);+ ClassDB::bind_method(D_METHOD("clear_setting"), &BoneSpreader3D::clear_settings);++ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_bone_skin_scale_for_all_bones"), "set_use_bone_skin_scale_for_all_bones", "are_all_bones_using_bone_skin_scale");+ ADD_PROPERTY(PropertyInfo(Variant::INT, "setting_size", PROPERTY_HINT_RANGE, "0,1000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ARRAY, "Settings,settings/"), "set_setting_size", "get_setting_size");+}++void BoneSpreader3D::_process_modification(double p_delta) {+ Skeleton3D *skeleton = get_skeleton();+ if (!skeleton) {+ return;+ }++ if (use_bone_skin_scale_for_all_bones) {+ for (int bone = 0; bone < skeleton->get_bone_count(); bone++) {+ Vector3 scl = skeleton->get_bone_skin_scale(bone);+ if (scl == INITIAL_SCALE) {+ continue;+ }+ Vector<int> children = skeleton->get_bone_children(bone);+ for (int c : children) {+ skeleton->set_bone_pose_position(c, skeleton->get_bone_pose_position(c) * scl);+ }+ }+ } else {+ for (const BoneSpreader3DSetting &setting : settings) {+ int bone = setting.bone;+ if (bone < 0) {+ continue;+ }+ Vector3 scl = setting.use_bone_skin_scale ? skeleton->get_bone_skin_scale(bone) : setting.scale;+ Vector<int> children = skeleton->get_bone_children(bone);+ for (int c : children) {+ skeleton->set_bone_pose_position(c, skeleton->get_bone_pose_position(c) * scl);+ }+ }+ }+}diff --git a/scene/3d/bone_spreader_3d.h b/scene/3d/bone_spreader_3d.hnew file mode 100644index 00000000000..9726213f6d1--- /dev/null+++ b/scene/3d/bone_spreader_3d.h@@ -0,0 +1,78 @@+/**************************************************************************/+/* bone_spreader_3d.h */+/**************************************************************************/+/* 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. */+/**************************************************************************/++#pragma once++#include "scene/3d/skeleton_modifier_3d.h"++class BoneSpreader3D : public SkeletonModifier3D {+ GDCLASS(BoneSpreader3D, SkeletonModifier3D);++ const Vector3 INITIAL_SCALE = Vector3(1, 1, 1);+ bool use_bone_skin_scale_for_all_bones = true;++public:+ struct BoneSpreader3DSetting {+ StringName bone_name;+ int bone = -1;+ bool use_bone_skin_scale = true;+ Vector3 scale = Vector3(1, 1, 1);+ };++protected:+ LocalVector<BoneSpreader3DSetting> settings;++ bool _get(const StringName &p_path, Variant &r_ret) const;+ bool _set(const StringName &p_path, const Variant &p_value);+ void _get_property_list(List<PropertyInfo> *p_list) const;+ void _validate_property(PropertyInfo &p_property) const;+ void _validate_dynamic_prop(PropertyInfo &p_property) const;++ static void _bind_methods();++ virtual void _process_modification(double p_delta) override;++public:+ int get_setting_size();+ void set_setting_size(int p_size);+ void clear_settings();++ void set_bone_name(int p_index, const StringName &p_bone_name);+ StringName get_bone_name(int p_index) const;+ void set_bone(int p_index, int p_bone);+ int get_bone(int p_index) const;+ void set_use_bone_skin_scale(int p_index, bool p_enabled);+ bool is_using_bone_skin_scale(int p_index) const;+ void set_bone_scale(int p_index, const Vector3 &p_scale);+ Vector3 get_bone_scale(int p_index) const;++ void set_use_bone_skin_scale_for_all_bones(bool p_enabled);+ bool are_all_bones_using_bone_skin_scale() const;+};diff --git a/scene/3d/skeleton_3d.compat.inc b/scene/3d/skeleton_3d.compat.incindex 9be8103d9eb..8b467bc2db6 100644--- a/scene/3d/skeleton_3d.compat.inc+++ b/scene/3d/skeleton_3d.compat.inc@@ -38,8 +38,18 @@ void Skeleton3D::_add_bone_bind_compat_88791(const String &p_name) {add_bone(p_name);}+void Skeleton3D::_reset_bone_pose_compat_120609(int p_bone) {+ reset_bone_pose(p_bone, false);+}++void Skeleton3D::_reset_bone_poses_compat_120609() {+ reset_bone_poses(false);+}+void Skeleton3D::_bind_compatibility_methods() {ClassDB::bind_compatibility_method(D_METHOD("add_bone", "name"), &Skeleton3D::_add_bone_bind_compat_88791);+ ClassDB::bind_compatibility_method(D_METHOD("reset_bone_pose", "bone_idx"), &Skeleton3D::_reset_bone_pose_compat_120609);+ ClassDB::bind_compatibility_method(D_METHOD("reset_bone_poses"), &Skeleton3D::_reset_bone_poses_compat_120609);}#endif // DISABLE_DEPRECATEDdiff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cppindex f5bca4e562e..4f87d01683e 100644--- a/scene/3d/skeleton_3d.cpp+++ b/scene/3d/skeleton_3d.cpp@@ -104,6 +104,8 @@ bool Skeleton3D::_set(const StringName &p_path, const Variant &p_value) {set_bone_pose_rotation(which, p_value);} else if (what == "scale") {set_bone_pose_scale(which, p_value);+ } else if (what == "skin_scale") {+ set_bone_skin_scale(which, p_value);} else if (what == "bone_meta") {set_bone_meta(which, path.get_slicec('/', 3), p_value);#ifndef DISABLE_DEPRECATED@@ -173,6 +175,8 @@ bool Skeleton3D::_get(const StringName &p_path, Variant &r_ret) const {r_ret = get_bone_pose_rotation(which);} else if (what == "scale") {r_ret = get_bone_pose_scale(which);+ } else if (what == "skin_scale") {+ r_ret = get_bone_skin_scale(which);} else if (what == "bone_meta") {r_ret = get_bone_meta(which, path.get_slicec('/', 3));} else {@@ -182,6 +186,39 @@ bool Skeleton3D::_get(const StringName &p_path, Variant &r_ret) const {return true;}+bool Skeleton3D::_property_can_revert(const StringName &p_name) const {+ String path = p_name;+ if (!path.begins_with("bones/")) {+ return false;+ }+ uint32_t which = path.get_slicec('/', 1).to_int();+ if (which >= bones.size()) {+ return false;+ }+ String what = path.get_slicec('/', 2);+ if (what == "skin_scale") {+ return bones[which].skin_scale != DEFAULT_SKIN_SCALE;+ }+ return false;+}++bool Skeleton3D::_property_get_revert(const StringName &p_name, Variant &r_property) const {+ String path = p_name;+ if (!path.begins_with("bones/")) {+ return false;+ }+ uint32_t which = path.get_slicec('/', 1).to_int();+ if (which >= bones.size()) {+ return false;+ }+ String what = path.get_slicec('/', 2);+ if (what == "skin_scale") {+ r_property = DEFAULT_SKIN_SCALE;+ return true;+ }+ return false;+}+void Skeleton3D::_get_property_list(List<PropertyInfo> *p_list) const {for (uint32_t i = 0; i < bones.size(); i++) {const String prep = vformat("%s/%d/", "bones", i);@@ -202,6 +239,7 @@ void Skeleton3D::_get_property_list(List<PropertyInfo> *p_list) const {p_list->push_back(PropertyInfo(Variant::VECTOR3, prep + "position", PROPERTY_HINT_NONE, "", xform_usage));p_list->push_back(PropertyInfo(Variant::QUATERNION, prep + "rotation", PROPERTY_HINT_NONE, "", xform_usage));p_list->push_back(PropertyInfo(Variant::VECTOR3, prep + "scale", PROPERTY_HINT_NONE, "", xform_usage));+ p_list->push_back(PropertyInfo(Variant::VECTOR3, prep + "skin_scale", PROPERTY_HINT_NONE, "", xform_usage));for (const KeyValue<StringName, Variant> &K : bones[i].metadata) {PropertyInfo pi = PropertyInfo(bones[i].metadata[K.key].get_type(), prep + "bone_meta/" + K.key, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR);@@ -402,7 +440,11 @@ void Skeleton3D::_notification(int p_what) {for (uint32_t i = 0; i < bind_count; i++) {uint32_t bone_index = E->skin_bone_indices_ptrs[i];ERR_CONTINUE(bone_index >= (uint32_t)len);- rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].global_pose * skin->get_bind_pose(i));+ Transform3D bind_pose_transform = skin->get_bind_pose(i);+ if (bonesptr[bone_index].is_skin_scaled) {+ bind_pose_transform = bind_pose_transform.scaled(bonesptr[bone_index].skin_scale);+ }+ rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].global_pose * bind_pose_transform);}}@@ -916,17 +958,37 @@ Vector3 Skeleton3D::get_bone_pose_scale(int p_bone) const {return bones[p_bone].pose_scale;}-void Skeleton3D::reset_bone_pose(int p_bone) {+void Skeleton3D::set_bone_skin_scale(int p_bone, const Vector3 &p_skin_scale) {+ const int bone_size = bones.size();+ ERR_FAIL_INDEX(p_bone, bone_size);+ bones[p_bone].skin_scale = p_skin_scale;+ bones[p_bone].is_skin_scaled = !bones[p_bone].skin_scale.is_equal_approx(DEFAULT_SKIN_SCALE);+ if (is_inside_tree()) {+ _make_dirty();+ }+}++Vector3 Skeleton3D::get_bone_skin_scale(int p_bone) const {+ const int bone_size = bones.size();+ ERR_FAIL_INDEX_V(p_bone, bone_size, Vector3());+ return bones[p_bone].skin_scale;+}++void Skeleton3D::reset_bone_pose(int p_bone, bool p_reset_bone_skin_scale) {const int bone_size = bones.size();ERR_FAIL_INDEX(p_bone, bone_size);set_bone_pose_position(p_bone, bones[p_bone].rest.origin);set_bone_pose_rotation(p_bone, bones[p_bone].rest.basis.get_rotation_quaternion());set_bone_pose_scale(p_bone, bones[p_bone].rest.basis.get_scale());+ if (!p_reset_bone_skin_scale) {+ return;+ }+ set_bone_skin_scale(p_bone, DEFAULT_SKIN_SCALE);}-void Skeleton3D::reset_bone_poses() {+void Skeleton3D::reset_bone_poses(bool p_reset_bone_skin_scale) {for (uint32_t i = 0; i < bones.size(); i++) {- reset_bone_pose(i);+ reset_bone_pose(i, p_reset_bone_skin_scale);}}@@ -1278,8 +1340,11 @@ void Skeleton3D::_bind_methods() {ClassDB::bind_method(D_METHOD("get_bone_pose_rotation", "bone_idx"), &Skeleton3D::get_bone_pose_rotation);ClassDB::bind_method(D_METHOD("get_bone_pose_scale", "bone_idx"), &Skeleton3D::get_bone_pose_scale);- ClassDB::bind_method(D_METHOD("reset_bone_pose", "bone_idx"), &Skeleton3D::reset_bone_pose);- ClassDB::bind_method(D_METHOD("reset_bone_poses"), &Skeleton3D::reset_bone_poses);+ ClassDB::bind_method(D_METHOD("set_bone_skin_scale", "bone_idx", "skin_scale"), &Skeleton3D::set_bone_skin_scale);+ ClassDB::bind_method(D_METHOD("get_bone_skin_scale", "bone_idx"), &Skeleton3D::get_bone_skin_scale);++ ClassDB::bind_method(D_METHOD("reset_bone_pose", "bone_idx", "reset_bone_skin_scale"), &Skeleton3D::reset_bone_pose, DEFVAL(false));+ ClassDB::bind_method(D_METHOD("reset_bone_poses", "reset_bone_skin_scale"), &Skeleton3D::reset_bone_poses, DEFVAL(false));ClassDB::bind_method(D_METHOD("is_bone_enabled", "bone_idx"), &Skeleton3D::is_bone_enabled);ClassDB::bind_method(D_METHOD("set_bone_enabled", "bone_idx", "enabled"), &Skeleton3D::set_bone_enabled, DEFVAL(true));diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.hindex a2cbf0cdfa2..4fab71515f2 100644--- a/scene/3d/skeleton_3d.h+++ b/scene/3d/skeleton_3d.h@@ -65,6 +65,8 @@ public:class Skeleton3D : public Node3D {GDCLASS(Skeleton3D, Node3D);+ const Vector3 DEFAULT_SKIN_SCALE = Vector3(1, 1, 1);+#ifdef TOOLS_ENABLEDbool saving = false;#endif // TOOLS_ENABLED@@ -112,6 +114,8 @@ private:Quaternion pose_rotation;Vector3 pose_scale = Vector3(1, 1, 1);Transform3D global_pose;+ Vector3 skin_scale = Vector3(1, 1, 1);+ bool is_skin_scaled = false;int nested_set_offset = 0; // Offset in nested set of bone hierarchy.int nested_set_span = 0; // Subtree span in nested set of bone hierarchy.@@ -208,6 +212,8 @@ private:#ifndef DISABLE_DEPRECATEDvoid _add_bone_bind_compat_88791(const String &p_name);+ void _reset_bone_pose_compat_120609(int p_bone);+ void _reset_bone_poses_compat_120609();static void _bind_compatibility_methods();#endif // DISABLE_DEPRECATED@@ -216,6 +222,8 @@ protected:bool _get(const StringName &p_path, Variant &r_ret) const;bool _set(const StringName &p_path, const Variant &p_value);void _get_property_list(List<PropertyInfo> *p_list) const;+ bool _property_can_revert(const StringName &p_name) const;+ bool _property_get_revert(const StringName &p_name, Variant &r_property) const;void _notification(int p_what);TypedArray<StringName> _get_bone_meta_list_bind(int p_bone) const;static void _bind_methods();@@ -279,11 +287,14 @@ public:void set_bone_pose_rotation(int p_bone, const Quaternion &p_rotation);void set_bone_pose_scale(int p_bone, const Vector3 &p_scale);+ void set_bone_skin_scale(int p_bone, const Vector3 &p_skin_scale);+ Vector3 get_bone_skin_scale(int p_bone) const;+Transform3D get_bone_global_pose(int p_bone) const;void set_bone_global_pose(int p_bone, const Transform3D &p_pose);- void reset_bone_pose(int p_bone);- void reset_bone_poses();+ void reset_bone_pose(int p_bone, bool p_reset_bone_skin_scale = false);+ void reset_bone_poses(bool p_reset_bone_skin_scale = false);void localize_rests(); // Used for loaders and tools.diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cppindex c5464add86e..351651796f4 100644--- a/scene/register_scene_types.cpp+++ b/scene/register_scene_types.cpp@@ -338,6 +338,7 @@#endif // PHYSICS_2D_DISABLED#ifndef PHYSICS_3D_DISABLED+#include "scene/3d/bone_spreader_3d.h"#include "scene/3d/physics/animatable_body_3d.h"#include "scene/3d/physics/area_3d.h"#include "scene/3d/physics/character_body_3d.h"@@ -728,6 +729,7 @@ void register_scene_types() {GDREGISTER_CLASS(SoftBody3D);#endif // PHYSICS_3D_DISABLED+ GDREGISTER_CLASS(BoneSpreader3D);GDREGISTER_CLASS(BoneAttachment3D);GDREGISTER_CLASS(LookAtModifier3D);#ifndef DISABLE_DEPRECATED