Put object names in a variabel

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2003   #1
Put object names in a variabel

I am working with some animation scripts and need to make someting like group.

I want to have someting like this:
variabelname=(L_foot, H_foot, COM)

and if I take variabelname[1] then it will return L_foot.

I am new to script but someting like this I have seen in C++.

How to do this?
 
Old 06 June 2003   #2
setobjects=#()
for i = 1 to selection.count do
(
setobjects[i] = selection[i]

)


How can I select now setobjects[1]
I get now:
$Editable_Spline:man_footRCTRL @[-3.691000,4.678302,1.408482]

Last edited by Peder : 06 June 2003 at 08:18 PM.
 
Old 06 June 2003   #3
Quote:
Originally posted by Peder
setobjects=#()
for i = 1 to selection.count do
(
setobjects[i] = selection[i]
)


this does the same but as a one-liner:
setobjects = for i in selection collect i

Quote:
How can I select now setobjects[1]
I get now:
$Editable_Spline:man_footRCTRL @[-3.691000,4.678302,1.408482]


to select the first object in the array, you could say:
select setobjects[1]
 
Old 06 June 2003   #4
The two examples posted above assume that you have your objects selected. If your objects are consistently named, you can hard code them into the script like so.

NodeName=#( $'Box01', $'Box02', $'Box03' ) -- Name of the object between the ' 's

select NodeName[2] -- will select Box02.

You do not need to have an object selected to do most maxscript functions. Simply doing I function to the object by name will produce the desired results.

rotate NodeName[1] (angleaxis 45 [0,0,1])

Will Rotate Box01 45 degrees.

Watch the maxListener window for commands that you may want to script. [ Bottom, left part of screen, right click to expand it! ]

Good Luck

Keith Morrison
 
Old 11 November 2004   #5
hi, this is my first post here in the forums... i hope somebody cud help me with...
how do i collect objects in array by names using an edittext?
i did this...


foo = for obj in $text* collect obj

or

foo = "$" + text + "*"
execute foo


the first one isnt working... but the second one gives me "$foo*"...


what i wanted to do is have an edittext box, where i cud enter the name of all the objects that goes by it, so that i cud alter thier properties at the same time.
 
Old 11 November 2004   #6
Your Close!!

foo = $'text*'

Will assign foo with an Array of all objects with "text" as the first four letters in their name.

to do dynamically...

(
Global ObjArray = #()
ObjName = "Box"
ExecString = ( "ObjArray = $'"+ ObjName + "'")
execute ExecString
)
 
Old 11 November 2004   #7
ok! thnx! dat was an approach that never occured to me. Cool!
 
Old 11 November 2004   #8
Actually, it's better to use getNodeByName instead of execute (which really slows down your script when used in a loop).

ObjName = "Box"
getNodeByName ObjName



from the 3dsmax7 online reference:

Quote:
getNodeByName <string> exact:<bool> ignoreCase:<bool> all:<bool>

Returns first node with the specified name. If exact is false (default), the normal MAXScript node name comparisons are performed.

NEW in 3ds max 7:

ignoreCase specifies whether the comparisons should be case sensitive or not. When set to true, non-case-sensitive comparison will be performed.

If all is true, an array of nodes with the specified name is returned.

Default is exact:false ignoreCase:true all:false


- Martijn
 
Old 01 January 2006   #9
Thread automatically closed

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.
 
Thread Closed 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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 07:16 PM.


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