Groups > Design > 3dsmax MAXScript > loadEnvelope not actually loading data?




loadEnvelope not actually loading data?

loadEnvelope not actually loading data?
Mon, 22 Oct 2007 11:25:35 +000
I've searched the forums, but I've not found an answer to this issue that I'm
having.

I've written a body transfer system that bakes and dumps out skin weights for
any selected body parts, saves those parts as collapsed meshes, then merges them
with the head file.

Al I have left to do is load the skin weights - I don't might that it brings up
the Load Envelopes dialogue, and that I have to press match by name, what I do
mind is that it seems to not load the skin weights via script at all. I can see
the incoming envelope set it correct, but it doesn't seem to perform the actual
loading.

When I manually Load weights using the data that the script wrote out, it all
works as expected. 


The script function that does the loading:


[code]
fn lsw = (
	-- This bit loads weights for selected objects
		
	-- Make sure we have objects selected
	nc = selection.count
	if nc == 0 then 
	(
		outtext = "Nothing selected"
		messagebox outtext
		return 0
	)
		
	os = #()
	if nc > 1 then 
	(
		os = $ as array
	)
	else append os $
		

	-- for each selected skinned object, load and apply the weights
	for i = 1 to nc do 
	(
		obj = os[i]
		select obj

		skobj = $.name as string
		skobj = dpath + currentmodelname +"_" + skobj +".env"
			
			
		-- This part adds a skin modifier, sets the bone limit, adds the bones
		modPanel.addModToSelection (Skin ()) ui:on
		$.modifiers[#Skin].bone_Limit = 4
		
		
		-- This part should be more CLEVER! 
		-- It should find all the valid bones in the scene first.
		-- So, update this section later
		skinOps.addBone $.modifiers[#Skin] $Char 1
		skinOps.addBone $.modifiers[#Skin] $'Char Pelvis' 1
		skinOps.addBone $.modifiers[#Skin] $'Char L Thigh' 1
		skinOps.addBone $.modifiers[#Skin] $'Char L Calf' 1
		skinOps.addBone $.modifiers[#Skin] $'Char L Foot' 1
		skinOps.addBone $.modifiers[#Skin] $'Char R Thigh' 1
		skinOps.addBone $.modifiers[#Skin] $'Char Spine1' 1
		skinOps.addBone $.modifiers[#Skin] $'Char Spine2' 1


yadda yadaa more bones here....


		
		$.modifiers[#Skin].cross_radius = 0.065625
		
		skinOps.loadEnvelope $.modifiers[#Skin] skobj
		
	) -- object selection loop
)


[/code]

So, I can select the hands and torso and legs, run the load weights, it cylces
through each object, appears to load the weights - but doesn't.

Message was edited by: Rick Stirling

Post Reply
about | contact