ah I see. For the md2 files I parse in, I get mesh, bitmap, and animator assetType's reported in the ASSET_COMPLETE event I put on the AssetLibrary instance but no material assetType. That makes sense I guess since the material in the md2 format is implicit via the bitmap reference. I'll experiment listening for the MATERIAL_COMPLETE elsewhere. As for the possible bug, I'll just do a conditional like if(mesh.material) or a try/catch block to make sure if its properties are ready to be accessed (which is good programming practice anyway). Thanks for the help, Richard.
On May 25, 1:41 am, richardolsson <[email protected]> wrote: > I understand that. I'm saying that adding such an event is not > planned, and that the right way to do this right now is to simply > rename the material either straight when the material is finalized > (MATERIAL_COMPLETE or ASSET_COMPLETE with assetType material) or when > the mesh is. The latter might not work because the material may not > have been assigned when the mesh is finalized, but in that case that's > a bug. > > Cheers > /R > > On May 25, 1:12 am, Choons <[email protected]> wrote: > > > > > > > > > actually it's not any kind of error that I'm talking about. The > > automatic material assignment is happening right in my case- I'd just > > like to intercept it as it does so so I can name the material with my > > own name. I know I can go back after the fact and say > > mesh.material.name = "myMaterialName" but I'd like to name it right > > when the material gets assigned. I'd just need a way to listen for > > when that happens. > > > On May 24, 6:03 pm, richardolsson <[email protected]> wrote: > > > > The material should already have been assigned by the time the mesh is > > > finalized (when you get the asset complete event for the mesh.) I know > > > that this is not the case for many parsers, but that's a bug. > > > > For now you're gonna have to work around it somehow, until I've fixed > > > the issue. > > > > Cheers > > > /R > > > > On May 25, 12:03 am, Choons <[email protected]> wrote: > > > > > hi gang - am wondering when I parse in an OBJ or MD2 or other format > > > > that specifies a material how I can catch in the code when the > > > > automatic assignment of the material to the mesh happens. For example > > > > I have been parsing in numerous md2 files into my app and I catch the > > > > mesh, bitmap, and animator loads on the ASSET_COMPLETE event and name > > > > them so I know what goes with what in the library. I'd like to catch > > > > an event on the automatic material assignment so I can name the > > > > material something more descriptive than the default > > > > material01,02,03,etc. Can I do that?
