You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #100437 from KoBeWi/ruaninstancequestionmark
Add `is_instance()` helper method to Node
This commit is contained in:
@@ -670,7 +670,7 @@ void SceneTreeEditor::_update_node_tooltip(Node *p_node, TreeItem *p_item) {
|
||||
p_item->add_button(0, get_editor_theme_icon(SNAME("InstanceOptions")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
|
||||
}
|
||||
tooltip += String("\n" + TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path());
|
||||
} else if (p_node != get_scene_node() && !p_node->get_scene_file_path().is_empty() && can_open_instance) {
|
||||
} else if (p_node != get_scene_node() && p_node->is_instance() && can_open_instance) {
|
||||
if (p_item->get_button_by_id(0, BUTTON_SUBSCENE) == -1) {
|
||||
p_item->add_button(0, get_editor_theme_icon(SNAME("InstanceOptions")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
|
||||
}
|
||||
@@ -1532,7 +1532,7 @@ void SceneTreeEditor::rename_node(Node *p_node, const String &p_name, TreeItem *
|
||||
// Trim leading/trailing whitespace to prevent node names from containing accidental whitespace,
|
||||
// which would make it more difficult to get the node via `get_node()`.
|
||||
new_name = new_name.strip_edges();
|
||||
if (new_name.is_empty() && p_node->get_owner() != nullptr && !p_node->get_scene_file_path().is_empty()) {
|
||||
if (new_name.is_empty() && p_node->get_owner() != nullptr && p_node->is_instance()) {
|
||||
// If name is empty and node is root of an instance, revert to the original name.
|
||||
const Ref<PackedScene> node_scene = ResourceLoader::load(p_node->get_scene_file_path());
|
||||
if (node_scene.is_valid()) {
|
||||
@@ -1966,7 +1966,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
Node *n = get_node(nodes[i]);
|
||||
// Nodes from an instantiated scene can't be rearranged.
|
||||
if (n && n->get_owner() && n->get_owner() != get_scene_node() && !n->get_owner()->get_scene_file_path().is_empty()) {
|
||||
if (n && n->get_owner() && n->get_owner() != get_scene_node() && n->get_owner()->is_instance()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user