help with nifse

Post » Sun Jun 26, 2011 10:47 pm

Okay, Im using nifse to cyclke through an item's mesh to look for nodes with a material called 'Skin'.

Im using a script that was written a while back, but have found an issue, when i call
let children := NiNodeGetChildren nifID

It returns a null array (aka, called ar_size on it after this returns -1).

EDIT: turns out i had some assignment errors (using let in places where i shouldnt). It works now.
But another problem that i have encountered is that the mesh is getting all corrupted (the rigging is broken( when i try and delete a node from it. Is there any way for me to view the file to see what wrong?

Here is the script Im using it in:
Spoiler
		set currentItem to NPC.getequippedobject SLOT		if (currentItem != previousItem)					;Check if player has changed what it in that slot			set previousItem to currentItem			if (currentItem != 0)				set filepath to GetBipedModelPath GENDER currentItem    				let nifID := NifOpen $filepath 1				let children := NiNodeGetChildren nifID						;optional blockID omitted, defaults to 0 or roo				foreach child <- children 								;each child is a NiAVObject of some kind					let childId := child["value"]					if ( NiAVObjectGetNumProperties nifID childId > 0 )						let NiMaterialPropertyID := GetNifTypeIndex "NiMaterialProperty"						set blockID to NiAVObjectGetPropertyByType NiMaterialPropertyID nifID childId						if ( blockID > -1 ) 							;returns -1 if it didn't find the property							set matName to NiObjectNETGetName nifID blockID							if (sv_Compare $matName SKIN == 0)								NiNodeDeleteChild childId nifID								set skinFound to 1							endif						endif 					endif				loop				if (skinFound == 1)    					let filepath := NifGetPath nifID    					SetMaleBipedPath $filepath currentItem					player.UnequipItemNS currentItem					player.EquipItemNS currentItem					set skinFound to 0					message "Skin Found"				else					message "No Skin"				endif			else				message "No Item"			endif		endif

User avatar
Ian White
 
Posts: 3476
Joined: Thu Jul 19, 2007 8:08 pm

Return to IV - Oblivion