diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_editor.cpp | 40 | ||||
-rw-r--r-- | editor/plugins/animation_tree_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 2 |
3 files changed, 31 insertions, 17 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index ae304ed0bc..1d70f8ba55 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -966,7 +966,9 @@ void AnimationKeyEditor::_cleanup_animation(Ref<Animation> p_animation) { Object *obj = NULL; RES res; - Node *node = root->get_node_and_resource(p_animation->track_get_path(i), res); + Vector<StringName> leftover_path; + + Node *node = root->get_node_and_resource(p_animation->track_get_path(i), res, leftover_path); if (res.is_valid()) { obj = res.ptr(); @@ -975,7 +977,7 @@ void AnimationKeyEditor::_cleanup_animation(Ref<Animation> p_animation) { } if (obj && p_animation->track_get_type(i) == Animation::TYPE_VALUE) { - valid_type = obj->get_static_property_type(p_animation->track_get_path(i).get_property(), &prop_exists); + valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists); } if (!obj && cleanup_tracks->is_pressed()) { @@ -1315,7 +1317,9 @@ void AnimationKeyEditor::_track_editor_draw() { Object *obj = NULL; RES res; - Node *node = root ? root->get_node_and_resource(animation->track_get_path(idx), res) : (Node *)NULL; + Vector<StringName> leftover_path; + + Node *node = root ? root->get_node_and_resource(animation->track_get_path(idx), res, leftover_path) : (Node *)NULL; if (res.is_valid()) { obj = res.ptr(); @@ -1324,7 +1328,8 @@ void AnimationKeyEditor::_track_editor_draw() { } if (obj && animation->track_get_type(idx) == Animation::TYPE_VALUE) { - valid_type = obj->get_static_property_type(animation->track_get_path(idx).get_property(), &prop_exists); + // While leftover_path might be still empty, we wouldn't be able to get here anyway + valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists); } if (/*mouse_over.over!=MouseOver::OVER_NONE &&*/ idx == mouse_over.track) { @@ -1648,26 +1653,34 @@ PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx, NodePath &r_bas return PropertyInfo(); RES res; - Node *node = root->get_node_and_resource(path, res); + Vector<StringName> leftover_path; + Node *node = root->get_node_and_resource(path, res, leftover_path, true); if (node) { r_base_path = node->get_path(); } - String property = path.get_property(); - if (property == "") + if (leftover_path.empty()) return PropertyInfo(); - List<PropertyInfo> pinfo; + Variant property_info_base; if (res.is_valid()) - res->get_property_list(&pinfo); + property_info_base = res; else if (node) - node->get_property_list(&pinfo); + property_info_base = node; + + for (int i = 0; i < leftover_path.size() - 1; i++) { + property_info_base = property_info_base.get_named(leftover_path[i]); + } + + List<PropertyInfo> pinfo; + property_info_base.get_property_list(&pinfo); for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { - if (E->get().name == property) + if (E->get().name == leftover_path[leftover_path.size() - 1]) { return E->get(); + } } return PropertyInfo(); @@ -2779,7 +2792,8 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input) Object *obj = NULL; RES res; - Node *node = root->get_node_and_resource(animation->track_get_path(idx), res); + Vector<StringName> leftover_path; + Node *node = root->get_node_and_resource(animation->track_get_path(idx), res, leftover_path); if (res.is_valid()) { obj = res.ptr(); @@ -2788,7 +2802,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input) } if (obj) { - valid_type = obj->get_static_property_type(animation->track_get_path(idx).get_property(), &prop_exists); + valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists); } text += "type: " + Variant::get_type_name(v.get_type()) + "\n"; diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 22d23e1c72..8fe6538653 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -1196,14 +1196,14 @@ void AnimationTreeEditor::_edit_filters() { if (base) { NodePath np = E->get(); - if (np.get_property() != StringName()) { + if (np.get_subname_count() == 1) { Node *n = base->get_node(np); Skeleton *s = Object::cast_to<Skeleton>(n); if (s) { String skelbase = E->get().substr(0, E->get().find(":")); - int bidx = s->find_bone(np.get_property()); + int bidx = s->find_bone(np.get_subname(0)); if (bidx != -1) { int bparent = s->get_bone_parent(bidx); @@ -1213,7 +1213,7 @@ void AnimationTreeEditor::_edit_filters() { String bpn = skelbase + ":" + s->get_bone_name(bparent); if (pm.has(bpn)) { parent = pm[bpn]; - descr = np.get_property(); + descr = np.get_subname(0); } } else { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 1d2647badc..a97a5630e6 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -986,7 +986,7 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List<Pair<NodePath, NodeP //will be renamed NodePath rel_path = new_root_path.rel_path_to(E->get().second); - NodePath new_path = NodePath(rel_path.get_names(), track_np.get_subnames(), false, track_np.get_property()); + NodePath new_path = NodePath(rel_path.get_names(), track_np.get_subnames(), false); if (new_path == track_np) continue; //bleh editor_data->get_undo_redo().add_do_method(anim.ptr(), "track_set_path", i, new_path); |