PDA

View Full Version : Particle Path script - problems under max9


CHRiTTeR
02-26-2007, 11:23 PM
Hi,
I recently downloaded a script from www.animagic.net (http://www.animagic.net) called particle path.
It is supposed to create a spline from a particle system but it doesnt seem to work here?
Im using max9 (64bit) could that be the problem?

I load the script, select the particle system from the UI, click 'create paths' but nothing happens?

plz help, coz this is a really neat script!

Thanks,
CHRiTTeR

supremepizza
02-28-2007, 05:29 AM
Could you post it? I'm burried in scripts and don't want do DL another.

CHRiTTeR
02-28-2007, 08:37 AM
Ok, i've got a reply from the guy who made thise (Stefan Didak) and he told me the script was made for max3 and he hasnt touched max anymore since version 4, so my guess is its a compatibility problem?

Could you post it? I'm burried in scripts and don't want do DL another.

Here you go. This is the .mcr version, theres an .ms file to... do you want me to post that one to?

category:"Animagic" toolTip:"Particle Path"
(
-------------------------------------------------------------------------------
--
-- PARTICLE_PATH.MS
-- Particle(s) to Path(s) MAXScript 1.0
--
-- Copyright © 1999 Animagic Development
-- http://www.3dluvr.com/animagic
-- By Stefan Didak (sdidak@csi.com (http://forums.cgsociety.org/sdidak@csi.com))
--
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--
-- GLOBAL VARIABLES
--
-------------------------------------------------------------------------------
p_pos = #() -- particle position array
p_shape = #() -- particle path/shape array
-------------------------------------------------------------------------------
--
-- USER INTERFACE
--
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- flt_particles (pick filter)
fn flt_particles obj =
(
if SuperClassOf obj == GeometryClass then
(
if ClassOf obj == Blizzard then return true
if ClassOf obj == PArray then return true
if ClassOf obj == Snow then return true
if ClassOf obj == Spray then return true
if ClassOf obj == SuperSpray then return true
if ClassOf obj == PCloud then return true
)
return false
)
-------------------------------------------------------------------------------
-- RO_partpath (rollout)
rollout RO_partpath "Particle Path"
(
group "Particle System"
(
pickbutton b_pick_node "none selected" toolTip:"Node Picker" filter:flt_particles width:130 height:20
)
group "Time Range"
(
spinner f_start "Frame Start :" fieldwidth:50 type:#integer range:[0,10000,0]
spinner f_end "Frame End :" fieldwidth:50 type:#integer range:[0,10000,100]
spinner f_step "Frame Step :" fieldwidth:50 type:#integer range:[1,10000,2]
)
group "Path Parameters"
(
spinner s_minknots "Min. Knots :" fieldwidth:50 type:#integer range:[2,50,2]
)
group "Path Knot Type"
(
radiobuttons r_ktype labels:#("Smooth", "Corner")
)
group "Path Node Parameters"
(
label l_path "Path Name Prefix"
edittext e_path fieldWidth:130 text:"PartPath_" align:#center
checkbox c_multi "Create multiple paths" checked:true
)
label l_bar "Progress Indicator"
progressbar p_bar width:144 height:14 align:#center
button b_createall "Create Paths" width:144 height:20
-- Pick Node ---------------------------------------------------------------
on b_pick_node picked obj do
(
pnode = obj; -- set emitter node
b_pick_node.text = pnode.name -- set emitter name
)
-- Create Path -------------------------------------------------------------
on b_createall pressed do
(
if pnode == undefined then return -- validate selection
-- Gather particle data -------------------------------------------------
p_pos = #() -- clear particle array
pcount = particleCount pnode -- get the particle count
f_backup = sliderTime -- get current time
fcount = 0 -- total frames captured
p_bar.value = 0.0 -- reset progress bar
p_pct = 100.0/((f_end.value - f_start.value)/f_step.value) -- percentage increase
for f = f_start.value to f_end.value by f_step.value do -- for the set time range
(
sliderTime = f -- set the current frame
fcount = fcount + 1 -- total frames increase
for p = 1 to pcount do ( append p_pos (particlePos pnode p) ) -- add all particle to array
p_bar.value = p_bar.value + p_pct -- increase progress
)
sliderTime = f_backup -- set back to initial time
-- Start path creation --------------------------------------------------
p_bar.value = 0.0 -- reset progress bar
p_pct = 100.0/pcount -- percentage increase
t_splines = 0 -- total splines
if c_multi.checked != true then -- create a single shape
(
p_shape[1] = splineshape() -- create shape
p_shape[1].name = uniqueName e_path.text -- set shape name
)
for p = 1 to pcount do -- for all particles
(
p_bar.value = p_pct * p -- increase progress
-- Make sure every spline has at least 2 knots -----------------------
kcount = 0 -- set knot count
for f = 0 to fcount do -- for all frames captured
if p_pos[p+(f*pcount)] != undefined then kcount = kcount + 1 -- validate particle position
-- Create the shape and add knots ------------------------------------
if kcount >= s_minknots.value then -- enough required knots?
(
t_splines = t_splines + 1 -- increase total splines
if c_multi.checked != true then addnewspline p_shape[1] -- creating a single spline
else -- creating multiple splines
(
p_shape[t_splines] = splineshape() -- start a spline shape
addnewspline p_shape[t_splines] -- add a spline
)
for f = 0 to fcount do -- for all frames captured
(
if p_pos[p+(f*pcount)] != undefined then -- validate particle position
(
-- Add knot points based on type ----------------------------
if c_multi.checked != true then -- creating a single spline
(
if r_ktype.state == 1 then addknot p_shape[1] t_splines #smooth #curve p_pos[p+(f*pcount)]
else addknot p_shape[1] t_splines #corner #curve p_pos[p+(f*pcount)]
) else (
if r_ktype.state == 1 then addknot p_shape[t_splines] 1 #smooth #curve p_pos[p+(f*pcount)]
else addknot p_shape[t_splines] 1 #corner #curve p_pos[p+(f*pcount)]
)
)
)
if c_multi.checked != true then Updateshape p_shape[1] -- update the shape
else -- multiple splines
(
Updateshape p_shape[t_splines] -- update the shape(s)
p_shape[t_splines].name = uniqueName e_path.text -- set shape name
)
)
)
p_bar.value = 0.0 -- reset progress bar
p_shape = #() -- clear particle path/shape array
p_pos = #() -- clear particle array
)
)
-------------------------------------------------------------------------------
-- ro_about (rollout)
rollout ro_about "About Particle Path"
(
label copyright_info_a "Version 1.0" align:#center height:12
label copyright_info_b "by Stefan Didak" align:#center height:12
label copyright_info_c "sdidak@csi.com (http://forums.cgsociety.org/sdidak@csi.com)" align:#center height:12
label copyright_info_d "www.3dluvr.com/animagic (http://www.3dluvr.com/animagic)" align:#center height:12
)
-------------------------------------------------------------------------------
--
-- MAIN SETUP
--
-------------------------------------------------------------------------------
-- First we start to setup the main floating dialog
FL_partpath = newRolloutFloater "Particle Path" 180 545 0 95
-- Next we add the various rollout panels which need to go in there
addrollout RO_partpath FL_partpath
addrollout RO_about FL_partpath
)

CHRiTTeR
02-28-2007, 08:39 AM
Oh yeah, and if anyone knows a particle flow version, that would be really great! :D

Glacierise
03-01-2007, 07:49 AM
You have the speed by icon operator in PFlow, you don't need scripts for that :)

CHRiTTeR
03-01-2007, 08:01 AM
You have the speed by icon operator in PFlow, you don't need scripts for that :)

Thats not wath the script is supposed to do. It creates a spline according to the particle's path.
It doesnt make particle follow a path ;)

rdg
03-01-2007, 08:56 AM
psychoSilence got a script to do this.
I cannot find it atm in the forum.
But I am sure it is somewhere.

Georg

supremepizza
03-01-2007, 08:45 PM
It's an unfinished script. Or a beta. What were the details about it when you got it? I got the GUI working now but I won't post anything till it works, if it works.

Edit: I haven't tried it but it should work now if the code is good. Sorry I don't have time to test it I have to head to work.


global p_pos = #() -- particle position array

global p_shape = #() -- particle path/shape array



fn flt_particles obj =

(

if SuperClassOf obj == GeometryClass then

(

if ClassOf obj == Blizzard then return true

if ClassOf obj == PArray then return true

if ClassOf obj == Snow then return true

if ClassOf obj == Spray then return true

if ClassOf obj == SuperSpray then return true

if ClassOf obj == PCloud then return true

)

return false

)





rollout RO_partpath "Particle Path"

(

group "Particle System"

(

pickbutton b_pick_node "none selected" toolTip:"Node Picker" filter:flt_particles width:130 height:20

)

group "Time Range"

(

spinner f_start "Frame Start :" fieldwidth:50 type:#integer range:[0,10000,0]

spinner f_end "Frame End :" fieldwidth:50 type:#integer range:[0,10000,100]

spinner f_step "Frame Step :" fieldwidth:50 type:#integer range:[1,10000,2]

)

group "Path Parameters"

(

spinner s_minknots "Min. Knots :" fieldwidth:50 type:#integer range:[2,50,2]

)

group "Path Knot Type"

(

radiobuttons r_ktype labels:#("Smooth", "Corner")

)

group "Path Node Parameters"

(

label l_path "Path Name Prefix"

edittext e_path fieldWidth:130 text:"PartPath_" align:#center

checkbox c_multi "Create multiple paths" checked:true

)

label l_bar "Progress Indicator"

progressbar p_bar width:144 height:14 align:#center

button b_createall "Create Paths" width:144 height:20

-- Pick Node ---------------------------------------------------------------

on b_pick_node picked obj do

(

pnode = obj; -- set emitter node

b_pick_node.text = pnode.name -- set emitter name

)

-- Create Path -------------------------------------------------------------

on b_createall pressed do

(

if pnode == undefined then return -- validate selection

-- Gather particle data -------------------------------------------------

p_pos = #() -- clear particle array

pcount = particleCount pnode -- get the particle count

f_backup = sliderTime -- get current time

fcount = 0 -- total frames captured

p_bar.value = 0.0 -- reset progress bar

p_pct = 100.0/((f_end.value - f_start.value)/f_step.value) -- percentage increase

for f = f_start.value to f_end.value by f_step.value do -- for the set time range

(

sliderTime = f -- set the current frame

fcount = fcount + 1 -- total frames increase

for p = 1 to pcount do ( append p_pos (particlePos pnode p) ) -- add all particle to array

p_bar.value = p_bar.value + p_pct -- increase progress

)

sliderTime = f_backup -- set back to initial time

-- Start path creation --------------------------------------------------

p_bar.value = 0.0 -- reset progress bar

p_pct = 100.0/pcount -- percentage increase

t_splines = 0 -- total splines

if c_multi.checked != true then -- create a single shape

(

p_shape[1] = splineshape() -- create shape

p_shape[1].name = uniqueName e_path.text -- set shape name

)

for p = 1 to pcount do -- for all particles

(

p_bar.value = p_pct * p -- increase progress

-- Make sure every spline has at least 2 knots -----------------------

kcount = 0 -- set knot count

for f = 0 to fcount do -- for all frames captured

if p_pos[p+(f*pcount)] != undefined then kcount = kcount + 1 -- validate particle position

-- Create the shape and add knots ------------------------------------

if kcount >= s_minknots.value then -- enough required knots?

(

t_splines = t_splines + 1 -- increase total splines

if c_multi.checked != true then addnewspline p_shape[1] -- creating a single spline

else -- creating multiple splines

(

p_shape[t_splines] = splineshape() -- start a spline shape

addnewspline p_shape[t_splines] -- add a spline

)

for f = 0 to fcount do -- for all frames captured

(

if p_pos[p+(f*pcount)] != undefined then -- validate particle position

(

-- Add knot points based on type ----------------------------

if c_multi.checked != true then -- creating a single spline

(

if r_ktype.state == 1 then addknot p_shape[1] t_splines #smooth #curve p_pos[p+(f*pcount)]

else addknot p_shape[1] t_splines #corner #curve p_pos[p+(f*pcount)]

) else (

if r_ktype.state == 1 then addknot p_shape[t_splines] 1 #smooth #curve p_pos[p+(f*pcount)]

else addknot p_shape[t_splines] 1 #corner #curve p_pos[p+(f*pcount)]

)

)

)

if c_multi.checked != true then Updateshape p_shape[1] -- update the shape

else -- multiple splines

(

Updateshape p_shape[t_splines] -- update the shape(s)

p_shape[t_splines].name = uniqueName e_path.text -- set shape name

)

)

)

p_bar.value = 0.0 -- reset progress bar

p_shape = #() -- clear particle path/shape array

p_pos = #() -- clear particle array

)

)

rollout ro_about "About Particle Path"

(

label copyright_info_a "Version 1.0" align:#center height:12

label copyright_info_b "by Stefan Didak" align:#center height:12

label copyright_info_c "sdidak@csi.com" align:#center height:12

label copyright_info_d "www.3dluvr.com/animagic" align:#center height:12

)

FL_partpath = newRolloutFloater "Particle Path" 180 545 0 95

addrollout RO_partpath FL_partpath

addrollout RO_about FL_partpath

DeKo-LT
03-01-2007, 09:38 PM
Look at PFSpliner by CharleyC:
http://www.orbaz.com/forum/viewtopic.php?t=311&

and here is tutorial by PsychoSilence:
http://www.orbaz.com/tutorials_ParticleFlow/ParticleSplinesTutTranslation.htm

supremepizza
03-02-2007, 03:19 PM
Look at PFSpliner by CharleyC:
http://www.orbaz.com/forum/viewtopic.php?t=311&

and here is tutorial by PsychoSilence:
http://www.orbaz.com/tutorials_ParticleFlow/ParticleSplinesTutTranslation.htm

I think this is supposed to act like spliner. Only problem I found was some undefined globals. Which IMHO are too generally named and could probably be eliminated if nested correctly. Has anyone tried it lately?

PsychoSilence
03-03-2007, 06:29 PM
here´s the proper english version of the tutorial:

http://www.cgarena.com/freestuff/tutorials/max/pflow_splines/index.html

CHRiTTeR
03-05-2007, 04:20 PM
Thanks guys, i'll be checking it out! Much appriciated! (y)

CGTalk Moderation
03-05-2007, 04:20 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.