PDA

View Full Version : MEL - Renaming question


gazzz90
02-01-2011, 01:07 PM
Hi, as with most thread starters here, I'm new to MEL and I'm running into a few problems.

The biggest of which is that I want to be able to change the name of objects which are imported without knowing the name of the object before hand to hardcode it in.

The project I'm working on is a random fantasy city generator. As it stands I am setting the generator out like this : the user is able to build individual assets to make up whole buildings, they're able to create as many as they like and when theyre ready the script builds a list after some user input of all availible assets which are then imported based off a randomly generated value that corrisponds to an element in an array. I've been trying for days to try and capture the names of the imported assets and do different things to them such as polyunite but when i try these things it breaks the loop (for polyunite) or doesnt capture any data or brings up and error saying cannot cast data of type string to string[] or some such... I'm pretty sure I'm missing some very basic concepts and thats why it isnt working, but I've gone through two books and countless tutorials to try and help and come up blank. Any help with anything would be massivly appreciated and if you need the code I can post it (its in seperate mel files so it might not look streamlined as such).

Thanks guys.

Gary.

NaughtyNathan
02-01-2011, 02:15 PM
when you import something with the file command, the -rnn flag makes the command return the names of all new nodes imported:

string $importedNodes[] = `file -import -rnn "c:/work/fantasy/building01.ma"`;
// Result: |polySurface102 |roofTiles etc...:nathaN

gazzz90
02-01-2011, 02:20 PM
That sounds perfect... I knew it would be something like that! Ill give it a whirl and see how I get on.

Thanks for the quick reply and great help Nathan!

gazzz90
02-01-2011, 04:41 PM
That seems to have done the trick thanks! I've been bashing my head against a wall for days trying to get this working, I can finally move forward now and have a (small) chance of getting it done in time!

If I can pull this one off I will dedicate the work to NaughtNathan!

Thanks again my friend.

Gary

CGTalk Moderation
02-01-2011, 04:41 PM
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.