particle to object

im sorry my english
i studed some tutorial
but i got not understand one ting
that is
local BakePF = $'PF source 001'
local TheCount = BakePF.numparticles()
local myarray = for i = 1 to TheCount collect
BakePF.particleindex = i
local newobj = Editable_Mesh()
newobj.mesh = BakePF.particleShape
newobj.transform = BakePF.particleTM = uniquename("myBake_")
newobj <<< it is my question


question located below
why if writed it then script runs ok but not wirted it then script runs not okay??


Comment viewing options

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

fn bakeThisParticle

--By Charley Carlat
[email protected]
--Select your Distribution Objects, then run the Script and Pick your PFSource
-- modified by fajar : giving it simple UI
fn bakeThisParticle PfSourceObj BakedObj =
	 for i in 1 to PfSourceObj.numParticles() do
		PfSourceObj.particleIndex = i
		tmpObj = instance BakedObj
		tmpObj.material = BakedObj.material
		tmpObj.wireColor = BakedObj.wireColor
!REG3XP1!>		tmpObj.transform = PfSourceObj.particleTM
try (destroyDialog PartBaker) catch()
rollout PartBaker "Untitled" width:162 height:300
	fn objFilter obj = superclassof obj == GeometryClass
	fn pfFilt flt = (classOf flt == PF_Source)
	pickButton pBtn2 "Object" pos:[6,17] width:151 height:26 filter:objFilter toolTip:pBtn2.caption autoDisplay: true
	pickButton pBtn3 "Particle" pos:[5,67] width:151 height:26 filter:pfFilt toolTip:pBtn3.caption autoDisplay: true
	groupBox grp1 "Object " pos:[2,3] width:158 height:46
	groupBox grp2 "Particle" pos:[1,52] width:158 height:66
	button btn4 "Convert" pos:[4,120] width:156 height:23
	spinner spn1 "Particle count : " pos:[14,101] width:142 height:16
	local obj2Scater
	local particleSource
	on pBtn2 picked objSource do
		if objSource != undefined do
			obj2Scater= objSource
			pBtn2.caption =
	on pBtn3 picked pfObject do
		if pfObject != undefined do
			pBtn3.caption =
			particleSource = pfObject
	on btn4 pressed do
		bakeThisParticle particleSource obj2Scater
createDialog PartBaker

Something like that ?

barigazy's picture


Can you explain again what is the problem here?


sonppw's picture


sorry my english

why namobj diffrence exist it or not exist it

if not exist then don't evalute............

theonlyaaron's picture

That last line of 'newobj'

That last line of 'newobj' returns the object, which has been modified in earlier lines. Without this, your object won't be updated, and will remain an empty piece of geometry which is how it was created in 'local newobj = Editable_Mesh()'

Comment viewing options

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