HOW TO BUILD A LEVEL USING FILE REFERENCING by Tim H Brown

Maya Builder

In this lesson, you will learn how to build a level using existing assets and referencing them into your scene.

File referencing is a great way to use assets within a scene and alter them while leaving the original assets untouched.

This is a supplementary how-to to the Learning Maya 3 book, and it is suggested that you complete Project One in order to acquaint yourself with the Maya interface and workflows.

   STEP ONE

Download the project files for your platform:

Set your project to level_building.

In order to work faster, there are a few things you need to set up in Maya before you begin.

Next to the icons for move, rotate, and scale, you will see a small box that contains an arrow that points down. LMB and hold on this icon and a dropdown menu will appear. Select Shelf Tabs. The tabs for Shelf One and Shelf Two will appear. Select Shelf Two.

Set up your viewports like the image to the right. This was done by Selecting Panels > Saved Layouts > Four view. Next, set one of the viewports to display the Reference Editor by Selecting Panels > Panel > Reference Editor.

   STEP TWO

In order to help speed up the referencing of assets, you will add a button to Shelf Two for every asset.

Select Window > General Editors > Script Editor. The Script Editor contains two sections. The gray section is where operations executed in Maya are displayed. The white area is where the user can input MEL commands. Leave this window open for now.

   STEP THREE

You will now reference the water asset and add this command to the Shelf.

Select File > Create Reference > Options.

Set Use Namespaces to On. This will add a unique identifier to each asset that is referenced. Press Reference.

Select Water.ma and press Reference. The geometry from water.ma is referenced into the scene.

Select Window > Hypergraph. You will see that the nodes loaded in from referenced files are displayed in red. Maya colors the name to help you distinguish what is referenced and what is not. Close this window.

In the Reference Editor, click on the arrow next to ./untitled. This shows you all the files that have been referenced into the scene. As you add more assets, this list will grow.

Also, referenced files cannot be deleted as you normally would. To delete a referenced asset, select the file in the Reference Editor, and select Edit > Remove Reference. This will remove the referenced asset, but not duplicates of this asset. If the asset contains multiple models, then these are removed as well.

As you reference more and more similar assets, it may become unclear which asset you want to remove. Select the file in the Reference Editor and select Edit > Select File Contents. This will select the geometry in the scene.

   STEP FOUR

In the Script Editor window, look for the line that begins with file -r. Highlight this line and using your MMB, drag this highlighted text to Shelf Two. You will see a MEL icon in the shelf now. The text that was highlighted has now become a button you can use repeatedly to add other pieces of water to the scene.

You will want to name this icon as you will be adding more later. LMB and hold on the same icon you did to turn the Shelf Tabs on. Select Shelf Editor. Press the Shelf Contents tabs and you will see that the operation you just added is highlighted. Below it are two text boxes called Label and Overlay Label. The Label is the information that is displayed when you hold the pointer over the icon, and Overlay Label is the name displayed on the icon. Change both Label and Overlay Label to Water. Press Close and the icon will update.

To test this Shelf button remove the referenced water. Now with LMB click on the 5 icon in the Shelf and the file should be loaded into the scene. If this did not work correctly, review the steps above.

 STEP FIVE

Now, add some more assets to the scene. Reference in wall.ma. Create a button in the shelf for the wall as you did with the water.

In order to ensure that we are moving all the parts of a referenced asset, Click the Select By Hierarchy button.

Move this wall to the bottom left of the water. To help you place pieces around the water, change the grid to be the same size as the water.

To do this, select Display > Grid > Options. Set Grid to 5.28 and press Apply and Close. Now when you move the wall, hold the X key and the wall will snap to the grid.

Add another wall to the bottom right.

Next, reference in towerArms.ma. Place it between the two walls. Don't forget to add a button for it in the shelf as you will be adding more later. Change Rotate Y for the towerArms to 190.

  STEP SIX

You will now add a bridge that will span from one side of the level to the other. Reference in bridge.ma. Add it to the shelf before we go any further. Set the attributes for the bridge as follows:

  • Translate Z to 3.366;
  • Rotate Y to 90;
  • Scale X to 0.752;
  • Scale Y to 0.752;
  • Scale Z to 0.752;

You will notice that the bridge only covers half of the level. Use your shelf button to add another bridge and set the attributes as follows:

  • Translate Z to -3.357;
  • Rotate Y to 90;
  • Scale X to 0.752;
  • Scale Y to 0.752;
  • Scale Z to 0.752;

The two bridges now cover the whole level.

Add a tower to the end of the bridge to complete this part of the level.

  STEP SEVEN

Reference in rubbleWall.ma, tower.ma, platform.ma, presser.ma and powerUp.ma.

Leave these new objects where they are for now. Add each of these items to the shelf.

  STEP EIGHT

You will add these shelf items to a Marking Menu in order to gain even easier access to these assets.

Select Window > Settings/Preferences > Marking Menus... . LMB on Create Marking Menu. In the Create Marking Menu window you will see nine brown boxes on a gray background. MMB drag each of the buttons in Shelf Two to an empty box in this widow. Then enter levelAssets in the Menu Name attribute and press Save then Close. Select the levelAssets line in the Marking Menus window and change Use Marking Menu in to Hotkey Editor. Press Apply Settings then Close.

Now you need to assign this Marking Menu to a key stroke. Select Window > Settings/Preferences > Hotkeys... . This brings up the Hotkey Editor. In the Categories window, scroll all the way to the bottom and click on User Marking Menus. In the Commands window, click on levelAssets_Press. In the Assign New Hotkey section, enter l in the Key textbox. Then turn Alt Modifier On. Click Assign. A window will pop-up asking you about assigning a release key, click Yes. Click Close on the Hotkey Editor window. The Hotkey is ready for use.

  STEP NINE

Continue to build up the level till it matches the image on the right. You can test out your new Hotkey as you build up the level.

  CONCLUSION

File Referencing is helpful for including assets in a scene while leaving the original untouched. This is useful because you can work on a level as the assets are created, and can easily load in the new asset and have it replace the old one. In certain situations, you can even replace a referenced asset with an entirely new asset.

Adding buttons to a shelf or creating a Marking Menu can give you instant access to your assets and give you a workflow that will allow you to speed up your level creation.

While level building is a logical use of File Referencing, it can be handy for use in all your work. Building different variations of a character, copying animation from one skeleton to another with similar character maps, or reusing textures between assets are good examples how file referencing can be of use to you.

Your use of this file confirms your agreement to the
Terms and Conditions set out in the Terms and Conditions page.