| … | … | @@ -225,11 +225,26 @@ void ProcGeometryNode::set_graph(const Ref<ProcNodeGraph> &p_graph) { |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | void ProcGeometryNode::_ensure_children() { |
| 228 | // ⛔ ADOPT THE ONE THAT IS ALREADY THERE. |
| 229 | // |
| 230 | // These children are built at runtime and, in a live session, belong to |
| 231 | // nobody -- which is why a saved scene does not carry the millions of |
| 232 | // vertices they hold. A PUBLISHED scene is the opposite case: it carries |
| 233 | // MeshOutput on purpose, with the baked mesh beside it, so that opening it |
| 234 | // needs neither this graph nor a bake. Creating a second one on _ready |
| 235 | // would leave the baked mesh on a node nothing draws into and the next |
| 236 | // evaluation writing into a stranger next to it. |
| 237 | if (mesh_output == nullptr) { |
| 238 | mesh_output = Object::cast_to<MeshInstance3D>(get_node_or_null(NodePath("MeshOutput"))); |
| 239 | } |
| 228 | 240 | if (mesh_output == nullptr) { |
| 229 | 241 | mesh_output = memnew(MeshInstance3D); |
| 230 | 242 | mesh_output->set_name("MeshOutput"); |
| 231 | 243 | add_child(mesh_output); |
| 232 | 244 | } |
| 245 | if (multimesh_output == nullptr) { |
| 246 | multimesh_output = Object::cast_to<MultiMeshInstance3D>(get_node_or_null(NodePath("MultiMeshOutput"))); |
| 247 | } |
| 233 | 248 | if (multimesh_output == nullptr) { |
| 234 | 249 | multimesh_output = memnew(MultiMeshInstance3D); |
| 235 | 250 | multimesh_output->set_name("MultiMeshOutput"); |