summaryrefslogtreecommitdiff
path: root/editor/animation_track_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/animation_track_editor.cpp')
-rw-r--r--editor/animation_track_editor.cpp70
1 files changed, 29 insertions, 41 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 42d5ea120e..4c4830ad7a 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -231,10 +231,10 @@ public:
if (Variant::can_convert(args[idx].get_type(), t)) {
Variant old = args[idx];
Variant *ptrs[1] = { &old };
- args[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
+ args.write[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
} else {
- args[idx] = Variant::construct(t, NULL, 0, err);
+ args.write[idx] = Variant::construct(t, NULL, 0, err);
}
change_notify_deserved = true;
d_new["args"] = args;
@@ -248,7 +248,7 @@ public:
_fix_node_path(value);
}
- args[idx] = value;
+ args.write[idx] = value;
d_new["args"] = args;
mergeable = true;
}
@@ -3014,12 +3014,12 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
if (res.is_valid()) {
property_info_base = res;
if (r_current_val) {
- *r_current_val = res->get(leftover_path[leftover_path.size() - 1]);
+ *r_current_val = res->get_indexed(leftover_path);
}
} else if (node) {
property_info_base = node;
if (r_current_val) {
- *r_current_val = node->get(leftover_path[leftover_path.size() - 1]);
+ *r_current_val = node->get_indexed(leftover_path);
}
}
@@ -3053,31 +3053,31 @@ static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool
subindices.push_back("");
} break;
case Variant::VECTOR2: {
- subindices.push_back(".x");
- subindices.push_back(".y");
+ subindices.push_back(":x");
+ subindices.push_back(":y");
} break;
case Variant::VECTOR3: {
- subindices.push_back(".x");
- subindices.push_back(".y");
- subindices.push_back(".z");
+ subindices.push_back(":x");
+ subindices.push_back(":y");
+ subindices.push_back(":z");
} break;
case Variant::QUAT: {
- subindices.push_back(".x");
- subindices.push_back(".y");
- subindices.push_back(".z");
- subindices.push_back(".w");
+ subindices.push_back(":x");
+ subindices.push_back(":y");
+ subindices.push_back(":z");
+ subindices.push_back(":w");
} break;
case Variant::COLOR: {
- subindices.push_back(".r");
- subindices.push_back(".g");
- subindices.push_back(".b");
- subindices.push_back(".a");
+ subindices.push_back(":r");
+ subindices.push_back(":g");
+ subindices.push_back(":b");
+ subindices.push_back(":a");
} break;
case Variant::PLANE: {
- subindices.push_back(".x");
- subindices.push_back(".y");
- subindices.push_back(".z");
- subindices.push_back(".d");
+ subindices.push_back(":x");
+ subindices.push_back(":y");
+ subindices.push_back(":z");
+ subindices.push_back(":d");
} break;
default: {
if (r_valid) {
@@ -3288,35 +3288,23 @@ void AnimationTrackEditor::_update_tracks() {
if (root && root->has_node_and_resource(path)) {
RES res;
+ NodePath base_path;
Vector<StringName> leftover_path;
Node *node = root->get_node_and_resource(path, res, leftover_path, true);
+ PropertyInfo pinfo = _find_hint_for_track(i, base_path);
Object *object = node;
if (res.is_valid()) {
object = res.ptr();
- } else {
- object = node;
}
if (object && !leftover_path.empty()) {
- //not a property (value track?)
- PropertyInfo pinfo;
- pinfo.name = leftover_path[leftover_path.size() - 1];
- //now let's see if we can get more info about it
-
- List<PropertyInfo> plist;
- object->get_property_list(&plist);
-
- for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
-
- if (E->get().name == leftover_path[leftover_path.size() - 1]) {
- pinfo = E->get();
- break;
- }
+ if (pinfo.name.empty()) {
+ pinfo.name = leftover_path[leftover_path.size() - 1];
}
for (int j = 0; j < track_edit_plugins.size(); j++) {
- track_edit = track_edit_plugins[j]->create_value_track_edit(object, pinfo.type, pinfo.name, pinfo.hint, pinfo.hint_string, pinfo.usage);
+ track_edit = track_edit_plugins.write[j]->create_value_track_edit(object, pinfo.type, pinfo.name, pinfo.hint, pinfo.hint_string, pinfo.usage);
if (track_edit) {
break;
}
@@ -3327,7 +3315,7 @@ void AnimationTrackEditor::_update_tracks() {
if (animation->track_get_type(i) == Animation::TYPE_AUDIO) {
for (int j = 0; j < track_edit_plugins.size(); j++) {
- track_edit = track_edit_plugins[j]->create_audio_track_edit();
+ track_edit = track_edit_plugins.write[j]->create_audio_track_edit();
if (track_edit) {
break;
}
@@ -3344,7 +3332,7 @@ void AnimationTrackEditor::_update_tracks() {
if (node && Object::cast_to<AnimationPlayer>(node)) {
for (int j = 0; j < track_edit_plugins.size(); j++) {
- track_edit = track_edit_plugins[j]->create_animation_track_edit(node);
+ track_edit = track_edit_plugins.write[j]->create_animation_track_edit(node);
if (track_edit) {
break;
}