Пример #1
0
def readModelsSets(xmlCtx, section, subsectionName):
    undamaged = _xml.readNonEmptyString(xmlCtx, section, subsectionName + '/undamaged')
    destroyed = _xml.readNonEmptyString(xmlCtx, section, subsectionName + '/destroyed')
    exploded = _xml.readNonEmptyString(xmlCtx, section, subsectionName + '/exploded')
    modelsSets = {'default': shared_components.ModelStatesPaths(undamaged, destroyed, exploded)}
    subsection = section[subsectionName]
    if subsection:
        setSection = subsection['sets'] or {}
        for k, v in setSection.items():
            modelsSets[k] = shared_components.ModelStatesPaths(_xml.readStringOrNone(xmlCtx, v, 'undamaged') or undamaged, _xml.readStringOrNone(xmlCtx, v, 'destroyed') or destroyed, _xml.readStringOrNone(xmlCtx, v, 'exploded') or exploded)

    return modelsSets
Пример #2
0
def readModels(xmlCtx, section, subsectionName):
    """Reads section with name 'subsectionName' to fetch paths of models
        for each hull, chassis, turret and gun.
    :param xmlCtx: tuple(root ctx or None, path to section).
    :param section: instance of DataSection.
    :param subsectionName: string containing name of desired section.
    :return: instance of ModelStatesPaths.
    """
    return shared_components.ModelStatesPaths(_xml.readNonEmptyString(xmlCtx, section, subsectionName + '/undamaged'), _xml.readNonEmptyString(xmlCtx, section, subsectionName + '/destroyed'), _xml.readNonEmptyString(xmlCtx, section, subsectionName + '/exploded'))
Пример #3
0
def apply(vDesc):
    OSDesc = g_config.OSDesc['static']
    if OSDesc is not None:
        sname = OSDesc.name
        for partName in TankPartNames.ALL:
            for descr in (vDesc, ) if not isinstance(
                    vDesc, CompositeVehicleDescriptor) else (
                        vDesc._CompositeVehicleDescriptor__vehicleDescr,
                        vDesc._CompositeVehicleDescriptor__siegeDescr):
                modelPath = getattr(descr, partName).models.undamaged.replace(
                    'vehicles/', 'vehicles/skins/models/%s/vehicles/' % sname)
                if os.path.isfile(BigWorld.curCV + '/' + modelPath):
                    part = getattr(descr, partName)
                    models = part.models
                    part.models = shared_components.ModelStatesPaths(
                        modelPath, models.destroyed, models.exploded)
                else:
                    print 'RemodEnabler: skin model not found:', modelPath