PDA

View Full Version : Object replacement


mayanic
07-26-2008, 02:35 PM
I have already my basic shape of a city with placed poly primitives and exact hights. The only problem im facing right now is to create a function to replace my existing buildingwhich allows me to import a pre-existing model (more Details) and replace selected buildings .
Hope you can help,
patrick

mhovland
07-28-2008, 06:53 PM
I wrote a series of procs to swap in and out LOD's of an environment. Here is what I remember from developing them.

The replacement was done by getting the name of the object (LO_buildingA1), stripping off the prefix (LO), replacing it with the necessary detail level (MED_buildingA1), and then parsing through the sub-directories to find the appropriate Maya file that contained the building. Once that was found, I would import the appropriate building and move it to the position and rotation of the building to replace, then delete the original building from the file.

There were a few things that needed to be decided in the beginning, that never changed.

The main thing is I needed to have a naming convention in place, that was never deviated from. All the objects were named appropriately, and saved off into individual files that were named the same as the object in the file. This made it easy to parse through the subdirectories and find the files I needed to import.

Pivots need to correspond between LOD levels of the buildings. The pivots for all LODs need to be in the same place. The individual files need to be saved with the pivot placed at 0,0,0, so you don't have to do any offset math.

I am sure I will remember more things as this discussion progresses.

CGTalk Moderation
07-28-2008, 06:53 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.