Function not reading array

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  04 April 2014
Function not reading array

Hi all,

I am trying to create a function where it takes an array of objects, makes a snapshot of them and then attaches them all together.

The snapshot part seems to work fine, however I'm getting stuck with passing the snapshot objects to be attached.

I have tried defining a local array but cannot seem to append to the SnapShotArray I create to pass on to the attaching code.

How do you pass variables/arrays out of an event handler? I have tried defining the array globally as well.

Any help appreciated.

 fn clusterAttach &objArr =
		for BodyCount = 1 to objArr.count do
		SnapShotArray = #()
		theObj = objArr[BodyCount]
		theTMesh = snapshotAsMesh theObj
		EmptyMesh = Editable_mesh()
		EmptyMesh.mesh = theTMesh
		convertTo EmptyMesh Editable_Poly
		move EmptyMesh[115,0,0]
		append SnapShotArray $EmptyMesh
		print SnapShotArray
		-- Attach --
		  j = 1
		  count = SnapShotArray.count
		  undo off
			  while SnapShotArray.count > 1 do
				  if classof SnapShotArray[j] != Editable_Poly then converttopoly objArr[j]
				  polyop.attach SnapShotArray[j] SnapShotArray[j+1]
				  deleteItem SnapShotArray (j+1)
				  j += 1
				  if (j + 1) > SnapShotArray.count then j = 1
		  return SnapShotArray[1]
  04 April 2014
Shouldn't it be return SnapShotArray, not return SnapShotArray[1]?
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:12 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.