CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
reply share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 04-10-2014, 10:45 AM   #1
Still learning...
Animare's Avatar
Shan Joseph
Join Date: Jun 2002
Posts: 373
Send a message via MSN to Animare
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] )
Old 04-10-2014, 11:45 AM   #2
Lyngdal, Norway
Join Date: May 2008
Posts: 94
Shouldn't it be return SnapShotArray, not return SnapShotArray[1]?
reply share thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 08:59 AM.

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