Notifications
Clear all

[Closed] skinWarp can't deform mesh

Hi there. I got a wierd problem.
I am trying use skinWrap modifier to make a mesh fit to another.
It work find when i manipulate it via UI, but not in script.

the following code explain what I am trying to do.

    (
	setCommandPanelTaskMode mode:#modify
	
    	sp1 = sphere()
    	sp2 = sphere()
    	
    	bx1 = box()
    
    	sp1.radius = 10
    	sp2.radius = 15
    	
    	sp3 = snapshot sp2
    	delete sp2	
    	
    	bx1.length = 10
    	bx1.width = 10
    	bx1.height = 10
    	
    	
    	morMod = copy(morpher())
    	addmodifier sp1 morMod
    	modPanel.setCurrentObject morMod ui:true
    	
    	WM3_MC_BuildFromNode morMod 1 sp3
    	delete sp3
    	
    	WM3_MC_SetValue morMod 1 100.0
    	WM3_MC_SetActive morMod 1 false
    	
    	skinWpMod = copy( skin_Wrap())
    	
    	addmodifier bx1 skinWpMod
    	modPanel.setCurrentObject skinWpMod ui:true
    	
    	skinWpMod.meshList= #(sp1)
    	
    	modPanel.setCurrentObject morMod ui:true
    	WM3_MC_SetActive morMod 1 true
    )
    
It work well when execute it line by line but when you run the script,

the last line has no effect to box.
Is there anything I should do it in script to make it work…

Thanks.
4 Replies

Can you provide more details on what you are expecting to see? When I run the script everything seems to work. The sphere manipulates the box when you adjust the morph value and the last line is setting the 1st channel as the active morph channel.

If you add these lines to the end of your script it will add a couple keys to your morpher and you can see it affecting the box.


		with animate on 
		(
			at time 0 WM3_MC_SetValue morMod 1 0.0
			at time 25 WM3_MC_SetValue morMod 1 100.0
		)

 This picture shows the difference.

The box’s mesh should be affect by the shpere when the last line code active the morpher channel but it didn’t.

 And i found, if you take off the brackets "()" from my code, things go right.... but why... q_q

Interesting, it seems to be a redraw views issue. By eliminating the brackets you are redrawing the views after each command. Keeping the brackets and adding a

redrawviews()

command before

WM3_MC_SetActive morMod 1 true

seems to resolve the issue and keeps the redraws to a minimum.

Cool man, IT WORK
Thanks.