World Manager
C4Models.h

class ModelRegistration

The ModelRegistration class contains information about an application-defined model type.
Definition

class ModelRegistration : public MapElement<ModelRegistration>

Member Functions
ModelRegistration::GetModelType Returns the registered model type.
ModelRegistration::GetModelFlags Returns the model flags.
ModelRegistration::GetModelName Returns the model name.
ModelRegistration::GetResourceName Returns the name of the model resource.
Constructor

ModelRegistration(ModelType type, const char *name, const char *path, unsigned long flags = 0, ControllerType contType = 0);

Parameters
type The model type.
name The model name.
path The resource name for the model.
flags Flags pertaining to the model type.
contType The model's default controller type.
Description
The ModelRegistration class is used to register an application-defined model type so that instances of the model can easily be cloned and so that they can be placed in a world using the World Editor. The act of instantiating an ModelRegistration object automatically registers the corresponding model type. The model type is unregistered when the ModelRegistration object is destroyed.

Each model type must have a unique 32-bit identifier which is usually a four-character code. This identifier is specified in the type parameter in the model registration, and is later passed to the Model::Get function to create instances of the specific type of model.

The name parameter specifies the human-readable model name that is displayed in the World Editor. If the kModelPrivate flag is specified in the flags parameter, then the name parameter may be nullptr.

The path parameter specifies the name of the model resource corresponding to the model type.

The flags parameter is optional and assigns special properties to the model registration. It can be a combination (through logical OR) of the following values.
kModelPrecache Precache the model resource.
kModelPrivate Do not display the model type in the World Editor.
If the kModelPrivate flag is specified, then the model type cannot be placed in a world using the World Editor, but the Model::Get function still produces instances of the model.

The contType parameter is optional and identifies the type of controller that should be automatically assigned to a model of the registration's type when it is placed in a world using the World Editor. The type of controller specified does not need to be registered using the ControllerRegistration class, but the controller won't be accessible in the World Editor if it's not registered. The default value of 0 means that no controller is assigned.
Base Classes
MapElement<ModelRegistration> Used internally by the World Manager.
See Also
Model