Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies) Members Gallery
(516 replies)
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

MaxScript: Get current object in array
show user profile  Stianbl
How can I get the current object my for loop is working on in my array?
Array is made from selection. I need the index number.

Thanks =)

read 3495 times
6/10/2011 2:20:51 PM (last edit: 6/10/2011 2:20:51 PM)
show user profile  Nik Clark
You could iterate through the array until the name matches the selected object, then the successful iteration number would be the same as the index.

There's probably a better way.

EDIT: I think I misunderstood your question. Does this work?

NewName = arrayName[ForLoopIteration].name

read 3493 times
6/10/2011 2:36:10 PM (last edit: 6/10/2011 3:18:20 PM)
show user profile  br0t
theres two ways to loop through an array in maxscript, assuming youre looping over the objects in the scene ( which is a selection set called "objects", basically the same thing as an array)
"for o in objects do (o = whatever)"
or indexed:
"for i=1 to objects.count do (objects[i] = whatever)
so "i" is your index

never get low & slow & out of ideas

read 3479 times
6/10/2011 3:21:27 PM (last edit: 6/10/2011 3:24:53 PM)
show user profile  Stianbl
I found another solution. Think I was confused because I had one for loop that worked on an array (of selected items), running another for loop for each keyframe in the timeline. Somehow I didnt get my head around it =P

But thanks =)

read 3465 times
6/10/2011 5:43:00 PM (last edit: 6/10/2011 5:43:00 PM)
show user profile  Garp
The findItem() method does just that.
index = findItem arr obj -- return index of first occurence of obj in arr

Btw, how are you, Stian? Long time no see.

read 3455 times
6/10/2011 9:00:20 PM (last edit: 6/10/2011 9:03:27 PM)
show user profile  Nik Clark
See, I was right.... There is a better way :)

read 3446 times
6/10/2011 9:37:20 PM (last edit: 6/10/2011 9:37:20 PM)
show user profile  Garp
Nik, you rock :D

read 3440 times
6/10/2011 11:20:43 PM (last edit: 6/10/2011 11:20:43 PM)
#Maxforums IRC
Open chat window