This commit is contained in:
Silc 'Tokage' Renew 2021-11-11 01:11:04 +02:00 committed by GitHub
commit 68ba9f2ac4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 277 additions and 35 deletions

View file

@ -140,6 +140,14 @@ enum PropertyUsageFlags {
PROPERTY_USAGE_NO_EDITOR = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK,
};
enum PropertyTrackType {
PROPERTY_TRACK_TYPE_VALUE,
PROPERTY_TRACK_TYPE_POSITION,
PROPERTY_TRACK_TYPE_ROTATION,
PROPERTY_TRACK_TYPE_SCALE,
PROPERTY_TRACK_TYPE_BLEND_SHAPE
};
#define ADD_SIGNAL(m_signal) ::ClassDB::add_signal(get_class_static(), m_signal)
#define ADD_PROPERTY(m_property, m_setter, m_getter) ::ClassDB::add_property(get_class_static(), m_property, _scs_create(m_setter), _scs_create(m_getter))
#define ADD_PROPERTYI(m_property, m_setter, m_getter, m_index) ::ClassDB::add_property(get_class_static(), m_property, _scs_create(m_setter), _scs_create(m_getter), m_index)
@ -159,6 +167,7 @@ struct PropertyInfo {
PropertyHint hint = PROPERTY_HINT_NONE;
String hint_string;
uint32_t usage = PROPERTY_USAGE_DEFAULT;
PropertyTrackType track_type = PROPERTY_TRACK_TYPE_VALUE;
#ifdef TOOLS_ENABLED
Vector<String> linked_properties;

View file

@ -32,7 +32,9 @@
</description>
</signal>
<signal name="property_keyed">
<argument index="0" name="property" type="String" />
<argument index="0" name="object" type="Object" />
<argument index="1" name="property" type="String" />
<argument index="2" name="track_type" type="int" />
<description>
Emitted when a property is keyed in the inspector. Properties can be keyed by clicking the "key" icon next to a property when the Animation panel is toggled.
</description>

View file

@ -3447,7 +3447,10 @@ void AnimationTrackEditor::make_insert_queue() {
insert_queue = true;
}
void AnimationTrackEditor::commit_insert_queue() {
void AnimationTrackEditor::commit_insert_queue(const bool p_bezier_enabled) {
// Default state must be false for preventing to make bezier track with bone.
insert_confirm_bezier->set_pressed(false);
bool reset_allowed = true;
AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
if (player->has_animation("RESET") && player->get_animation("RESET") == animation) {
@ -3469,10 +3472,18 @@ void AnimationTrackEditor::commit_insert_queue() {
// Organize insert data.
int num_tracks = 0;
String last_track_query;
bool all_bezier = true;
bool all_bezier = p_bezier_enabled;
for (int i = 0; i < insert_data.size(); i++) {
if (insert_data[i].type != Animation::TYPE_VALUE && insert_data[i].type != Animation::TYPE_BEZIER) {
all_bezier = false;
if (insert_data[i].type != Animation::TYPE_BEZIER) {
switch (insert_data[i].type) {
case Animation::TYPE_METHOD:
case Animation::TYPE_AUDIO:
case Animation::TYPE_ANIMATION: {
all_bezier = false;
} break;
default: {
} break;
}
}
if (insert_data[i].track_idx == -1) {
@ -3521,13 +3532,16 @@ void AnimationTrackEditor::commit_insert_queue() {
insert_queue = false;
}
void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
void AnimationTrackEditor::_query_insert(const InsertData &p_id, const bool p_bezier_enabled) {
if (!insert_queue) {
insert_data.clear();
}
for (const InsertData &E : insert_data) {
// Prevent insertion of multiple tracks.
if (E.special_path != NodePath() && E.special_path == p_id.special_path && E.type == p_id.type) {
return; // Already inserted a track this frame.
}
if (E.path == p_id.path && E.type == p_id.type) {
return; // Already inserted a track this frame.
}
@ -3537,7 +3551,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
// Without queue, commit immediately.
if (!insert_queue) {
commit_insert_queue();
commit_insert_queue(p_bezier_enabled);
}
}
@ -3578,7 +3592,7 @@ void AnimationTrackEditor::_insert_track(bool p_create_reset, bool p_create_bezi
}
}
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant p_value) {
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant p_value, const RotationOrder p_rotation_order) {
ERR_FAIL_COND(!root);
ERR_FAIL_COND_MSG(
(p_type != Animation::TYPE_POSITION_3D && p_type != Animation::TYPE_ROTATION_3D && p_type != Animation::TYPE_SCALE_3D),
@ -3590,21 +3604,108 @@ void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_
return;
}
bool is_bone_path = p_sub != "";
// Let's build a node path.
String path = root->get_path_to(p_node);
if (p_sub != "") {
path += ":" + p_sub;
String special_path = path;
String prop = "";
if (is_bone_path) {
special_path += ":" + p_sub;
}
switch (p_type) {
case Animation::TYPE_POSITION_3D: {
prop = "position";
} break;
case Animation::TYPE_ROTATION_3D: {
prop = "rotation";
} break;
case Animation::TYPE_SCALE_3D: {
prop = "scale";
} break;
default: {
} break;
}
if (prop != "") {
// Bone animation and Bezier tracks are incompatible,
// but the property path is required for duplicate checking.
if (is_bone_path) {
path = special_path + "/" + prop;
} else {
path = path + ":" + prop;
}
}
NodePath np = path;
NodePath sp = special_path;
int track_idx = -1;
for (int i = 0; i < animation->get_track_count(); i++) {
if (animation->track_get_path(i) != np) {
if (!is_bone_path) {
String tpath = animation->track_get_path(i);
int index = tpath.rfind(":");
// Hack: If it has been exist as BezierTrack, use insert_value_key().
if (NodePath(tpath.substr(0, index + 1)) == np) {
insert_value_key(prop, p_value, false);
return;
}
}
if (animation->track_get_path(i) != np && !(animation->track_get_path(i) == sp && animation->track_get_type(i) == p_type)) {
continue;
}
if (animation->track_get_type(i) != p_type) {
track_idx = i;
}
InsertData id;
if (p_type == Animation::TYPE_ROTATION_3D && p_value.get_type() == Variant::VECTOR3) {
ERR_FAIL_COND_MSG(p_rotation_order == ROTATION_ORDER_QUATERNION, "Need to pass EulerOrder when using Euler.");
id.rotation_order = p_rotation_order;
}
id.path = np;
id.special_path = sp;
// TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
id.query = vformat(TTR("node '%s'"), p_node->get_name());
id.advance = false;
id.track_idx = track_idx;
id.value = p_value;
id.type = p_type;
_query_insert(id, !is_bone_path); // Prevent to make bezier track with bone.
}
void AnimationTrackEditor::insert_blend_shape_key(MeshInstance3D *p_mesh_instance, const int p_blend_shape_id, const Variant p_value) {
ERR_FAIL_COND(!root);
if (!keying) {
return;
}
if (!animation.is_valid()) {
return;
}
// Let's build a node path.
String path = root->get_path_to(p_mesh_instance);
String special_path = path;
String prop = "blend_shapes/" + itos(p_blend_shape_id);
path = path + ":" + prop;
special_path += ":" + itos(p_blend_shape_id);
NodePath np = path;
NodePath sp = special_path;
int track_idx = -1;
for (int i = 0; i < animation->get_track_count(); i++) {
String tpath = animation->track_get_path(i);
int index = tpath.rfind(":");
// Hack: If it has been exist as BezierTrack, use insert_value_key().
if (NodePath(tpath.substr(0, index + 1)) == np) {
insert_value_key(prop, p_value, false);
return;
}
if (animation->track_get_path(i) != np && !(animation->track_get_path(i) == sp && animation->track_get_type(i) == Animation::TYPE_BLEND_SHAPE)) {
continue;
}
track_idx = i;
@ -3612,12 +3713,13 @@ void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_
InsertData id;
id.path = np;
id.special_path = sp;
// TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
id.query = vformat(TTR("node '%s'"), p_node->get_name());
id.query = vformat(TTR("node '%s'"), p_mesh_instance->get_name());
id.advance = false;
id.track_idx = track_idx;
id.value = p_value;
id.type = p_type;
id.type = Animation::TYPE_BLEND_SHAPE;
_query_insert(id);
}
@ -4069,8 +4171,19 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
p_id.track_idx = p_next_tracks.normal;
bool use_special_path = false;
switch (p_id.type) {
case Animation::TYPE_POSITION_3D:
case Animation::TYPE_ROTATION_3D:
case Animation::TYPE_SCALE_3D:
case Animation::TYPE_BLEND_SHAPE: {
use_special_path = true;
} break;
default: {
} break;
}
undo_redo->add_do_method(animation.ptr(), "add_track", p_id.type);
undo_redo->add_do_method(animation.ptr(), "track_set_path", p_id.track_idx, p_id.path);
undo_redo->add_do_method(animation.ptr(), "track_set_path", p_id.track_idx, use_special_path ? p_id.special_path : p_id.path);
if (p_id.type == Animation::TYPE_VALUE) {
undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", p_id.track_idx, update_mode);
}
@ -4089,7 +4202,6 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
case Animation::TYPE_BLEND_SHAPE:
case Animation::TYPE_VALUE: {
value = p_id.value;
} break;
case Animation::TYPE_BEZIER: {
Array array;
@ -4109,6 +4221,13 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
}
}
// Special case for euler.
if (p_id.type == Animation::TYPE_ROTATION_3D && value.get_type() == Variant::VECTOR3) {
Basis rot;
rot.set_euler(static_cast<Vector3>(value), static_cast<Basis::EulerOrder>(p_id.rotation_order));
value = rot;
}
undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_id.track_idx, time, value);
if (created) {

View file

@ -36,6 +36,7 @@
#include "editor/property_editor.h"
#include "editor/property_selector.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/control.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/menu_button.h"
@ -279,6 +280,18 @@ public:
class AnimationTrackEditor : public VBoxContainer {
GDCLASS(AnimationTrackEditor, VBoxContainer);
public:
enum RotationOrder {
ROTATION_ORDER_XYZ,
ROTATION_ORDER_XZY,
ROTATION_ORDER_YXZ,
ROTATION_ORDER_YZX,
ROTATION_ORDER_ZXY,
ROTATION_ORDER_ZYX,
ROTATION_ORDER_QUATERNION
};
private:
Ref<Animation> animation;
Node *root;
@ -341,8 +354,10 @@ class AnimationTrackEditor : public VBoxContainer {
struct InsertData {
Animation::TrackType type;
NodePath path;
NodePath special_path; // For Pos/Rot/Scl/BlendShapes Track.
int track_idx = 0;
Variant value;
RotationOrder rotation_order = ROTATION_ORDER_QUATERNION;
String query;
bool advance = false;
}; /* insert_data;*/
@ -354,7 +369,7 @@ class AnimationTrackEditor : public VBoxContainer {
bool insert_queue;
List<InsertData> insert_data;
void _query_insert(const InsertData &p_id);
void _query_insert(const InsertData &p_id, const bool p_bezier_enabled = true);
Ref<Animation> _create_and_get_reset_animation();
void _confirm_insert_list();
struct TrackIndices {
@ -528,10 +543,11 @@ public:
void set_anim_pos(float p_pos);
void insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists = false);
void insert_value_key(const String &p_property, const Variant &p_value, bool p_advance);
void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant p_value);
void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant p_value, const RotationOrder p_rotation_order = ROTATION_ORDER_QUATERNION);
void insert_blend_shape_key(MeshInstance3D *p_mesh_instance, const int p_blend_shape_id, const Variant p_value);
bool has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type);
void make_insert_queue();
void commit_insert_queue();
void commit_insert_queue(const bool p_bezier_enabled = true);
void show_select_node_warning(bool p_show);

View file

@ -613,7 +613,17 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) {
}
if (keying_rect.has_point(mpos)) {
emit_signal(SNAME("property_keyed"), property, use_keying_next());
if (property_track_type == PROPERTY_TRACK_TYPE_POSITION) {
emit_signal(SNAME("property_keyed"), property, Animation::TYPE_POSITION_3D, use_keying_next());
} else if (property_track_type == PROPERTY_TRACK_TYPE_ROTATION) {
emit_signal(SNAME("property_keyed"), property, Animation::TYPE_ROTATION_3D, use_keying_next());
} else if (property_track_type == PROPERTY_TRACK_TYPE_SCALE) {
emit_signal(SNAME("property_keyed"), property, Animation::TYPE_SCALE_3D, use_keying_next());
} else if (property_track_type == PROPERTY_TRACK_TYPE_BLEND_SHAPE) {
emit_signal(SNAME("property_keyed"), property, Animation::TYPE_BLEND_SHAPE, use_keying_next());
} else {
emit_signal(SNAME("property_keyed"), property, Animation::TYPE_VALUE, use_keying_next());
}
if (use_keying_next()) {
if (property == "frame_coords" && (object->is_class("Sprite2D") || object->is_class("Sprite3D"))) {
@ -945,6 +955,7 @@ EditorProperty::EditorProperty() {
pinned = false;
use_folding = false;
property_usage = 0;
property_track_type = PROPERTY_TRACK_TYPE_VALUE;
selected = false;
selected_focusable = -1;
label_reference = nullptr;
@ -2240,6 +2251,7 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<Edit
//since it's one, associate:
ep->property = F.properties[0];
ep->property_usage = 0;
ep->property_track_type = PROPERTY_TRACK_TYPE_VALUE;
}
if (F.label != String()) {
@ -2781,6 +2793,7 @@ void EditorInspector::update_tree() {
//since it's one, associate:
ep->property = F.properties[0];
ep->property_usage = p.usage;
ep->property_track_type = p.track_type;
//and set label?
}
@ -3188,12 +3201,12 @@ void EditorInspector::_multiple_properties_changed(Vector<String> p_paths, Array
}
}
void EditorInspector::_property_keyed(const String &p_path, bool p_advance) {
void EditorInspector::_property_keyed(const String &p_path, const Animation::TrackType p_track_type, bool p_advance) {
if (!object) {
return;
}
emit_signal(SNAME("property_keyed"), p_path, object->get(p_path), p_advance); //second param is deprecated
emit_signal(SNAME("property_keyed"), object, p_path, p_track_type, object->get(p_path), p_advance); // object->get(p_path) param is deprecated.
}
void EditorInspector::_property_deleted(const String &p_path) {
@ -3204,12 +3217,12 @@ void EditorInspector::_property_deleted(const String &p_path) {
emit_signal(SNAME("property_deleted"), p_path); //second param is deprecated
}
void EditorInspector::_property_keyed_with_value(const String &p_path, const Variant &p_value, bool p_advance) {
void EditorInspector::_property_keyed_with_value(const String &p_path, const Animation::TrackType p_track_type, const Variant &p_value, bool p_advance) {
if (!object) {
return;
}
emit_signal(SNAME("property_keyed"), p_path, p_value, p_advance); //second param is deprecated
emit_signal(SNAME("property_keyed"), object, p_path, p_track_type, p_value, p_advance);
}
void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
@ -3519,7 +3532,7 @@ void EditorInspector::_bind_methods() {
ClassDB::bind_method("_edit_request_change", &EditorInspector::_edit_request_change);
ADD_SIGNAL(MethodInfo("property_selected", PropertyInfo(Variant::STRING, "property")));
ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property")));
ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::OBJECT, "object"), PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::INT, "track_type")));
ADD_SIGNAL(MethodInfo("property_deleted", PropertyInfo(Variant::STRING, "property")));
ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::OBJECT, "res"), PropertyInfo(Variant::STRING, "prop")));
ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::INT, "id")));

View file

@ -38,6 +38,7 @@
#include "scene/gui/panel_container.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/animation.h"
class UndoRedo;
@ -70,6 +71,7 @@ private:
StringName property;
int property_usage;
PropertyTrackType property_track_type;
bool read_only;
bool checkable;
@ -463,8 +465,8 @@ class EditorInspector : public ScrollContainer {
void _property_changed(const String &p_path, const Variant &p_value, const String &p_name = "", bool p_changing = false, bool p_update_all = false);
void _multiple_properties_changed(Vector<String> p_paths, Array p_values, bool p_changing = false);
void _property_keyed(const String &p_path, bool p_advance);
void _property_keyed_with_value(const String &p_path, const Variant &p_value, bool p_advance);
void _property_keyed(const String &p_path, const Animation::TrackType p_track_type, bool p_advance);
void _property_keyed_with_value(const String &p_path, const Animation::TrackType p_track_type, const Variant &p_value, bool p_advance);
void _property_deleted(const String &p_path);
void _property_checked(const String &p_path, bool p_checked);
void _property_pinned(const String &p_path, bool p_pinned);

View file

@ -382,8 +382,48 @@ void InspectorDock::_menu_expandall() {
inspector->expand_all_folding();
}
void InspectorDock::_property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance) {
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_value_key(p_keyed, p_value, p_advance);
void InspectorDock::_property_keyed(Object *sp, const String &p_keyed, const Animation::TrackType p_type, const Variant &p_value, bool p_advance) {
switch (p_type) {
case Animation::TYPE_POSITION_3D: {
Node3D *s = Object::cast_to<Node3D>(sp);
if (!s) {
return;
}
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_transform_key(s, "", Animation::TYPE_POSITION_3D, p_value);
return;
} break;
case Animation::TYPE_ROTATION_3D: {
Node3D *s = Object::cast_to<Node3D>(sp);
if (!s) {
return;
}
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_transform_key(
s, "", Animation::TYPE_ROTATION_3D, p_value,
s->get_rotation_edit_mode() == Node3D::ROTATION_EDIT_MODE_EULER ? static_cast<AnimationTrackEditor::RotationOrder>(s->get_rotation_order()) : AnimationTrackEditor::ROTATION_ORDER_QUATERNION);
return;
} break;
case Animation::TYPE_SCALE_3D: {
Node3D *s = Object::cast_to<Node3D>(sp);
if (!s) {
return;
}
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_transform_key(s, "", Animation::TYPE_SCALE_3D, p_value);
return;
} break;
case Animation::TYPE_BLEND_SHAPE: {
MeshInstance3D *m = Object::cast_to<MeshInstance3D>(sp);
if (!m) {
return;
}
PackedStringArray split = p_keyed.split("/");
int blend_shape_id = split[split.size() - 1].to_int();
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_blend_shape_key(m, blend_shape_id, p_value);
return;
} break;
default: {
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_value_key(p_keyed, p_value, p_advance);
} break;
}
}
void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Transform3D &p_key) {

View file

@ -118,7 +118,7 @@ class InspectorDock : public VBoxContainer {
void _select_history(int p_idx);
void _prepare_history();
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
void _property_keyed(Object *sp, const String &p_keyed, const Animation::TrackType p_type, const Variant &p_value, bool p_advance);
void _transform_keyed(Object *sp, const String &p_sub, const Transform3D &p_key);
protected:

View file

@ -147,7 +147,7 @@ void BoneTransformEditor::set_target(const String &p_prop) {
rest_matrix->update_property();
}
void BoneTransformEditor::_property_keyed(const String &p_path, bool p_advance) {
void BoneTransformEditor::_property_keyed(const String &p_path, const Animation::TrackType p_track_type, bool p_advance) {
AnimationTrackEditor *te = AnimationPlayerEditor::get_singleton()->get_track_editor();
PackedStringArray split = p_path.split("/");
if (split.size() == 3 && split[0] == "bones") {
@ -320,7 +320,7 @@ void Skeleton3DEditor::insert_keys(const bool p_all_bones) {
te->insert_transform_key(skeleton, name, Animation::TYPE_SCALE_3D, skeleton->get_bone_pose_scale(i));
}
}
te->commit_insert_queue();
te->commit_insert_queue(false);
}
void Skeleton3DEditor::pose_to_rest(const bool p_all_bones) {

View file

@ -75,7 +75,7 @@ class BoneTransformEditor : public VBoxContainer {
void _value_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing);
void _property_keyed(const String &p_path, bool p_advance);
void _property_keyed(const String &p_path, const Animation::TrackType p_track_type, bool p_advance);
protected:
void _notification(int p_what);

View file

@ -576,7 +576,9 @@ void CSGShape3D::_validate_property(PropertyInfo &property) const {
} else if (is_collision_prefixed && !bool(get("use_collision"))) {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
}
GeometryInstance3D::_validate_property(property);
Node3D::_validate_property(property);
}
Array CSGShape3D::get_meshes() const {

View file

@ -582,6 +582,7 @@ void Area3D::_validate_property(PropertyInfo &property) const {
}
CollisionObject3D::_validate_property(property);
Node3D::_validate_property(property);
}
void Area3D::_bind_methods() {

View file

@ -160,7 +160,9 @@ void Decal::_validate_property(PropertyInfo &property) const {
if (!distance_fade_enabled && (property.name == "distance_fade_begin" || property.name == "distance_fade_length")) {
property.usage = PROPERTY_USAGE_NO_EDITOR;
}
VisualInstance3D::_validate_property(property);
Node3D::_validate_property(property);
}
TypedArray<String> Decal::get_configuration_warnings() const {

View file

@ -390,6 +390,7 @@ void GPUParticles3D::_validate_property(PropertyInfo &property) const {
}
GeometryInstance3D::_validate_property(property);
Node3D::_validate_property(property);
}
void GPUParticles3D::emit_particle(const Transform3D &p_transform, const Vector3 &p_velocity, const Color &p_color, const Color &p_custom, uint32_t p_emit_flags) {

View file

@ -204,7 +204,9 @@ void Light3D::_validate_property(PropertyInfo &property) const {
// Angular distance is only used in DirectionalLight3D.
property.usage = PROPERTY_USAGE_NONE;
}
VisualInstance3D::_validate_property(property);
Node3D::_validate_property(property);
}
void Light3D::_bind_methods() {

View file

@ -1370,7 +1370,9 @@ void LightmapGI::_validate_property(PropertyInfo &property) const {
if (property.name == "environment_custom_energy" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) {
property.usage = PROPERTY_USAGE_NONE;
}
VisualInstance3D::_validate_property(property);
Node3D::_validate_property(property);
}
void LightmapGI::_bind_methods() {

View file

@ -507,6 +507,16 @@ void MeshInstance3D::_bind_methods() {
ADD_GROUP("", "");
}
void MeshInstance3D::_validate_property(PropertyInfo &property) const {
PackedStringArray split = property.name.split("/");
if (split.size() == 2 && split[0] == "blend_shapes") {
property.track_type = PROPERTY_TRACK_TYPE_BLEND_SHAPE;
}
GeometryInstance3D::_validate_property(property);
Node3D::_validate_property(property);
}
MeshInstance3D::MeshInstance3D() {
}

View file

@ -60,6 +60,7 @@ protected:
void _notification(int p_what);
static void _bind_methods();
void _validate_property(PropertyInfo &property) const override;
public:
void set_mesh(const Ref<Mesh> &p_mesh);

View file

@ -836,13 +836,28 @@ void Node3D::_validate_property(PropertyInfo &property) const {
}
if (data.rotation_edit_mode != ROTATION_EDIT_MODE_QUATERNION && property.name == "quaternion") {
property.usage = 0;
property.track_type = PROPERTY_TRACK_TYPE_ROTATION;
}
if (data.rotation_edit_mode != ROTATION_EDIT_MODE_EULER && property.name == "rotation") {
property.usage = 0;
property.track_type = PROPERTY_TRACK_TYPE_ROTATION;
}
if (data.rotation_edit_mode != ROTATION_EDIT_MODE_EULER && property.name == "rotation_order") {
property.usage = 0;
}
if (property.name == "position") {
property.track_type = PROPERTY_TRACK_TYPE_POSITION;
}
if (property.name == "rotation") {
property.track_type = PROPERTY_TRACK_TYPE_ROTATION;
}
if (property.name == "quaternion") {
property.track_type = PROPERTY_TRACK_TYPE_ROTATION;
}
if (property.name == "scale") {
property.track_type = PROPERTY_TRACK_TYPE_SCALE;
}
}
void Node3D::_bind_methods() {

View file

@ -134,8 +134,7 @@ protected:
void _notification(int p_what);
static void _bind_methods();
virtual void _validate_property(PropertyInfo &property) const override;
void _validate_property(PropertyInfo &property) const override;
public:
enum {

View file

@ -248,6 +248,7 @@ void PathFollow3D::_validate_property(PropertyInfo &property) const {
property.hint_string = "0," + rtos(max) + ",0.01,or_lesser,or_greater";
}
Node3D::_validate_property(property);
}

View file

@ -1098,7 +1098,9 @@ void RigidDynamicBody3D::_validate_property(PropertyInfo &property) const {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
}
}
PhysicsBody3D::_validate_property(property);
Node3D::_validate_property(property);
}
RigidDynamicBody3D::RigidDynamicBody3D() :

View file

@ -188,7 +188,9 @@ void ReflectionProbe::_validate_property(PropertyInfo &property) const {
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
}
}
VisualInstance3D::_validate_property(property);
Node3D::_validate_property(property);
}
void ReflectionProbe::_bind_methods() {

View file

@ -745,6 +745,7 @@ void Sprite3D::_validate_property(PropertyInfo &property) const {
}
SpriteBase3D::_validate_property(property);
Node3D::_validate_property(property);
}
void Sprite3D::_bind_methods() {