C4 Engine
C4 Engine API Documentation

Modifier::ValidInstance

Defined in:  C4Modifiers.h
Returns a boolean value indicating whether the modifier can be assigned to a particular instance node.
Prototype

static bool ValidInstance(const Instance *instance);

Parameters
instance The instance node to be tested for validity.
Description
The ValidInstance function can be redefined by modifier subclasses. Its implementation should examine the instance node pointed to by the instance parameter and return true if the modifier type can be used with the node. If the modifier type cannot be used, the ValidInstance function should return false. If the ValidInstance function is not redefined for a registered subclass of the Modifier class, then that modifier type can be assigned to any instance node.

Note that returning false from an implementation of the ValidInstance function does not guarantee that a particular modifier subclass will not be attached to an instance node, but only that it will not appear in the list of available modifiers in the World Editor for the instance given by the instance parameter. An implementation of the Modifier::ApplyModifier function should make no assumptions about whether the instance node satisfies any validity requirements checked by the ValidInstance function.