Blax Posted October 8, 2015 Share Posted October 8, 2015 Hi! Please help me (yes, again )! http://www.babylonjs-playground.com/#1A8B4B1. have StandardMaterial, binded on mesh;2. delete this material: material.dispose()3. scene.materials not contains this material more, its OK,BUT ....4. If we get "material" property from mesh we get link on deleted material. How it works? Example:First we deleted anything materials (we not know how meshes binded on disposed material).Second we need know - deleted material on this mesh or not, but how, if we get "material" we get normal StandardMaterial. Check every time contains scene.materials this material or not is horrable, but how make this correct? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 8, 2015 Share Posted October 8, 2015 Perhaps I didn't get your question but is this not enough:http://www.babylonjs-playground.com/#1A8B4B#1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 8, 2015 Share Posted October 8, 2015 (edited) That's actually rather interesting. If you dispose a material that is currently being used, it is not being fully disposed. You can only dispose it after you set the mesh's material to null.Maybe the dispose function should also search all meshes using the material and set their material to null. Here - http://www.babylonjs-playground.com/#1A8B4B#2Look at both alerts. JavaScript sometimes puzzles me. I feel like something that is done is wrong, but i can't pinpoint it... That's even more interesting than I thought :-) The first call removes it from the scene.materials, but isn't completely deleted (As i wrote before). But for some reason, the second call removed the default material from the scene's materials array. Odd... Debugging further. I slowly start to sound like Wingnut... :-) Edited October 9, 2015 by RaananW Temechon 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 8, 2015 Share Posted October 8, 2015 Actually there is always a material in the list (the default one) the bug comes from the dispose which removes the default one from the list I'm gonna update the dispose to unbind disposed materials as well Quote Link to comment Share on other sites More sharing options...
Blax Posted October 9, 2015 Author Share Posted October 9, 2015 Perhaps I didn't get your question but is this not enough:http://www.babylonjs-playground.com/#1A8B4B#1 Its not solve problem.Im not know how meshes got deleted material. Look over all scene meshes everytime may be slowly and not gracefully. Quote Link to comment Share on other sites More sharing options...
Blax Posted October 9, 2015 Author Share Posted October 9, 2015 I'm gonna update the dispose to unbind disposed materials as well Yes, it would be excellent!!! Thanks! UPD:Perhaps would be usefull have one more material method:Material.getBindedMeshes() --> [Array] ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 9, 2015 Share Posted October 9, 2015 Yep..will be in next commit RaananW 1 Quote Link to comment Share on other sites More sharing options...
Blax Posted October 26, 2015 Author Share Posted October 26, 2015 Yep..will be in next commit Great!! ) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 26, 2015 Share Posted October 26, 2015 It's in the box:) 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.