CONTAINERS

A container in 3DS Max is essentially a separate file that can be referenced by multiple other files, and any changes made to this file will then be reflected in all the files that reference it. This permits you to use containers in your assets but requires some specific setting up to get it to work correctly.

NOTE: For full details on how to create containers and how they work, please see the 3DS Max documentation.

Containers are mainly used for things like aircraft instrumentation, meaning that you only need to make something once then all your aircraft can use it, however containers can also be used in other circumstances, like to replicate scenery elements in multiple different 3DS Max scenes. So you would have a single *.maxc file for the instrument/scenery and then one or more *.max files that reference it.

NOTE: This functionality is currently not supported when using The Blender Plugin.

 

 

Animation Groups

To help you to correctly setup, export, and then reference Animation Groups, there has been some additional functionality added to 3DS Max via the Microsoft Flight Simulator plugin. If we assume that you have defined all the Animation Groups in the source file that is going to be used as the container, you would have something like this:

Animation Groups Example In 3DS Max

 

At this point you can select the container node, then use the following right-click Babylon menu option "Babylon Store AnimationGroups":

Babylon Utilities Store Animation Groups Option

 

Using this option will define a "Helper" node within the container hierarchy which is used to store (or load) the data about the container animation group across all target scenes. Note that all AnimationGroup information is stored inside the UserDefinedProperties of the node:

 

 

Exporting A Container

When using the Babylon Exporter to export a file with one or more container elements in it, you need to ensure that the following options are checked:

  • Use PreExportProcess
  • Merge Container and Xref

The Export Options For Containers

 

Once your export process is finished the status of the container will be reverted and closed again.

 

Note that if you want to debug and see how the exporter has managed your container node and AnimationGroups, check Apply Preprocess to Scene when you run the exporter. If you do, however, you need to be careful saving as most of the time you do not want to save a merged container inside your target scene. To prevent this follow these steps to debug the container:

  • save the scene
  • check "Apply Preprocess To Scene"
  • export
  • inspect the scene and check how the exporter modified it
  • reopen the 3DS Max file

The Container And Animation Groups After Exporting

 

Note how a _1 has been automatically added during the export process to both the nodes and the animation groups - this is to avoid duplications and conflicts and the suffix is based on the container ID property.

 

 

Babylon Container ID

To allow you to reference multiple times the same element container in a target scene, a User Defined property is set for each container when it is imported into the scene:

The Unique COntainer ID For Each Container Version In A Scene

 

This container ID is assigned automatically based on the number of occurrences of the container itself within the scene, for example:

Examples Of The Container ID User Defined Property

 

The exporter uses this ID to rename Nodes and AnimationGroups, as shown in the image below:

Suffixes Added On To Nodes And Animation Groupss

 

 

Note For Referencing Containers In Model Behaviors

It is important to understand that when setting up the object to be used as a 3DS Max container, you need to be aware of the node names and animation group names. These should be unique to each container object, otherwise you can have issues when trying to reference the nodes/animations within the model behavior XML.

 

For example, if you define two different instrument containers and place one of each in an aircraft, and both of them have an instrument node named x0_AttitudeIndicator_Bars, then try to reference it, what happens? How do you know which one of the instruments in the different containers is being targeted? One, the other or both? You can't, and neither can Microsoft Flight Simulator...

 

There are two ways to resolve this issue:

 

  • The first - and recommended - method is to simply ensure that nodes and animations have unique names based on the container itself. Let's look at this generic node name:
    x0_AttitudeIndicator_Bars

    It would become:

    x0_INSTRUMENT_AttitudeIndicator_Bars

    For example:

    x0_AS_225_AttitudeIndicator_Bars

 

  • If the above method is not possible, you can always change the default container ID in the User Defined properties for the container in the scene, then reference this ID in the model behavior. For example:Changing The Container ID In A Scene This allows you to manually solve the conflict in the case that your node or animation name is the same in two or more different container objects. After doing this you would need to ensure that the Model Behavior XML uses the matching ID value for the relevant container: Setting The Container ID In The Model Behavior XML