ModelRegistrationclass contains information about an application-defined model type.
class ModelRegistration : public MapElement<ModelRegistration>
||Returns the registered model type.|
||Returns the model registration flags.|
||Returns the model name.|
||Returns the name of the model resource.|
ModelRegistration(ModelType type, const char *name, const char *path, unsigned_int32 flags = 0,
ControllerType cntrlType = 0, int32 propCount = 0, const PropertyType *propTypeArray = nullptr);
||The model type.|
||The model name.|
||The resource name for the model.|
||Flags pertaining to the model type.|
||The model's default controller type.|
||The number of default property types.|
||A pointer to an array containing the model's default property types.|
ModelRegistrationclass 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
ModelRegistrationobject automatically registers the corresponding model type. The model type is unregistered when the
ModelRegistrationobject 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
typeparameter in the model registration, and is later passed to the
Model::GetModelfunction to create instances of the specific type of model.
nameparameter specifies the human-readable model name that is displayed in the World Editor. If the
kModelPrivateflag is specified in the
flagsparameter, then the
nameparameter may be
pathparameter specifies the name of the model resource corresponding to the model type.
flagsparameter is optional and assigns special properties to the model registration. It can be a combination (through logical OR) of the following constants.
||Precache the model resource.|
||Do not display the model type in the World Editor.|
kModelPrivateflag is specified, then the model type cannot be placed in a world using the World Editor, but the
Model::GetModelfunction still produces instances of the model.
cntrlTypeparameter 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 the controller specified should be registered using the
ControllerRegistrationclass so that the controller's settings are accessible in the World Editor. The default value of 0 means that no controller is assigned.
propTypeArrayparameters are optional and identify the number and type of properties 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 types of the properties specified should be registered using the
PropertyRegistrationclass so that each property's settings are accessible in the World Editor. The data referenced by the
propTypeArrayparameter must persist for the lifetime of the model registration—it is not copied.
||Used internally by the World Manager.|