mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Remove more instances of 'instance' being used as a verb
This commit is contained in:
parent
a1bc636098
commit
3b4f5f8a04
@ -150,7 +150,7 @@
|
||||
<param index="1" name="pinned" type="bool" />
|
||||
<description>
|
||||
Emit it if you want to mark (or unmark) the value of a property for being saved regardless of being equal to the default value.
|
||||
The default value is the one the property will get when the node is just instantiated and can come from an ancestor scene in the inheritance/instancing chain, a script or a builtin class.
|
||||
The default value is the one the property will get when the node is just instantiated and can come from an ancestor scene in the inheritance/instantiation chain, a script or a builtin class.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="resource_selected">
|
||||
|
@ -46,7 +46,7 @@
|
||||
<description>
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="instance">
|
||||
<signal name="instantiate">
|
||||
<param index="0" name="files" type="PackedStringArray" />
|
||||
<description>
|
||||
</description>
|
||||
|
@ -991,7 +991,7 @@
|
||||
<constant name="DUPLICATE_SCRIPTS" value="4" enum="DuplicateFlags">
|
||||
Duplicate the node's scripts.
|
||||
</constant>
|
||||
<constant name="DUPLICATE_USE_INSTANCING" value="8" enum="DuplicateFlags">
|
||||
<constant name="DUPLICATE_USE_INSTANTIATION" value="8" enum="DuplicateFlags">
|
||||
Duplicate using instancing.
|
||||
An instance stays linked to the original so when the original changes, the instance changes too.
|
||||
</constant>
|
||||
|
@ -501,7 +501,7 @@ String CreateDialog::get_selected_type() {
|
||||
return selected->get_text(0);
|
||||
}
|
||||
|
||||
Variant CreateDialog::instance_selected() {
|
||||
Variant CreateDialog::instantiate_selected() {
|
||||
TreeItem *selected = search_options->get_selected();
|
||||
|
||||
if (!selected) {
|
||||
@ -519,7 +519,7 @@ Variant CreateDialog::instance_selected() {
|
||||
n->set_name(custom);
|
||||
}
|
||||
} else {
|
||||
obj = EditorNode::get_editor_data().instance_custom_type(selected->get_text(0), custom);
|
||||
obj = EditorNode::get_editor_data().instantiate_custom_type(selected->get_text(0), custom);
|
||||
}
|
||||
} else {
|
||||
obj = ClassDB::instantiate(selected->get_text(0));
|
||||
|
@ -110,7 +110,7 @@ protected:
|
||||
void _save_and_update_favorite_list();
|
||||
|
||||
public:
|
||||
Variant instance_selected();
|
||||
Variant instantiate_selected();
|
||||
String get_selected_type();
|
||||
|
||||
void set_base_type(const String &p_base) { base_type = p_base; }
|
||||
|
@ -167,7 +167,7 @@ void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_d
|
||||
void EditorDebuggerNode::_bind_methods() {
|
||||
// LiveDebug.
|
||||
ClassDB::bind_method("live_debug_create_node", &EditorDebuggerNode::live_debug_create_node);
|
||||
ClassDB::bind_method("live_debug_instance_node", &EditorDebuggerNode::live_debug_instance_node);
|
||||
ClassDB::bind_method("live_debug_instantiate_node", &EditorDebuggerNode::live_debug_instantiate_node);
|
||||
ClassDB::bind_method("live_debug_remove_node", &EditorDebuggerNode::live_debug_remove_node);
|
||||
ClassDB::bind_method("live_debug_remove_and_keep_node", &EditorDebuggerNode::live_debug_remove_and_keep_node);
|
||||
ClassDB::bind_method("live_debug_restore_node", &EditorDebuggerNode::live_debug_restore_node);
|
||||
@ -676,9 +676,9 @@ void EditorDebuggerNode::live_debug_create_node(const NodePath &p_parent, const
|
||||
});
|
||||
}
|
||||
|
||||
void EditorDebuggerNode::live_debug_instance_node(const NodePath &p_parent, const String &p_path, const String &p_name) {
|
||||
void EditorDebuggerNode::live_debug_instantiate_node(const NodePath &p_parent, const String &p_path, const String &p_name) {
|
||||
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
||||
dbg->live_debug_instance_node(p_parent, p_path, p_name);
|
||||
dbg->live_debug_instantiate_node(p_parent, p_path, p_name);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
void set_live_debugging(bool p_enabled);
|
||||
void update_live_edit_root();
|
||||
void live_debug_create_node(const NodePath &p_parent, const String &p_type, const String &p_name);
|
||||
void live_debug_instance_node(const NodePath &p_parent, const String &p_path, const String &p_name);
|
||||
void live_debug_instantiate_node(const NodePath &p_parent, const String &p_path, const String &p_name);
|
||||
void live_debug_remove_node(const NodePath &p_at);
|
||||
void live_debug_remove_and_keep_node(const NodePath &p_at, ObjectID p_keep_id);
|
||||
void live_debug_restore_node(ObjectID p_id, const NodePath &p_at, int p_at_pos);
|
||||
|
@ -1283,13 +1283,13 @@ void ScriptEditorDebugger::live_debug_create_node(const NodePath &p_parent, cons
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEditorDebugger::live_debug_instance_node(const NodePath &p_parent, const String &p_path, const String &p_name) {
|
||||
void ScriptEditorDebugger::live_debug_instantiate_node(const NodePath &p_parent, const String &p_path, const String &p_name) {
|
||||
if (live_debug) {
|
||||
Array msg;
|
||||
msg.push_back(p_parent);
|
||||
msg.push_back(p_path);
|
||||
msg.push_back(p_name);
|
||||
_put_msg("scene:live_instance_node", msg);
|
||||
_put_msg("scene:live_instantiate_node", msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1626,7 +1626,7 @@ void ScriptEditorDebugger::_tab_changed(int p_tab) {
|
||||
|
||||
void ScriptEditorDebugger::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("live_debug_create_node"), &ScriptEditorDebugger::live_debug_create_node);
|
||||
ClassDB::bind_method(D_METHOD("live_debug_instance_node"), &ScriptEditorDebugger::live_debug_instance_node);
|
||||
ClassDB::bind_method(D_METHOD("live_debug_instantiate_node"), &ScriptEditorDebugger::live_debug_instantiate_node);
|
||||
ClassDB::bind_method(D_METHOD("live_debug_remove_node"), &ScriptEditorDebugger::live_debug_remove_node);
|
||||
ClassDB::bind_method(D_METHOD("live_debug_remove_and_keep_node"), &ScriptEditorDebugger::live_debug_remove_and_keep_node);
|
||||
ClassDB::bind_method(D_METHOD("live_debug_restore_node"), &ScriptEditorDebugger::live_debug_restore_node);
|
||||
|
@ -266,7 +266,7 @@ public:
|
||||
void set_live_debugging(bool p_enable);
|
||||
|
||||
void live_debug_create_node(const NodePath &p_parent, const String &p_type, const String &p_name);
|
||||
void live_debug_instance_node(const NodePath &p_parent, const String &p_path, const String &p_name);
|
||||
void live_debug_instantiate_node(const NodePath &p_parent, const String &p_path, const String &p_name);
|
||||
void live_debug_remove_node(const NodePath &p_at);
|
||||
void live_debug_remove_and_keep_node(const NodePath &p_at, ObjectID p_keep_id);
|
||||
void live_debug_restore_node(ObjectID p_id, const NodePath &p_at, int p_at_pos);
|
||||
|
@ -486,7 +486,7 @@ void EditorData::add_custom_type(const String &p_type, const String &p_inherits,
|
||||
custom_types[p_inherits].push_back(ct);
|
||||
}
|
||||
|
||||
Variant EditorData::instance_custom_type(const String &p_type, const String &p_inherits) {
|
||||
Variant EditorData::instantiate_custom_type(const String &p_type, const String &p_inherits) {
|
||||
if (get_custom_types().has(p_inherits)) {
|
||||
for (int i = 0; i < get_custom_types()[p_inherits].size(); i++) {
|
||||
if (get_custom_types()[p_inherits][i].name == p_type) {
|
||||
|
@ -181,7 +181,7 @@ public:
|
||||
void restore_editor_global_states();
|
||||
|
||||
void add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon);
|
||||
Variant instance_custom_type(const String &p_type, const String &p_inherits);
|
||||
Variant instantiate_custom_type(const String &p_type, const String &p_inherits);
|
||||
void remove_custom_type(const String &p_type);
|
||||
const HashMap<String, Vector<CustomType>> &get_custom_types() const { return custom_types; }
|
||||
const CustomType *get_custom_type_by_name(const String &p_name) const;
|
||||
|
@ -1763,7 +1763,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
|
||||
}
|
||||
|
||||
if (!scene->get_scene_file_path().is_empty() && _validate_scene_recursive(scene->get_scene_file_path(), scene)) {
|
||||
show_accept(TTR("This scene can't be saved because there is a cyclic instancing inclusion.\nPlease resolve it and then attempt to save again."), TTR("OK"));
|
||||
show_accept(TTR("This scene can't be saved because there is a cyclic instance inclusion.\nPlease resolve it and then attempt to save again."), TTR("OK"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2331,7 +2331,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
|
||||
if (get_edited_scene() && !get_edited_scene()->get_scene_file_path().is_empty()) {
|
||||
String source_scene = get_edited_scene()->get_scene_file_path();
|
||||
if (FileAccess::exists(source_scene + ".import")) {
|
||||
editable_info = TTR("This scene was imported, so changes to it won't be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
|
||||
editable_info = TTR("This scene was imported, so changes to it won't be kept.\nInstantiating or inheriting it will allow you to make changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
|
||||
info_is_warning = true;
|
||||
}
|
||||
}
|
||||
@ -3992,7 +3992,7 @@ bool EditorNode::is_resource_read_only(Ref<Resource> p_resource, bool p_foreign_
|
||||
return false;
|
||||
}
|
||||
|
||||
void EditorNode::request_instance_scene(const String &p_path) {
|
||||
void EditorNode::request_instantiate_scene(const String &p_path) {
|
||||
SceneTreeDock::get_singleton()->instantiate(p_path);
|
||||
}
|
||||
|
||||
@ -7096,7 +7096,7 @@ EditorNode::EditorNode() {
|
||||
|
||||
FileSystemDock *filesystem_dock = memnew(FileSystemDock);
|
||||
filesystem_dock->connect("inherit", callable_mp(this, &EditorNode::_inherit_request));
|
||||
filesystem_dock->connect("instance", callable_mp(this, &EditorNode::_instantiate_request));
|
||||
filesystem_dock->connect("instantiate", callable_mp(this, &EditorNode::_instantiate_request));
|
||||
filesystem_dock->connect("display_mode_changed", callable_mp(this, &EditorNode::_save_docks));
|
||||
get_project_settings()->connect_filesystem_dock_signals(filesystem_dock);
|
||||
|
||||
|
@ -814,7 +814,7 @@ public:
|
||||
|
||||
void setup_color_picker(ColorPicker *picker);
|
||||
|
||||
void request_instance_scene(const String &p_path);
|
||||
void request_instantiate_scene(const String &p_path);
|
||||
void request_instantiate_scenes(const Vector<String> &p_files);
|
||||
|
||||
void set_convert_old_scene(bool p_old) { convert_old = p_old; }
|
||||
|
@ -438,7 +438,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
|
||||
obj = EditorNode::get_editor_data().instantiate_custom_type(intype, "Resource");
|
||||
}
|
||||
|
||||
Resource *resp = Object::cast_to<Resource>(obj);
|
||||
|
@ -1847,8 +1847,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
||||
}
|
||||
} break;
|
||||
|
||||
case FILE_INSTANCE: {
|
||||
// Instance all selected scenes.
|
||||
case FILE_INSTANTIATE: {
|
||||
// Instantiate all selected scenes.
|
||||
Vector<String> paths;
|
||||
for (int i = 0; i < p_selected.size(); i++) {
|
||||
String fpath = p_selected[i];
|
||||
@ -1857,7 +1857,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
||||
}
|
||||
}
|
||||
if (!paths.is_empty()) {
|
||||
emit_signal(SNAME("instance"), paths);
|
||||
emit_signal(SNAME("instantiate"), paths);
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -2072,7 +2072,7 @@ void FileSystemDock::_resource_created() {
|
||||
return;
|
||||
}
|
||||
|
||||
Variant c = new_resource_dialog->instance_selected();
|
||||
Variant c = new_resource_dialog->instantiate_selected();
|
||||
|
||||
ERR_FAIL_COND(!c);
|
||||
Resource *r = Object::cast_to<Resource>(c);
|
||||
@ -2535,7 +2535,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
|
||||
} else {
|
||||
p_popup->add_icon_item(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")), TTR("Open Scenes"), FILE_OPEN);
|
||||
}
|
||||
p_popup->add_icon_item(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Instance"), FILE_INSTANCE);
|
||||
p_popup->add_icon_item(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Instantiate"), FILE_INSTANTIATE);
|
||||
p_popup->add_separator();
|
||||
} else if (filenames.size() == 1) {
|
||||
p_popup->add_icon_item(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")), TTR("Open"), FILE_OPEN);
|
||||
@ -3018,7 +3018,7 @@ void FileSystemDock::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file")));
|
||||
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
|
||||
ADD_SIGNAL(MethodInfo("instantiate", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
|
||||
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
|
||||
|
@ -79,7 +79,7 @@ private:
|
||||
FILE_OPEN,
|
||||
FILE_INHERIT,
|
||||
FILE_MAIN_SCENE,
|
||||
FILE_INSTANCE,
|
||||
FILE_INSTANTIATE,
|
||||
FILE_ADD_FAVORITE,
|
||||
FILE_REMOVE_FAVORITE,
|
||||
FILE_DEPENDENCIES,
|
||||
|
@ -365,7 +365,7 @@ void InspectorDock::_select_history(int p_idx) {
|
||||
}
|
||||
|
||||
void InspectorDock::_resource_created() {
|
||||
Variant c = new_resource_dialog->instance_selected();
|
||||
Variant c = new_resource_dialog->instantiate_selected();
|
||||
|
||||
ERR_FAIL_COND(!c);
|
||||
Resource *r = Object::cast_to<Resource>(c);
|
||||
|
@ -5624,13 +5624,13 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
|
||||
}
|
||||
|
||||
Node *instantiated_scene = sdata->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE);
|
||||
if (!instantiated_scene) { // error on instancing
|
||||
if (!instantiated_scene) { // Error on instantiation.
|
||||
return false;
|
||||
}
|
||||
|
||||
Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
|
||||
|
||||
if (!edited_scene->get_scene_file_path().is_empty()) { // cyclical instancing
|
||||
if (!edited_scene->get_scene_file_path().is_empty()) { // Cyclic instantiation.
|
||||
if (_cyclical_dependency_exists(edited_scene->get_scene_file_path(), instantiated_scene)) {
|
||||
memdelete(instantiated_scene);
|
||||
return false;
|
||||
@ -5647,7 +5647,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
|
||||
|
||||
String new_name = parent->validate_child_name(instantiated_scene);
|
||||
EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
|
||||
undo_redo->add_do_method(ed, "live_debug_instance_node", edited_scene->get_path_to(parent), path, new_name);
|
||||
undo_redo->add_do_method(ed, "live_debug_instantiate_node", edited_scene->get_path_to(parent), path, new_name);
|
||||
undo_redo->add_undo_method(ed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)) + "/" + new_name));
|
||||
|
||||
CanvasItem *instance_ci = Object::cast_to<CanvasItem>(instantiated_scene);
|
||||
@ -5720,7 +5720,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
|
||||
files_str += error_files[i].get_file().get_basename() + ",";
|
||||
}
|
||||
files_str = files_str.substr(0, files_str.length() - 1);
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.get_data()));
|
||||
accept->set_text(vformat(TTR("Error instantiating scene from %s"), files_str.get_data()));
|
||||
accept->popup_centered();
|
||||
}
|
||||
}
|
||||
|
@ -4039,7 +4039,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path().is_empty()) { // cyclical instancing
|
||||
if (!EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path().is_empty()) { // Cyclic instantiation.
|
||||
if (_cyclical_dependency_exists(EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path(), instantiated_scene)) {
|
||||
memdelete(instantiated_scene);
|
||||
return false;
|
||||
@ -4058,7 +4058,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
|
||||
|
||||
String new_name = parent->validate_child_name(instantiated_scene);
|
||||
EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
|
||||
undo_redo->add_do_method(ed, "live_debug_instance_node", EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent), path, new_name);
|
||||
undo_redo->add_do_method(ed, "live_debug_instantiate_node", EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent), path, new_name);
|
||||
undo_redo->add_undo_method(ed, "live_debug_remove_node", NodePath(String(EditorNode::get_singleton()->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
|
||||
|
||||
Node3D *node3d = Object::cast_to<Node3D>(instantiated_scene);
|
||||
@ -4129,7 +4129,7 @@ void Node3DEditorViewport::_perform_drop_data() {
|
||||
files_str += error_files[i].get_file().get_basename() + ",";
|
||||
}
|
||||
files_str = files_str.substr(0, files_str.length() - 1);
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.get_data()));
|
||||
accept->set_text(vformat(TTR("Error instantiating scene from %s"), files_str.get_data()));
|
||||
accept->popup_centered();
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ Node *SceneCreateDialog::create_scene_root() {
|
||||
root = gui_ctl;
|
||||
} break;
|
||||
case ROOT_OTHER:
|
||||
root = Object::cast_to<Node>(select_node_dialog->instance_selected());
|
||||
root = Object::cast_to<Node>(select_node_dialog->instantiate_selected());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ void SceneTreeDock::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
#endif // MODULE_REGEX_ENABLED
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
|
||||
_tool_selected(TOOL_NEW);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) {
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/instantiate_scene", p_event)) {
|
||||
_tool_selected(TOOL_INSTANTIATE);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/expand_collapse_all", p_event)) {
|
||||
_tool_selected(TOOL_EXPAND_COLLAPSE);
|
||||
@ -198,7 +198,7 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N
|
||||
Node *instantiated_scene = sdata->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE);
|
||||
if (!instantiated_scene) {
|
||||
current_option = -1;
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), p_files[i]));
|
||||
accept->set_text(vformat(TTR("Error instantiating scene from %s"), p_files[i]));
|
||||
accept->popup_centered();
|
||||
error = true;
|
||||
break;
|
||||
@ -206,7 +206,7 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N
|
||||
|
||||
if (!edited_scene->get_scene_file_path().is_empty()) {
|
||||
if (_cyclical_dependency_exists(edited_scene->get_scene_file_path(), instantiated_scene)) {
|
||||
accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."), p_files[i]));
|
||||
accept->set_text(vformat(TTR("Cannot instantiate the scene '%s' because the current scene exists within one of its nodes."), p_files[i]));
|
||||
accept->popup_centered();
|
||||
error = true;
|
||||
break;
|
||||
@ -225,7 +225,7 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N
|
||||
return;
|
||||
}
|
||||
|
||||
editor_data->get_undo_redo()->create_action(TTR("Instance Scene(s)"));
|
||||
editor_data->get_undo_redo()->create_action(TTR("Instantiate Scene(s)"));
|
||||
|
||||
for (int i = 0; i < instances.size(); i++) {
|
||||
Node *instantiated_scene = instances[i];
|
||||
@ -242,7 +242,7 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N
|
||||
|
||||
String new_name = parent->validate_child_name(instantiated_scene);
|
||||
EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton();
|
||||
editor_data->get_undo_redo()->add_do_method(ed, "live_debug_instance_node", edited_scene->get_path_to(parent), p_files[i], new_name);
|
||||
editor_data->get_undo_redo()->add_do_method(ed, "live_debug_instantiate_node", edited_scene->get_path_to(parent), p_files[i], new_name);
|
||||
editor_data->get_undo_redo()->add_undo_method(ed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)).path_join(new_name)));
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base)
|
||||
|
||||
Node *instantiated_scene = sdata->instantiate(PackedScene::GEN_EDIT_STATE_INSTANCE);
|
||||
if (!instantiated_scene) {
|
||||
accept->set_text(vformat(TTR("Error instancing scene from %s"), p_file));
|
||||
accept->set_text(vformat(TTR("Error instantiating scene from %s"), p_file));
|
||||
accept->popup_centered();
|
||||
return;
|
||||
}
|
||||
@ -2177,7 +2177,7 @@ void SceneTreeDock::_selection_changed() {
|
||||
}
|
||||
|
||||
void SceneTreeDock::_do_create(Node *p_parent) {
|
||||
Variant c = create_dialog->instance_selected();
|
||||
Variant c = create_dialog->instantiate_selected();
|
||||
Node *child = Object::cast_to<Node>(c);
|
||||
ERR_FAIL_COND(!child);
|
||||
|
||||
@ -2261,7 +2261,7 @@ void SceneTreeDock::_create() {
|
||||
for (Node *n : selection) {
|
||||
ERR_FAIL_COND(!n);
|
||||
|
||||
Variant c = create_dialog->instance_selected();
|
||||
Variant c = create_dialog->instantiate_selected();
|
||||
|
||||
ERR_FAIL_COND(!c);
|
||||
Node *newnode = Object::cast_to<Node>(c);
|
||||
@ -2686,7 +2686,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
menu->clear();
|
||||
if (profile_allow_editing) {
|
||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
|
||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANTIATE);
|
||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/instantiate_scene"), TOOL_INSTANTIATE);
|
||||
}
|
||||
|
||||
menu->reset_size();
|
||||
@ -2719,7 +2719,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
}
|
||||
|
||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
|
||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANTIATE);
|
||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/instantiate_scene"), TOOL_INSTANTIATE);
|
||||
}
|
||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Collapse"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/expand_collapse_all"), TOOL_EXPAND_COLLAPSE);
|
||||
menu->add_separator();
|
||||
@ -3445,7 +3445,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
||||
ED_SHORTCUT_OVERRIDE("scene_tree/batch_rename", "macos", KeyModifierMask::SHIFT | Key::ENTER);
|
||||
|
||||
ED_SHORTCUT("scene_tree/add_child_node", TTR("Add Child Node"), KeyModifierMask::CMD_OR_CTRL | Key::A);
|
||||
ED_SHORTCUT("scene_tree/instance_scene", TTR("Instantiate Child Scene"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::A);
|
||||
ED_SHORTCUT("scene_tree/instantiate_scene", TTR("Instantiate Child Scene"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::A);
|
||||
ED_SHORTCUT("scene_tree/expand_collapse_all", TTR("Expand/Collapse Branch"));
|
||||
ED_SHORTCUT("scene_tree/cut_node", TTR("Cut"), KeyModifierMask::CMD_OR_CTRL | Key::X);
|
||||
ED_SHORTCUT("scene_tree/copy_node", TTR("Copy"), KeyModifierMask::CMD_OR_CTRL | Key::C);
|
||||
@ -3477,7 +3477,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
||||
button_instance->set_flat(true);
|
||||
button_instance->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_INSTANTIATE, false));
|
||||
button_instance->set_tooltip_text(TTR("Instantiate a scene file as a Node. Creates an inherited scene if no root node exists."));
|
||||
button_instance->set_shortcut(ED_GET_SHORTCUT("scene_tree/instance_scene"));
|
||||
button_instance->set_shortcut(ED_GET_SHORTCUT("scene_tree/instantiate_scene"));
|
||||
filter_hbc->add_child(button_instance);
|
||||
vbc->add_child(filter_hbc);
|
||||
|
||||
|
@ -264,7 +264,7 @@ Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Arra
|
||||
ERR_FAIL_COND_V(p_args.size() < 3, ERR_INVALID_DATA);
|
||||
live_editor->_create_node_func(p_args[0], p_args[1], p_args[2]);
|
||||
|
||||
} else if (p_msg == "live_instance_node") {
|
||||
} else if (p_msg == "live_instantiate_node") {
|
||||
ERR_FAIL_COND_V(p_args.size() < 3, ERR_INVALID_DATA);
|
||||
live_editor->_instance_node_func(p_args[0], p_args[1], p_args[2]);
|
||||
|
||||
|
@ -2060,7 +2060,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
||||
nip->set_instance_path(ip->get_instance_path());
|
||||
node = nip;
|
||||
|
||||
} else if ((p_flags & DUPLICATE_USE_INSTANCING) && !get_scene_file_path().is_empty()) {
|
||||
} else if ((p_flags & DUPLICATE_USE_INSTANTIATION) && !get_scene_file_path().is_empty()) {
|
||||
Ref<PackedScene> res = ResourceLoader::load(get_scene_file_path());
|
||||
ERR_FAIL_COND_V(res.is_null(), nullptr);
|
||||
PackedScene::GenEditState ges = PackedScene::GEN_EDIT_STATE_DISABLED;
|
||||
@ -2246,7 +2246,7 @@ Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap) con
|
||||
}
|
||||
|
||||
Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {
|
||||
Node *dupe = _duplicate(DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS | DUPLICATE_USE_INSTANCING | DUPLICATE_FROM_EDITOR, &r_duplimap);
|
||||
Node *dupe = _duplicate(DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS | DUPLICATE_USE_INSTANTIATION | DUPLICATE_FROM_EDITOR, &r_duplimap);
|
||||
|
||||
// This is used by SceneTreeDock's paste functionality. When pasting to foreign scene, resources are duplicated.
|
||||
if (!p_resource_remap.is_empty()) {
|
||||
@ -2812,7 +2812,7 @@ void Node::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_tree"), &Node::get_tree);
|
||||
ClassDB::bind_method(D_METHOD("create_tween"), &Node::create_tween);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("duplicate", "flags"), &Node::duplicate, DEFVAL(DUPLICATE_USE_INSTANCING | DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS));
|
||||
ClassDB::bind_method(D_METHOD("duplicate", "flags"), &Node::duplicate, DEFVAL(DUPLICATE_USE_INSTANTIATION | DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS));
|
||||
ClassDB::bind_method(D_METHOD("replace_by", "node", "keep_groups"), &Node::replace_by, DEFVAL(false));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_scene_instance_load_placeholder", "load_placeholder"), &Node::set_scene_instance_load_placeholder);
|
||||
@ -2918,7 +2918,7 @@ void Node::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(DUPLICATE_SIGNALS);
|
||||
BIND_ENUM_CONSTANT(DUPLICATE_GROUPS);
|
||||
BIND_ENUM_CONSTANT(DUPLICATE_SCRIPTS);
|
||||
BIND_ENUM_CONSTANT(DUPLICATE_USE_INSTANCING);
|
||||
BIND_ENUM_CONSTANT(DUPLICATE_USE_INSTANTIATION);
|
||||
|
||||
BIND_ENUM_CONSTANT(INTERNAL_MODE_DISABLED);
|
||||
BIND_ENUM_CONSTANT(INTERNAL_MODE_FRONT);
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
DUPLICATE_SIGNALS = 1,
|
||||
DUPLICATE_GROUPS = 2,
|
||||
DUPLICATE_SCRIPTS = 4,
|
||||
DUPLICATE_USE_INSTANCING = 8,
|
||||
DUPLICATE_USE_INSTANTIATION = 8,
|
||||
#ifdef TOOLS_ENABLED
|
||||
DUPLICATE_FROM_EDITOR = 16,
|
||||
#endif
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
// Gets the instance/inheritance states of this node, in order of precedence,
|
||||
// that is, from the topmost (the most able to override values) to the lowermost
|
||||
// (Note that in nested instancing the one with the greatest precedence is the furthest
|
||||
// (Note that in nested instantiation, the one with the greatest precedence is the furthest
|
||||
// in the tree, since every owner found while traversing towards the root gets a chance
|
||||
// to override property values.)
|
||||
static Vector<SceneState::PackState> get_node_states_stack(const Node *p_node, const Node *p_owner = nullptr, bool *r_instantiated_by_owner = nullptr);
|
||||
|
@ -71,7 +71,7 @@ static Array _sanitize_node_pinned_properties(Node *p_node) {
|
||||
}
|
||||
|
||||
Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
// nodes where instancing failed (because something is missing)
|
||||
// Nodes where instantiation failed (because something is missing.)
|
||||
List<Node *> stray_instances;
|
||||
|
||||
#define NODE_FROM_ID(p_name, p_id) \
|
||||
@ -122,7 +122,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
NODE_FROM_ID(nparent, n.parent);
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (!nparent && (n.parent & FLAG_ID_IS_PATH)) {
|
||||
WARN_PRINT(String("Parent path '" + String(node_paths[n.parent & FLAG_MASK]) + "' for node '" + String(snames[n.name]) + "' has vanished when instancing: '" + get_path() + "'.").ascii().get_data());
|
||||
WARN_PRINT(String("Parent path '" + String(node_paths[n.parent & FLAG_MASK]) + "' for node '" + String(snames[n.name]) + "' has vanished when instantiating: '" + get_path() + "'.").ascii().get_data());
|
||||
old_parent_path = String(node_paths[n.parent & FLAG_MASK]).trim_prefix("./").replace("/", "@");
|
||||
nparent = ret_nodes[0];
|
||||
}
|
||||
@ -131,7 +131,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
} else {
|
||||
// i == 0 is root node.
|
||||
ERR_FAIL_COND_V_MSG(n.parent != -1, nullptr, vformat("Invalid scene: root node %s cannot specify a parent node.", snames[n.name]));
|
||||
ERR_FAIL_COND_V_MSG(n.type == TYPE_INSTANCED && base_scene_idx < 0, nullptr, vformat("Invalid scene: root node %s in an instance, but there's no base scene.", snames[n.name]));
|
||||
ERR_FAIL_COND_V_MSG(n.type == TYPE_INSTANTIATED && base_scene_idx < 0, nullptr, vformat("Invalid scene: root node %s in an instance, but there's no base scene.", snames[n.name]));
|
||||
}
|
||||
|
||||
Node *node = nullptr;
|
||||
@ -169,7 +169,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
ERR_FAIL_COND_V(!node, nullptr);
|
||||
}
|
||||
|
||||
} else if (n.type == TYPE_INSTANCED) {
|
||||
} else if (n.type == TYPE_INSTANTIATED) {
|
||||
//get the node from somewhere, it likely already exists from another instance
|
||||
if (parent) {
|
||||
node = parent->_get_child_by_name(snames[n.name]);
|
||||
@ -345,7 +345,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
node->add_to_group(snames[n.groups[j]], true);
|
||||
}
|
||||
|
||||
if (n.instance >= 0 || n.type != TYPE_INSTANCED || i == 0) {
|
||||
if (n.instance >= 0 || n.type != TYPE_INSTANTIATED || i == 0) {
|
||||
//if node was not part of instance, must set its name, parenthood and ownership
|
||||
if (i > 0) {
|
||||
if (parent) {
|
||||
@ -382,7 +382,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
}
|
||||
}
|
||||
|
||||
// we only want to deal with pinned flag if instancing as pure main (no instance, no inheriting)
|
||||
// We only want to deal with pinned flag if instantiating as pure main (no instance, no inheriting.)
|
||||
if (p_edit_state == GEN_EDIT_STATE_MAIN) {
|
||||
_sanitize_node_pinned_properties(node);
|
||||
} else {
|
||||
@ -665,7 +665,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
|
||||
// Save the right type. If this node was created by an instance
|
||||
// then flag that the node should not be created but reused
|
||||
if (states_stack.is_empty() && !is_editable_instance) {
|
||||
//this node is not part of an instancing process, so save the type
|
||||
//This node is not part of an instantiation process, so save the type.
|
||||
if (missing_node != nullptr) {
|
||||
// It's a missing node (type non existent on load).
|
||||
nd.type = _nm_get_string(missing_node->get_original_class(), name_map);
|
||||
@ -675,7 +675,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
|
||||
} else {
|
||||
// this node is part of an instantiated process, so do not save the type.
|
||||
// instead, save that it was instantiated
|
||||
nd.type = TYPE_INSTANCED;
|
||||
nd.type = TYPE_INSTANTIATED;
|
||||
}
|
||||
|
||||
// determine whether to save this node or not
|
||||
@ -1351,7 +1351,7 @@ int SceneState::get_node_count() const {
|
||||
|
||||
StringName SceneState::get_node_type(int p_idx) const {
|
||||
ERR_FAIL_INDEX_V(p_idx, nodes.size(), StringName());
|
||||
if (nodes[p_idx].type == TYPE_INSTANCED) {
|
||||
if (nodes[p_idx].type == TYPE_INSTANTIATED) {
|
||||
return StringName();
|
||||
}
|
||||
return names[nodes[p_idx].type];
|
||||
|
@ -108,7 +108,7 @@ protected:
|
||||
public:
|
||||
enum {
|
||||
FLAG_ID_IS_PATH = (1 << 30),
|
||||
TYPE_INSTANCED = 0x7FFFFFFF,
|
||||
TYPE_INSTANTIATED = 0x7FFFFFFF,
|
||||
FLAG_INSTANCE_IS_PLACEHOLDER = (1 << 30),
|
||||
FLAG_PATH_PROPERTY_IS_NODE = (1 << 30),
|
||||
FLAG_PROP_NAME_MASK = FLAG_PATH_PROPERTY_IS_NODE - 1,
|
||||
|
@ -217,7 +217,7 @@ Ref<PackedScene> ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars
|
||||
if (next_tag.fields.has("type")) {
|
||||
type = packed_scene->get_state()->add_name(next_tag.fields["type"]);
|
||||
} else {
|
||||
type = SceneState::TYPE_INSTANCED; //no type? assume this was instantiated
|
||||
type = SceneState::TYPE_INSTANTIATED; //no type? assume this was instantiated
|
||||
}
|
||||
|
||||
HashSet<StringName> path_properties;
|
||||
@ -256,7 +256,7 @@ Ref<PackedScene> ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars
|
||||
if (next_tag.fields.has("owner")) {
|
||||
owner = packed_scene->get_state()->add_node_path(next_tag.fields["owner"]);
|
||||
} else {
|
||||
if (parent != -1 && !(type == SceneState::TYPE_INSTANCED && instance == -1)) {
|
||||
if (parent != -1 && !(type == SceneState::TYPE_INSTANTIATED && instance == -1)) {
|
||||
owner = 0; //if no owner, owner is root
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user