Particle Skinner - Assign Particle Flow Systems through maxscript not working

Hi guys,

I have a Particle Skinner modifier assigned to an editable mesh ('theMesh'). When I try to assign a Particle Flow System ('pfSource') to the modifier through maxscript like this...

theMesh.modifiers[#Particle_Skinner].Particle_Flow_Systems = #(pfSource)

...it throws this error:

"-- Runtime error: Invalid value for property: $PF_Source:PFSource_001 @ [0.000000,0.000000,0.000000]"

If I do it manually, it works perfectly fine.

If I follow these steps, it also works ok:
1. Assign Particle flow system manually.
2. Remove it manually.
3. Run the maxscript code.
Works ok!

So I think it's a 3ds max bug.

I need to do all the work by code, not manually. So please help me.

If it's a bug, please help me find some workaround for this.

Thanks in advance!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rode3d's picture

.

I got it to work with the following code, wich I found on the web..
It uses the UIAccessor functions to simulate user inrteraction. I'm not familiar with UIAccesor.

The thing is the code works ok in 3ds Max 2015, but not in newer versions.

Do you know how can I make it work in all versions?

fn addParticleSkinnerMod theMesh masterSystem partSize:1.0 =
	(
		select theMesh
		max modify mode
		modPanel.addModToSelection (Particle_Skinner ()) ui:on
		theMod = $.modifiers[1]
		theMod.Before_Hide = off
		maxHWND = windows.getMAXHWND() 
		cmdHWND = for d in UIAccessor.GetChildWindows maxHWND where UIAccessor.GetWindowText d == "Command Panel" do exit with d 
		btnHWND = (windows.getChildHWND cmdHWND "Add")[1] 
		UIAccessor.PressButton btnHWND -- press the 'Add' button 
		theMod.Particle_Flow_Systems = #(masterSystem) 
		UIAccessor.PressButton btnHWND -- unpress the 'Add' button 
		theMod.falloff = partSize
		sliderTime += 1f
		theMod.activateSkinning()
		clearSelection()
		sliderTime -= 1f
	)
 
	addParticleSkinnerMod $Box001 $'PF Source 001' partSize:3.0
rode3d's picture

.

Hi, sorry the delay in answering.

I had already tried with 'append' and got the same error :(

Don't you get any error?

jahman's picture

.

why are you assigning new array instead of appending to existing one?
append $.modifiers[1].Particle_Flow_Systems (getnodebyname "PF Source 001")

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.