mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Core: Integrate Ref::instantiate
where possible
This commit is contained in:
parent
0f5f3bc954
commit
925b690c98
@ -112,7 +112,7 @@ Ref<StreamPeerTCP> TCPServer::take_connection() {
|
||||
return conn;
|
||||
}
|
||||
|
||||
conn = Ref<StreamPeerTCP>(memnew(StreamPeerTCP));
|
||||
conn.instantiate();
|
||||
conn->accept_socket(ns, ip, port);
|
||||
return conn;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ void EditorHelpSearch::_update_results() {
|
||||
search_flags |= SEARCH_SHOW_HIERARCHY;
|
||||
}
|
||||
|
||||
search = Ref<Runner>(memnew(Runner(results_tree, results_tree, &tree_cache, term, search_flags)));
|
||||
search.instantiate(results_tree, results_tree, &tree_cache, term, search_flags);
|
||||
|
||||
// Clear old search flags to force rebuild on short term.
|
||||
old_search_flags = 0;
|
||||
@ -162,7 +162,7 @@ void EditorHelpSearch::_update_results() {
|
||||
hierarchy_button->set_disabled(true);
|
||||
|
||||
// Always show hierarchy for short searches.
|
||||
search = Ref<Runner>(memnew(Runner(results_tree, results_tree, &tree_cache, term, search_flags | SEARCH_SHOW_HIERARCHY)));
|
||||
search.instantiate(results_tree, results_tree, &tree_cache, term, search_flags | SEARCH_SHOW_HIERARCHY);
|
||||
|
||||
old_search_flags = search_flags;
|
||||
set_process(true);
|
||||
|
@ -2153,7 +2153,7 @@ void EditorNode::_dialog_action(String p_file) {
|
||||
}
|
||||
|
||||
if (ml.is_null()) {
|
||||
ml = Ref<MeshLibrary>(memnew(MeshLibrary));
|
||||
ml.instantiate();
|
||||
}
|
||||
|
||||
MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, merge_with_existing_library, apply_mesh_instance_transforms);
|
||||
|
@ -1229,7 +1229,7 @@ fail:
|
||||
extra_config->set_value("init_projects", "list", list);
|
||||
}
|
||||
|
||||
singleton = Ref<EditorSettings>(memnew(EditorSettings));
|
||||
singleton.instantiate();
|
||||
singleton->set_path(config_file_path, true);
|
||||
singleton->save_changed_setting = true;
|
||||
singleton->_load_defaults(extra_config);
|
||||
|
@ -1381,14 +1381,14 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const
|
||||
r_error_msg = TTR("Invalid entitlements file.");
|
||||
ERR_FAIL_V_MSG(FAILED, "CodeSign: Invalid entitlements file.");
|
||||
}
|
||||
cet = Ref<CodeSignEntitlementsText>(memnew(CodeSignEntitlementsText(entitlements)));
|
||||
ceb = Ref<CodeSignEntitlementsBinary>(memnew(CodeSignEntitlementsBinary(entitlements)));
|
||||
cet.instantiate(entitlements);
|
||||
ceb.instantiate(entitlements);
|
||||
}
|
||||
|
||||
print_verbose("CodeSign: Generating requirements...");
|
||||
Ref<CodeSignRequirements> rq;
|
||||
String team_id = "";
|
||||
rq = Ref<CodeSignRequirements>(memnew(CodeSignRequirements()));
|
||||
rq.instantiate();
|
||||
|
||||
// Sign executables.
|
||||
for (int i = 0; i < files_to_sign.size(); i++) {
|
||||
@ -1487,7 +1487,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const
|
||||
|
||||
print_verbose("CodeSign: Generating signature...");
|
||||
Ref<CodeSignSignature> cs;
|
||||
cs = Ref<CodeSignSignature>(memnew(CodeSignSignature()));
|
||||
cs.instantiate();
|
||||
|
||||
print_verbose("CodeSign: Writing signature superblob...");
|
||||
// Write signature data to the executable.
|
||||
|
@ -1263,7 +1263,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
|
||||
//bleh, must ignore invalid
|
||||
|
||||
ERR_FAIL_COND_V(!collada.state.mesh_data_map.has(meshid), ERR_INVALID_DATA);
|
||||
mesh = Ref<ImporterMesh>(memnew(ImporterMesh));
|
||||
mesh.instantiate();
|
||||
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
|
||||
String name = meshdata.name;
|
||||
if (name.is_empty()) {
|
||||
|
@ -3092,7 +3092,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
|
||||
if (!scr.is_valid()) {
|
||||
EditorNode::add_io_error(TTR("Couldn't load post-import script:") + " " + post_import_script_path);
|
||||
} else {
|
||||
post_import_script = Ref<EditorScenePostImport>(memnew(EditorScenePostImport));
|
||||
post_import_script.instantiate();
|
||||
post_import_script->set_script(scr);
|
||||
if (!post_import_script->get_script_instance()) {
|
||||
EditorNode::add_io_error(TTR("Invalid/broken script for post-import (check console):") + " " + post_import_script_path);
|
||||
|
@ -1265,7 +1265,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
|
||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendTreeEditor::_file_opened));
|
||||
|
||||
animation_node_inspector_plugin = Ref<EditorInspectorPluginAnimationNodeAnimation>(memnew(EditorInspectorPluginAnimationNodeAnimation));
|
||||
animation_node_inspector_plugin.instantiate();
|
||||
EditorInspector::add_inspector_plugin(animation_node_inspector_plugin);
|
||||
}
|
||||
|
||||
|
@ -5620,7 +5620,7 @@ CanvasItemEditor::CanvasItemEditor() {
|
||||
snap_dialog->connect(SceneStringName(confirmed), callable_mp(this, &CanvasItemEditor::_snap_changed));
|
||||
add_child(snap_dialog);
|
||||
|
||||
select_sb = Ref<StyleBoxTexture>(memnew(StyleBoxTexture));
|
||||
select_sb.instantiate();
|
||||
|
||||
selection_menu = memnew(PopupMenu);
|
||||
add_child(selection_menu);
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "scene/3d/marker_3d.h"
|
||||
|
||||
Marker3DGizmoPlugin::Marker3DGizmoPlugin() {
|
||||
pos3d_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
pos3d_mesh.instantiate();
|
||||
|
||||
Vector<Vector3> cursor_points;
|
||||
Vector<Color> cursor_colors;
|
||||
|
@ -35,8 +35,8 @@
|
||||
|
||||
Ref<OccluderPolygon2D> LightOccluder2DEditor::_ensure_occluder() const {
|
||||
Ref<OccluderPolygon2D> occluder = node->get_occluder_polygon();
|
||||
if (!occluder.is_valid()) {
|
||||
occluder = Ref<OccluderPolygon2D>(memnew(OccluderPolygon2D));
|
||||
if (occluder.is_null()) {
|
||||
occluder.instantiate();
|
||||
node->set_occluder_polygon(occluder);
|
||||
}
|
||||
return occluder;
|
||||
|
@ -542,7 +542,7 @@ NavigationObstacle3DEditor::NavigationObstacle3DEditor() {
|
||||
point_lines_meshinstance->set_mesh(point_lines_mesh);
|
||||
point_lines_meshinstance->set_transform(Transform3D(Basis(), Vector3(0, 0, 0.00001)));
|
||||
|
||||
line_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
line_material.instantiate();
|
||||
line_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
line_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
|
||||
line_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
@ -550,7 +550,7 @@ NavigationObstacle3DEditor::NavigationObstacle3DEditor() {
|
||||
line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true);
|
||||
line_material->set_albedo(Color(1, 1, 1));
|
||||
|
||||
handle_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
handle_material.instantiate();
|
||||
handle_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
handle_material->set_flag(StandardMaterial3D::FLAG_USE_POINT_SIZE, true);
|
||||
handle_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
|
||||
|
@ -38,8 +38,8 @@
|
||||
|
||||
Ref<NavigationPolygon> NavigationPolygonEditor::_ensure_navpoly() const {
|
||||
Ref<NavigationPolygon> navpoly = node->get_navigation_polygon();
|
||||
if (!navpoly.is_valid()) {
|
||||
navpoly = Ref<NavigationPolygon>(memnew(NavigationPolygon));
|
||||
if (navpoly.is_null()) {
|
||||
navpoly.instantiate();
|
||||
node->set_navigation_polygon(navpoly);
|
||||
}
|
||||
return navpoly;
|
||||
|
@ -7050,12 +7050,12 @@ void fragment() {
|
||||
|
||||
col.a = EDITOR_GET("editors/3d/manipulator_gizmo_opacity");
|
||||
|
||||
move_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
move_plane_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
rotate_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
scale_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
scale_plane_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
axis_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
move_gizmo[i].instantiate();
|
||||
move_plane_gizmo[i].instantiate();
|
||||
rotate_gizmo[i].instantiate();
|
||||
scale_gizmo[i].instantiate();
|
||||
scale_plane_gizmo[i].instantiate();
|
||||
axis_gizmo[i].instantiate();
|
||||
|
||||
Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D);
|
||||
mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
@ -7286,7 +7286,7 @@ void fragment() {
|
||||
border_mat->set_shader(border_shader);
|
||||
border_mat->set_shader_parameter("albedo", Color(0.75, 0.75, 0.75, col.a / 3.0));
|
||||
|
||||
rotate_gizmo[3] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
rotate_gizmo[3].instantiate();
|
||||
rotate_gizmo[3]->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arrays);
|
||||
rotate_gizmo[3]->surface_set_material(0, border_mat);
|
||||
}
|
||||
@ -8639,7 +8639,7 @@ Node3DEditor::Node3DEditor() {
|
||||
gizmo.visible = true;
|
||||
gizmo.scale = 1.0;
|
||||
|
||||
viewport_environment = Ref<Environment>(memnew(Environment));
|
||||
viewport_environment.instantiate();
|
||||
VBoxContainer *vbc = this;
|
||||
|
||||
custom_camera = nullptr;
|
||||
|
@ -922,7 +922,7 @@ Ref<EditorNode3DGizmo> Path3DGizmoPlugin::create_gizmo(Node3D *p_spatial) {
|
||||
|
||||
Path3D *path = Object::cast_to<Path3D>(p_spatial);
|
||||
if (path) {
|
||||
ref = Ref<Path3DGizmo>(memnew(Path3DGizmo(path, disk_size)));
|
||||
ref.instantiate(path, disk_size);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -554,7 +554,7 @@ Polygon3DEditor::Polygon3DEditor() {
|
||||
imgeom->set_mesh(imesh);
|
||||
imgeom->set_transform(Transform3D(Basis(), Vector3(0, 0, 0.00001)));
|
||||
|
||||
line_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
line_material.instantiate();
|
||||
line_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
line_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
|
||||
line_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
@ -562,7 +562,7 @@ Polygon3DEditor::Polygon3DEditor() {
|
||||
line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true);
|
||||
line_material->set_albedo(Color(1, 1, 1));
|
||||
|
||||
handle_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
handle_material.instantiate();
|
||||
handle_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
handle_material->set_flag(StandardMaterial3D::FLAG_USE_POINT_SIZE, true);
|
||||
handle_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
|
||||
|
@ -1186,8 +1186,8 @@ Skeleton3DEditor::Skeleton3DEditor(EditorInspectorPluginSkeleton *e_plugin, Skel
|
||||
singleton = this;
|
||||
|
||||
// Handle.
|
||||
handle_material = Ref<ShaderMaterial>(memnew(ShaderMaterial));
|
||||
handle_shader = Ref<Shader>(memnew(Shader));
|
||||
handle_material.instantiate();
|
||||
handle_shader.instantiate();
|
||||
handle_shader->set_code(R"(
|
||||
// Skeleton 3D gizmo handle shader.
|
||||
|
||||
|
@ -113,7 +113,7 @@ Ref<ENetPacketPeer> ENetConnection::connect_to_host(const String &p_address, int
|
||||
if (peer == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
out = Ref<ENetPacketPeer>(memnew(ENetPacketPeer(peer)));
|
||||
out.instantiate(peer);
|
||||
peers.push_back(out);
|
||||
return out;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ static Ref<ImporterMesh> _mesh_to_importer_mesh(Ref<Mesh> p_mesh) {
|
||||
mat_name = mat->get_name();
|
||||
} else {
|
||||
// Assign default material when no material is assigned.
|
||||
mat = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
mat.instantiate();
|
||||
}
|
||||
importer_mesh->add_surface(p_mesh->surface_get_primitive_type(surface_i),
|
||||
array, p_mesh->surface_get_blend_shape_arrays(surface_i), p_mesh->surface_get_lods(surface_i), mat,
|
||||
@ -5913,7 +5913,7 @@ void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeInd
|
||||
mat_name = mat->get_name();
|
||||
} else {
|
||||
// Assign default material when no material is assigned.
|
||||
mat = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
mat.instantiate();
|
||||
}
|
||||
|
||||
mesh->add_surface(csg_mesh->surface_get_primitive_type(surface_i),
|
||||
|
@ -801,8 +801,8 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
|
||||
if (!g.navigation_debug_edge_connections_instance.is_valid()) {
|
||||
g.navigation_debug_edge_connections_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
if (!g.navigation_debug_edge_connections_mesh.is_valid()) {
|
||||
g.navigation_debug_edge_connections_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (g.navigation_debug_edge_connections_mesh.is_null()) {
|
||||
g.navigation_debug_edge_connections_mesh.instantiate();
|
||||
}
|
||||
|
||||
_update_octant_navigation_debug_edge_connections_mesh(p_key);
|
||||
@ -1386,8 +1386,8 @@ void GridMap::_update_octant_navigation_debug_edge_connections_mesh(const Octant
|
||||
g.navigation_debug_edge_connections_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
|
||||
if (!g.navigation_debug_edge_connections_mesh.is_valid()) {
|
||||
g.navigation_debug_edge_connections_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (g.navigation_debug_edge_connections_mesh.is_null()) {
|
||||
g.navigation_debug_edge_connections_mesh.instantiate();
|
||||
}
|
||||
|
||||
g.navigation_debug_edge_connections_mesh->clear_surfaces();
|
||||
|
@ -2826,7 +2826,7 @@ Ref<Resource> ResourceFormatLoaderCSharpScript::load(const String &p_path, const
|
||||
GDMonoCache::managed_callbacks.ScriptManagerBridge_GetOrCreateScriptBridgeForPath(&p_path, &scr);
|
||||
ERR_FAIL_COND_V_MSG(scr.is_null(), Ref<Resource>(), "Could not create C# script '" + real_path + "'.");
|
||||
} else {
|
||||
scr = Ref<CSharpScript>(memnew(CSharpScript));
|
||||
scr.instantiate();
|
||||
}
|
||||
|
||||
#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
|
||||
|
@ -684,9 +684,9 @@ void SceneMultiplayer::_bind_methods() {
|
||||
|
||||
SceneMultiplayer::SceneMultiplayer() {
|
||||
relay_buffer.instantiate();
|
||||
cache = Ref<SceneCacheInterface>(memnew(SceneCacheInterface(this)));
|
||||
replicator = Ref<SceneReplicationInterface>(memnew(SceneReplicationInterface(this, cache.ptr())));
|
||||
rpc = Ref<SceneRPCInterface>(memnew(SceneRPCInterface(this, cache.ptr(), replicator.ptr())));
|
||||
cache.instantiate(this);
|
||||
replicator.instantiate(this, cache.ptr());
|
||||
rpc.instantiate(this, cache.ptr(), replicator.ptr());
|
||||
set_multiplayer_peer(Ref<OfflineMultiplayerPeer>(memnew(OfflineMultiplayerPeer)));
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ void OpenXRViewportCompositionLayerProvider::create_android_surface() {
|
||||
composition_layer_extension->create_android_surface_swapchain(&info, &android_surface.swapchain, &surface);
|
||||
|
||||
if (surface) {
|
||||
android_surface.surface = Ref<JavaObject>(memnew(JavaObject(JavaClassWrapper::get_singleton()->wrap("android.view.Surface"), surface)));
|
||||
android_surface.surface.instantiate(JavaClassWrapper::get_singleton()->wrap("android.view.Surface"), surface);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -629,7 +629,7 @@ void VideoStreamPlaybackTheora::_streaming_thread(void *ud) {
|
||||
#endif
|
||||
|
||||
VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
|
||||
texture = Ref<ImageTexture>(memnew(ImageTexture));
|
||||
texture.instantiate();
|
||||
|
||||
#ifdef THEORA_USE_THREAD_STREAMING
|
||||
int rb_power = nearest_shift(RB_SIZE_KB * 1024);
|
||||
|
@ -1082,7 +1082,7 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor
|
||||
}
|
||||
|
||||
if (splash.is_null()) {
|
||||
splash = Ref<Image>(memnew(Image(boot_splash_png)));
|
||||
splash.instantiate(boot_splash_png);
|
||||
}
|
||||
|
||||
// Using same image for both @2x and @3x
|
||||
|
@ -430,6 +430,6 @@ void TouchScreenButton::_bind_methods() {
|
||||
}
|
||||
|
||||
TouchScreenButton::TouchScreenButton() {
|
||||
unit_rect = Ref<RectangleShape2D>(memnew(RectangleShape2D));
|
||||
unit_rect.instantiate();
|
||||
unit_rect->set_size(Vector2(1, 1));
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ Ref<TriangleMesh> Label3D::generate_triangle_mesh() const {
|
||||
facesw[j] = vtx;
|
||||
}
|
||||
|
||||
triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
|
||||
triangle_mesh.instantiate();
|
||||
triangle_mesh->create(faces);
|
||||
|
||||
return triangle_mesh;
|
||||
|
@ -1081,8 +1081,8 @@ void NavigationAgent3D::_update_debug_path() {
|
||||
debug_path_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
|
||||
if (!debug_path_mesh.is_valid()) {
|
||||
debug_path_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (debug_path_mesh.is_null()) {
|
||||
debug_path_mesh.instantiate();
|
||||
}
|
||||
|
||||
debug_path_mesh->clear_surfaces();
|
||||
|
@ -56,8 +56,8 @@ void NavigationLink3D::_update_debug_mesh() {
|
||||
debug_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
|
||||
if (!debug_mesh.is_valid()) {
|
||||
debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (debug_mesh.is_null()) {
|
||||
debug_mesh.instantiate();
|
||||
}
|
||||
|
||||
RID nav_map = get_world_3d()->get_navigation_map();
|
||||
|
@ -389,8 +389,8 @@ void NavigationObstacle3D::_update_fake_agent_radius_debug() {
|
||||
if (!fake_agent_radius_debug_instance.is_valid()) {
|
||||
fake_agent_radius_debug_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
if (!fake_agent_radius_debug_mesh.is_valid()) {
|
||||
fake_agent_radius_debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (fake_agent_radius_debug_mesh.is_null()) {
|
||||
fake_agent_radius_debug_mesh.instantiate();
|
||||
}
|
||||
fake_agent_radius_debug_mesh->clear_surfaces();
|
||||
|
||||
@ -487,8 +487,8 @@ void NavigationObstacle3D::_update_static_obstacle_debug() {
|
||||
if (!static_obstacle_debug_instance.is_valid()) {
|
||||
static_obstacle_debug_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
if (!static_obstacle_debug_mesh.is_valid()) {
|
||||
static_obstacle_debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (static_obstacle_debug_mesh.is_null()) {
|
||||
static_obstacle_debug_mesh.instantiate();
|
||||
}
|
||||
static_obstacle_debug_mesh->clear_surfaces();
|
||||
|
||||
|
@ -492,8 +492,8 @@ void NavigationRegion3D::_update_debug_mesh() {
|
||||
debug_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
|
||||
if (!debug_mesh.is_valid()) {
|
||||
debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (debug_mesh.is_null()) {
|
||||
debug_mesh.instantiate();
|
||||
}
|
||||
|
||||
debug_mesh->clear_surfaces();
|
||||
@ -669,8 +669,8 @@ void NavigationRegion3D::_update_debug_edge_connections_mesh() {
|
||||
debug_edge_connections_instance = RenderingServer::get_singleton()->instance_create();
|
||||
}
|
||||
|
||||
if (!debug_edge_connections_mesh.is_valid()) {
|
||||
debug_edge_connections_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (debug_edge_connections_mesh.is_null()) {
|
||||
debug_edge_connections_mesh.instantiate();
|
||||
}
|
||||
|
||||
debug_edge_connections_mesh->clear_surfaces();
|
||||
|
@ -88,8 +88,8 @@ void Path3D::_update_debug_mesh() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!debug_mesh.is_valid()) {
|
||||
debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (debug_mesh.is_null()) {
|
||||
debug_mesh.instantiate();
|
||||
}
|
||||
|
||||
if (!(curve.is_valid())) {
|
||||
|
@ -464,7 +464,7 @@ void RayCast3D::_create_debug_shape() {
|
||||
}
|
||||
|
||||
if (debug_mesh.is_null()) {
|
||||
debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
debug_mesh.instantiate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ void ShapeCast3D::_create_debug_shape() {
|
||||
}
|
||||
|
||||
if (debug_mesh.is_null()) {
|
||||
debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
debug_mesh.instantiate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const {
|
||||
facesw[j] = vtx;
|
||||
}
|
||||
|
||||
triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
|
||||
triangle_mesh.instantiate();
|
||||
triangle_mesh->create(faces);
|
||||
|
||||
return triangle_mesh;
|
||||
|
@ -3001,5 +3001,5 @@ GraphEdit::GraphEdit() {
|
||||
|
||||
set_clip_contents(true);
|
||||
|
||||
arranger = Ref<GraphEditArranger>(memnew(GraphEditArranger(this)));
|
||||
arranger.instantiate(this);
|
||||
}
|
||||
|
@ -899,7 +899,7 @@ Ref<ArrayMesh> SceneTree::get_debug_contact_mesh() {
|
||||
return debug_contact_mesh;
|
||||
}
|
||||
|
||||
debug_contact_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
debug_contact_mesh.instantiate();
|
||||
|
||||
Ref<StandardMaterial3D> mat = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
|
@ -1213,7 +1213,7 @@ void Viewport::set_world_2d(const Ref<World2D> &p_world_2d) {
|
||||
}
|
||||
} else {
|
||||
WARN_PRINT("Invalid world_2d");
|
||||
world_2d = Ref<World2D>(memnew(World2D));
|
||||
world_2d.instantiate();
|
||||
}
|
||||
|
||||
world_2d->register_viewport(this);
|
||||
@ -4386,7 +4386,7 @@ void Viewport::set_world_3d(const Ref<World3D> &p_world_3d) {
|
||||
own_world_3d = world_3d->duplicate();
|
||||
world_3d->connect_changed(callable_mp(this, &Viewport::_own_world_3d_changed));
|
||||
} else {
|
||||
own_world_3d = Ref<World3D>(memnew(World3D));
|
||||
own_world_3d.instantiate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4437,7 +4437,7 @@ void Viewport::set_use_own_world_3d(bool p_use_own_world_3d) {
|
||||
own_world_3d = world_3d->duplicate();
|
||||
world_3d->connect_changed(callable_mp(this, &Viewport::_own_world_3d_changed));
|
||||
} else {
|
||||
own_world_3d = Ref<World3D>(memnew(World3D));
|
||||
own_world_3d.instantiate();
|
||||
}
|
||||
} else {
|
||||
own_world_3d = Ref<World3D>();
|
||||
@ -4963,7 +4963,7 @@ void Viewport::_validate_property(PropertyInfo &p_property) const {
|
||||
}
|
||||
|
||||
Viewport::Viewport() {
|
||||
world_2d = Ref<World2D>(memnew(World2D));
|
||||
world_2d.instantiate();
|
||||
world_2d->register_viewport(this);
|
||||
|
||||
viewport = RenderingServer::get_singleton()->viewport_create();
|
||||
|
@ -73,7 +73,7 @@ Ref<ArrayMesh> Shape3D::get_debug_mesh() {
|
||||
|
||||
Vector<Vector3> lines = get_debug_mesh_lines();
|
||||
|
||||
debug_mesh_cache = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
debug_mesh_cache.instantiate();
|
||||
|
||||
if (!lines.is_empty()) {
|
||||
//make mesh
|
||||
|
@ -385,7 +385,7 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
|
||||
}
|
||||
}
|
||||
|
||||
triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
|
||||
triangle_mesh.instantiate();
|
||||
triangle_mesh->create(faces);
|
||||
|
||||
return triangle_mesh;
|
||||
|
@ -392,8 +392,8 @@ Ref<ArrayMesh> NavigationMesh::get_debug_mesh() {
|
||||
return debug_mesh;
|
||||
}
|
||||
|
||||
if (!debug_mesh.is_valid()) {
|
||||
debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
if (debug_mesh.is_null()) {
|
||||
debug_mesh.instantiate();
|
||||
} else {
|
||||
debug_mesh->clear_surfaces();
|
||||
}
|
||||
|
@ -2195,7 +2195,7 @@ void PackedScene::replace_state(Ref<SceneState> p_by) {
|
||||
}
|
||||
|
||||
void PackedScene::recreate_state() {
|
||||
state = Ref<SceneState>(memnew(SceneState));
|
||||
state.instantiate();
|
||||
state->set_path(get_path());
|
||||
#ifdef TOOLS_ENABLED
|
||||
state->set_last_modified_time(get_last_modified_time());
|
||||
@ -2286,5 +2286,5 @@ void PackedScene::_bind_methods() {
|
||||
}
|
||||
|
||||
PackedScene::PackedScene() {
|
||||
state = Ref<SceneState>(memnew(SceneState));
|
||||
state.instantiate();
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void PortableCompressedTexture2D::_set_data(const Vector<uint8_t> &p_data) {
|
||||
data_size -= mipsize;
|
||||
}
|
||||
|
||||
image = Ref<Image>(memnew(Image(size.width, size.height, mipmaps, format, image_data)));
|
||||
image.instantiate(size.width, size.height, mipmaps, format, image_data);
|
||||
|
||||
} break;
|
||||
case COMPRESSION_MODE_BASIS_UNIVERSAL: {
|
||||
@ -100,7 +100,7 @@ void PortableCompressedTexture2D::_set_data(const Vector<uint8_t> &p_data) {
|
||||
case COMPRESSION_MODE_S3TC:
|
||||
case COMPRESSION_MODE_ETC2:
|
||||
case COMPRESSION_MODE_BPTC: {
|
||||
image = Ref<Image>(memnew(Image(size.width, size.height, mipmaps, format, p_data.slice(20))));
|
||||
image.instantiate(size.width, size.height, mipmaps, format, p_data.slice(20));
|
||||
} break;
|
||||
}
|
||||
ERR_FAIL_COND(image.is_null());
|
||||
|
@ -1577,7 +1577,7 @@ TEST_CASE("[SceneTree][Viewport] Physics Picking 2D") {
|
||||
PickingCollider pc;
|
||||
pc.a = memnew(TestArea2D);
|
||||
pc.c = memnew(CollisionShape2D);
|
||||
pc.r = Ref<RectangleShape2D>(memnew(RectangleShape2D));
|
||||
pc.r.instantiate();
|
||||
pc.r->set_size(Size2(150, 150));
|
||||
pc.c->set_shape(pc.r);
|
||||
pc.a->add_child(pc.c);
|
||||
|
Loading…
Reference in New Issue
Block a user