kurhlaa Posted March 4, 2018 Share Posted March 4, 2018 Hello, If there is an existing scene - is it possible to pre-import meshes without starting rendering them (something like isEnabled = false from the beginning)? For example, I would like to be able to load mesh from a *.babylon file into memory. So later, when/if I need it, I just call mesh.setEnabled(true) to make it visible. If I do normal importMesh() - drawing a mesh first and then erasing it feels a little hacky, so I'm interested whether there is a cleaner way?! Thanks! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 4, 2018 Share Posted March 4, 2018 Hi Kurhlaa. https://www.babylonjs-playground.com/#199WQ0#7 When you use scene.beforeRender or scene.beforeCameraRender (see lines 63-67) to loop thru all mesh and setEnabled(false), I don't think the mesh get rendered at all. So you are doing no back-walking that way, right? I'm not sure that this is correct, but it makes sense, and I think I saw Deltakosh answer a similar question in a similar way. Perhaps others will comment soon. kurhlaa 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted March 4, 2018 Share Posted March 4, 2018 I do not know which exporter you use. For Blender you can indicate to load the mesh already disabled. This the same as @Wingnut's post, but no code as it is stored directly into the JSON file. kurhlaa 1 Quote Link to comment Share on other sites More sharing options...
kurhlaa Posted March 4, 2018 Author Share Posted March 4, 2018 1 hour ago, JCPalmer said: I do not know which exporter you use. For Blender you can indicate to load the mesh already disabled. This the same as @Wingnut's post, but no code as it is stored directly into the JSON file. I use Blender. How this works internally? importMesh() will also create normal visible mesh first, which then will be disabled automatically (hacky way)? Or it will create disabled mesh directly (fastest way)? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted March 5, 2018 Share Posted March 5, 2018 It occurs at Mesh parse time. The default of enabled is true, so you can never, without changing BABYLON.Mesh, never have a value of false at the very outset. Not necessary though, as runs on the OpenGL thread. kurhlaa 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.