Basically, here's the deal: the various nif block types derive from one another, so that every NiMaterialProperty is a type of NiProperty, which is a type of NiObjectNET, which is a type of NiObject. You can use any NiObject, NiObjectNET, or NiProperty function on it, because in addition to being a NiMaterialProperty, it is also one of those other things also. Since the name field is defined in NiObjectNET, NiMaterialProperty doesn't redefine it - it inherits that from NiObjectNET. So there is no NiMaterialPropertyGetName function - and never will be. You access that information through NiObjectNETGetName. Same for NiAVObjects (which derive from NiObjectNET), NiNodes (which derive from NiAVObject and thus from NiObjectNET), etc. etc.
Here's a tree that shows the relationships:
- NiObject
- NiExtraData
- NiBinaryExtraData
- NiBooleanExtraData
- NiFloatExtraData
- NiIntegerExtraData
- BSXFlags
- NiStringExtraData
- ...
- NiBinaryExtraData
- NiObjectNET
- NiAVObject
- NiNode
- NiProperty
- NiAlphaProperty
- NiMaterialProperty
- NiStencilProperty
- NiTexturingProperty
- ...
- NiAlphaProperty
- NiTexture
- NiSourceTexture
- NiAVObject
- NiExtraData
Here's a function that goes through NIF and prints the name of each child's Material property (if any).
scn DWnifMaterialTestshort nifIDshort blockIDarray_var childarray_var childrenshort NiMaterialPropertyIDstring_var matNameBegin _GameMode ; compiler override - only necessary, for NifSE, if you're using functions that accept array arguments. if ( !NiMaterialPropertyID ) ; if not NiMaterialProperty - effectively a doOnce since we'll set it right after this let NiMaterialPropertyID := GetNifTypeIndex "NiMaterialProperty" ; caching this because GetNifTypeIndex is slowish let nifID := NifOpen "something.nif" ; open a nif as read-only let children := NiNodeGetChildren nifID ; optional blockID omitted, defaults to 0 or root foreach child <- children ; each child is a NiAVObject of some kind let blockID := NiAVObjectGetProperties NiMaterialPropertyID nifID (*child) if ( blockID > -1 ) ; returns -1 if it didn't find the property let matName := NiObjectNETGetName nifID blockID else let matName := "No Material" endif Print matName loop endifEndDoes that help somewhat?
