示例#1
0
void EClassManager::resolveInheritance()
{
	// Resolve inheritance on the model classes
    for (Models::iterator i = _models.begin(); i != _models.end(); ++i) {
    	resolveModelInheritance(i->first, i->second);
    }
        
    // Resolve inheritance for the entities. At this stage the classes
    // will have the name of their parent, but not an actual pointer to
    // it
    for (EntityClasses::iterator i = _entityClasses.begin();
         i != _entityClasses.end(); ++i) 
	{
		// Tell the class to resolve its own inheritance using the given
		// map as a source for parent lookup
		i->second->resolveInheritance(_entityClasses);

        // If the entity has a model path ("model" key), lookup the actual
        // model and apply its mesh and skin to this entity.
        if (i->second->getModelPath().size() > 0) {
            Models::iterator j = _models.find(i->second->getModelPath());
            if (j != _models.end()) {
                i->second->setModelPath(j->second->mesh);
                i->second->setSkin(j->second->skin);
            }
        }
    }

	// greebo: Override the eclass colours of two special entityclasses
    Vector3 worlspawnColour = ColourSchemes().getColour("default_brush");
    Vector3 lightColour = ColourSchemes().getColour("light_volumes");
    
    IEntityClassPtr light = findOrInsert("light", true);
	light->setColour(lightColour);
	
	IEntityClassPtr worldspawn = findOrInsert("worldspawn", true);
	worldspawn->setColour(worlspawnColour);

}