thehankinator Posted February 27, 2016 Share Posted February 27, 2016 Is there any way to get the surfaces of an entity with a class type of BrushClass? I tried casting it to a Model but that causes a crash. Quote Link to comment Share on other sites More sharing options...
Brutile Posted February 28, 2016 Share Posted February 28, 2016 I've never seen that class before. Can you explain how and why you have a BrushClass object? Quote Link to comment Share on other sites More sharing options...
thehankinator Posted February 28, 2016 Author Share Posted February 28, 2016 I wrote a script that will convert a prefab(containing just CSG) to a obj/mtl file. Below is the relevant code. RecordInfo reports that the class is BrushClass. If I run the script in a separate directory (paths to shaders and textures broken) the entities are ModelClass, which has surfaces and the obj/mtl are exported as expected. But that's neither here nor there. world=World:Create() Prefab:Load(prefabfile) local aabb = AABB(-99999999,-99999999,-99999999,99999999,99999999,99999999) world:ForEachEntityInAABBDo(aabb, "RecordInfo") Quote Link to comment Share on other sites More sharing options...
Brutile Posted February 28, 2016 Share Posted February 28, 2016 I'm looking in the header file for Brush in C++ and there is a function called FindSurface(). You pass a material and it returns a surface with that material in the brush. Try that. Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 28, 2016 Share Posted February 28, 2016 At runtime, a csg/brush is converted to the Model Class - assuming it doesn't have a script or mass. You can then get the surface easily. Out of curiosity, does the inherent export for the CSG not work for your needs or is there another aspect that requires you to make your own export? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
thehankinator Posted February 28, 2016 Author Share Posted February 28, 2016 I'm looking in the header file for Brush in C++ and there is a function called FindSurface(). You pass a material and it returns a surface with that material in the brush. Try that. Unfortunately that function isn't visible in Lua, I should have mentioned that in OP. At runtime, a csg/brush is converted to the Model Class - assuming it doesn't have a script or mass. You can then get the surface easily. Out of curiosity, does the inherent export for the CSG not work for your needs or is there another aspect that requires you to make your own export? There is already an export for CSG? How! Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 28, 2016 Share Posted February 28, 2016 Unfortunately that function isn't visible in Lua, I should have mentioned that in OP. yep, in lua the only FindSurface() available was for Model:FindSurface() - which you may be able to use after the csg/brush is auto converted. There is already an export for CSG? How! Its been available for quite sometime to export to OBJ. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
thehankinator Posted February 28, 2016 Author Share Posted February 28, 2016 Bad ***, I had no idea! It loses the materials on the surfaces but no need for me to polish my script. Thanks! Quote Link to comment Share on other sites More sharing options...
Marcousik Posted March 17, 2017 Share Posted March 17, 2017 At runtime, a csg/brush is converted to the Model Class - assuming it doesn't have a script or mass. You can then get the surface easily. Out of curiosity, does the inherent export for the CSG not work for your needs or is there another aspect that requires you to make your own export? I still have the question about getting the surface of a csg..! > "After runtime", do you mean after start() ? > if the csg cannot have an added script, how do you want to get the surface ??? thx Edit I checked this too http://www.leadwerks.com/werkspace/topic/14455-getting-brushes-surface/page__hl__surface 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.