mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-09 13:22:37 +02:00
Allow dragging editable children
This commit is contained in:
parent
88fd023a06
commit
838b46ac1a
@ -72,7 +72,7 @@
|
|||||||
#include "editor_code_editor/editor_script_editor_base.h"
|
#include "editor_code_editor/editor_script_editor_base.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Node *SceneTreeEditor::get_scene_node() {
|
Node *SceneTreeEditor::get_scene_node() const {
|
||||||
ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
|
ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
|
||||||
|
|
||||||
return get_tree()->get_edited_scene_root();
|
return get_tree()->get_edited_scene_root();
|
||||||
@ -1033,11 +1033,8 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
|
|||||||
|
|
||||||
Node *n = get_node(np);
|
Node *n = get_node(np);
|
||||||
if (n) {
|
if (n) {
|
||||||
// Only allow selection if not part of an instanced scene.
|
selected.push_back(n);
|
||||||
if (!n->get_owner() || n->get_owner() == get_scene_node() || n->get_owner()->get_filename() == String()) {
|
icons.push_back(next->get_icon(0));
|
||||||
selected.push_back(n);
|
|
||||||
icons.push_back(next->get_icon(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
next = tree->get_next_selected(next);
|
next = tree->get_next_selected(next);
|
||||||
}
|
}
|
||||||
@ -1150,7 +1147,21 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return String(d["type"]) == "nodes" && filter == String();
|
if (filter.empty() && String(d["type"]) == "nodes") {
|
||||||
|
Array nodes = d["nodes"];
|
||||||
|
|
||||||
|
for (int i = 0; i < nodes.size(); i++) {
|
||||||
|
Node *n = get_node(nodes[i]);
|
||||||
|
// Only allow selection if not part of an instanced scene.
|
||||||
|
if (n && n->get_owner() && n->get_owner() != get_scene_node() && !n->get_owner()->get_filename().empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
|
void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
|
||||||
if (!can_drop_data_fw(p_point, p_data, p_from)) {
|
if (!can_drop_data_fw(p_point, p_data, p_from)) {
|
||||||
|
@ -129,7 +129,7 @@ class SceneTreeEditor : public Control {
|
|||||||
void _update_visibility_color(Node *p_node, TreeItem *p_item);
|
void _update_visibility_color(Node *p_node, TreeItem *p_item);
|
||||||
|
|
||||||
void _selection_changed();
|
void _selection_changed();
|
||||||
Node *get_scene_node();
|
Node *get_scene_node() const;
|
||||||
|
|
||||||
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
||||||
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
|
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user