PDA

View Full Version : HELP: Selecting meshes (simple problem)


Nii
03-18-2006, 06:37 AM
Hi guys, I have a bunch of meshes labelled mesh00 -> mesh50, and I want to automatically select each one so I can set the image alpha to opaque for each. Selecting a mesh is just $mesh00 I think, but I can't think of a way to put this in a loop (similar to $mesh + i or something). Can anyone help me?

I've tried a workaround (below) but it doesn't work. I guess its abit obvious to say that I'm not very good at programming =]. Thanks in advance.

for i = 0 to 9 do
(
importFile (mitsu + "00" + i as string + ".3ds") #noPrompt
meditMaterials[1] = copy $.material
meditMaterials[1].diffuseMap.monoOutput = 1
meditMaterials[1].diffuseMap.alphaSource = 2
showTextureMap meditMaterials[1] on

)

mobeen
03-18-2006, 08:01 AM
I think there are two cases here

1) If you want to select multiple meshes in the same scene.

use select $mesh* if you are sure that the mesh names start with string "mesh".

2) If you are loading meshes from external 3ds files and they are in the same folder as your current script/max file, assuming that the 3ds filenames are mitsu000.3ds to mitsu009.3ds use

importFile ("mitsu00"+i+".3ds") #noPrompt

If the files are in any other folder, use
yourFilePath = "c:\\3dsfiles"
for i=0 to 9 do
(
importFile (yourFilePath+"\\mitsu00"+i+".3ds") #noPrompt
)


Hope this helps,
Mobeen

f97ao
03-18-2006, 08:05 AM
To select many objects you should use something called Collections.

You use them by using the * sign. Try this:

selObjects=$mesh*
for iObject=1 to selObjects.count do
(
selObjects[iObject].material --here you modify the objects material the way you want
)


Here you will have access directly to each object so you can change it's material. As you see there are still a few lines you have to add

Good Luck
/Andreas

Nii
03-18-2006, 10:46 AM
Awesome. I'll try it out. Thanks so much guys =]

CGTalk Moderation
03-18-2006, 10:46 AM
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.