View Full Version : scripting the position object operator
01-01-2011, 11:13 PM
I want to populate single meshes by an Position Object operator while using thousands of meshes. The problem I see: it's only possible to set all meshes at once in the flow as emitters. I tried to use a Script Operator after the Position Object operator and it really changes the Emitter Objects entry - but only when hitting the Position Object Operator in Particle View with my mouse.
So how can I update the Emitter Objects entry by scripting or alternatively: does there exist a tutorial or a script for rebuilding the Position Object Operator with MaxScript especially for using the surface of a mesh for emitting?
01-02-2011, 09:53 PM
What did you use in your script operator? I was able to get this to work with a script operator above the position object operator. For the script, I used the below code. I was able to switch the emitter simply by changing the geoArray[x] and re-evaluating the script.
on Init pCont do
-- Put all objects called myGeo* into an array
geoArray = $myGeo* as array
-- Remove any previous emitters
$'Position Object 01'.Emitter_Objects.count = 0
-- Add a new emitter
$'Position Object 01'.Emitter_Objects = #(geoArray)
Obviously you'd need to modify the code to match your specific needs, but this shows that the emitter can be changed without having to click on the position object node.
01-08-2011, 09:00 PM
Sorry for waiting a few days but i had to work on commercial projects.
I've modified your little script to match my scene. Please take a look at attached file. It's my test scene which includes the pflow and my Script Operator. I agree: in general it's possible to change the emitter objects in a Position Object Operator. But the problem is: it doesn't update during playback the scene animation or moving the time slider. Currently my code is in the Proceed Pcont part. But you get the same behavior when it is in the Init Pcont part.
01-08-2011, 09:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.