Thareh Posted January 31, 2010 Share Posted January 31, 2010 Hi! I'm doing a lil' loop to go through all the children for my loaded Mesh like this: For local X:Int = 1 to CountChildren( Mesh ) Local Child:TEntity = GetChild( Mesh, X ) Print GetEntityKey( Child, "name" ) Next And this throws an error like this: "List index out of range". Am I doing something wrong or is this a bug? Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 31, 2010 Share Posted January 31, 2010 For Local X:Int = 1 To CountChildren( scene ) Local Child:TEntity = GetChild( scene, X ) Print GetEntityKey( Child, "name" ) Next Works for me in Bmax with a loaded scene. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Thareh Posted January 31, 2010 Author Share Posted January 31, 2010 I'm using it on a mesh, and it seems to be very random. Sometimes when I export my mesh I get this problem, sometimes not. Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Canardia Posted January 31, 2010 Share Posted January 31, 2010 If it works with the same mesh all the time, and it never works with a mesh with never works, then it's probably not a bug in the engine, but in the way how you export or in the modelling program you use. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Thareh Posted January 31, 2010 Author Share Posted January 31, 2010 I'm modifying the same mesh, and exporting it again etc. I can load the mesh just fine, and it shows up just fine; But as soon as I loop through the children it crashes with that error. Shouldn't CountChildren() just not count the parts that isn't correct if my mesh is faulty? I'm exporting it using the 3d studio max exporter in the downloads section. Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Canardia Posted January 31, 2010 Share Posted January 31, 2010 There might be a difference when you export it after you first opened 3DS Max, and when you export it a 2nd time while 3DS Max is still open (some internal variables being set differently). You could try if it works always when you close 3DS Max, open 3DSMax, then export it, and close 3DS Max again. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted January 31, 2010 Share Posted January 31, 2010 try limiting your loop to CountChildren( scene )-1 i just put the same code into a scene and looped to -1 less than the child count and it showed the exact same children with an key named "name" as if i wound it out to the full count... this may solve your problem... maybe... --Mike Quote Link to comment Share on other sites More sharing options...
Thareh Posted January 31, 2010 Author Share Posted January 31, 2010 I've tried that, It works sometimes I'm gonna try exporting with a freshly started 3d Studio Max. Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Thareh Posted January 31, 2010 Author Share Posted January 31, 2010 I tried exporting it with a freshly started 3d studio max, still the same issue. Even if it's my meshes fault, shouldn't CountChildren & GrabChild skip invalid parts of the mesh? The mesh shows up fine on the modelviewer, with the names of all entities etc. So how does the modelviewer loop through all the children? Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Canardia Posted January 31, 2010 Share Posted January 31, 2010 Maybe ModelViewer skips illegal pointers, kinda like this: For local X:Int = 1 to CountChildren( Mesh ) Local Child:TEntity = GetChild( Mesh, X ) If Child Then Print GetEntityKey( Child, "name" ) EndIf Next Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Thareh Posted January 31, 2010 Author Share Posted January 31, 2010 Can't do that, It errors at the line with GetChild :/ It's not a null pointer issue ^^ Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Josh Posted January 31, 2010 Share Posted January 31, 2010 Post an example we can reproduce. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Thareh Posted January 31, 2010 Author Share Posted January 31, 2010 Found the issue now, I'm freeing a child in this loop which makes the CountChildren count go down so that GetChild goes short There isn't any easier way to move an entity to another world other than change world => copy it => remove the original => change world back; right? Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Josh Posted January 31, 2010 Share Posted January 31, 2010 Possibly, but I don't feel comfortable right now with the bugs that might raise. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Thareh Posted January 31, 2010 Author Share Posted January 31, 2010 Perhaps you should make a new command; SetEntityWorld ^^ Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. 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.