From 2dfa02313591ac9aecfd2a1dac22ba9f06398dc8 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Sun, 8 Oct 2023 01:09:46 +0200 Subject: [PATCH] Show revert button for MeshInstance3D blendshape values Shows revert button for MeshInstance3D blendshape values. --- scene/3d/mesh_instance_3d.cpp | 17 +++++++++++++++++ scene/3d/mesh_instance_3d.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index d83d55d1213..35baf81e895 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -493,6 +493,23 @@ void MeshInstance3D::create_debug_tangents() { } } +bool MeshInstance3D::_property_can_revert(const StringName &p_name) const { + HashMap::ConstIterator E = blend_shape_properties.find(p_name); + if (E) { + return true; + } + return false; +} + +bool MeshInstance3D::_property_get_revert(const StringName &p_name, Variant &r_property) const { + HashMap::ConstIterator E = blend_shape_properties.find(p_name); + if (E) { + r_property = 0.0f; + return true; + } + return false; +} + void MeshInstance3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MeshInstance3D::set_mesh); ClassDB::bind_method(D_METHOD("get_mesh"), &MeshInstance3D::get_mesh); diff --git a/scene/3d/mesh_instance_3d.h b/scene/3d/mesh_instance_3d.h index 0a7ffa0beed..add6bfe15ee 100644 --- a/scene/3d/mesh_instance_3d.h +++ b/scene/3d/mesh_instance_3d.h @@ -62,6 +62,9 @@ protected: void _notification(int p_what); static void _bind_methods(); + bool _property_can_revert(const StringName &p_name) const; + bool _property_get_revert(const StringName &p_name, Variant &r_property) const; + public: void set_mesh(const Ref &p_mesh); Ref get_mesh() const;