예제 #1
0
def readEmblemSlots(xmlCtx, section, subsectionName):
    """Reads section 'emblemSlots' to fetch sequence of emblem slots if they exist.
    :param xmlCtx: tuple(root ctx or None, path to section).
    :param section: instance of DataSection.
    :param subsectionName: string containing name of section to find slots configuration.
    :return: tuple containing EmblemSlot items.
    """
    slots = []
    for sname, subsection in _xml.getChildren(xmlCtx, section, subsectionName):
        if sname not in component_constants.ALLOWED_EMBLEM_SLOTS:
            _xml.raiseWrongXml(xmlCtx, 'emblemSlots/{}'.format(sname),
                               'expected {}'.format(_ALLOWED_EMBLEM_SLOTS))
        ctx = (xmlCtx, 'emblemSlots/{}'.format(sname))
        descr = shared_components.EmblemSlot(
            _xml.readVector3(ctx, subsection, 'rayStart'),
            _xml.readVector3(ctx, subsection, 'rayEnd'),
            _xml.readVector3(ctx, subsection, 'rayUp'),
            _xml.readPositiveFloat(ctx, subsection, 'size'),
            subsection.readBool('hideIfDamaged', False),
            _ALLOWED_EMBLEM_SLOTS[_ALLOWED_EMBLEM_SLOTS.index(sname)],
            subsection.readBool('isMirrored', False),
            subsection.readBool('isUVProportional', True),
            _xml.readIntOrNone(ctx, subsection, 'emblemId'))
        slots.append(descr)

    return tuple(slots)
예제 #2
0
def readEmblemSlots(xmlCtx, section, subsectionName):
    slots = []
    for sname, subsection in _xml.getChildren(xmlCtx, section, subsectionName):
        if sname not in component_constants.ALLOWED_EMBLEM_SLOTS:
            _xml.raiseWrongXml(xmlCtx, 'emblemSlots/{}'.format(sname), 'expected {}'.format(_ALLOWED_EMBLEM_SLOTS))
        ctx = (xmlCtx, 'emblemSlots/{}'.format(sname))
        descr = shared_components.EmblemSlot(_xml.readVector3(ctx, subsection, 'rayStart'), _xml.readVector3(ctx, subsection, 'rayEnd'), _xml.readVector3(ctx, subsection, 'rayUp'), _xml.readPositiveFloat(ctx, subsection, 'size'), subsection.readBool('hideIfDamaged', False), _ALLOWED_EMBLEM_SLOTS[_ALLOWED_EMBLEM_SLOTS.index(sname)], subsection.readBool('isMirrored', False), subsection.readBool('isUVProportional', True), _xml.readIntOrNone(ctx, subsection, 'emblemId'))
        slots.append(descr)

    return tuple(slots)
def _readEmblemSlot(ctx, subsection, slotType):
    descr = shared_components.EmblemSlot(
        _xml.readVector3(ctx, subsection, 'rayStart'),
        _xml.readVector3(ctx, subsection, 'rayEnd'),
        _xml.readVector3(ctx, subsection, 'rayUp'),
        _xml.readPositiveFloat(ctx, subsection, 'size'),
        subsection.readBool('hideIfDamaged', False), slotType,
        subsection.readBool('isMirrored', False),
        subsection.readBool('isUVProportional', True),
        _xml.readIntOrNone(ctx, subsection, 'emblemId'))
    return descr
예제 #4
0
def _readEmblemSlot(ctx, subsection, slotType):
    descr = shared_components.EmblemSlot(
        _xml.readVector3(ctx, subsection, 'rayStart'),
        _xml.readVector3(ctx, subsection, 'rayEnd'),
        _xml.readVector3(ctx, subsection, 'rayUp'),
        _xml.readPositiveFloat(ctx, subsection, 'size'),
        subsection.readBool('hideIfDamaged', False), slotType,
        subsection.readBool('isMirrored', False),
        subsection.readBool('isUVProportional', True),
        _xml.readIntOrNone(ctx, subsection, 'emblemId'),
        _xml.readInt(ctx, subsection, 'slotId'),
        subsection.readBool('applyToFabric', True),
        _readCompatibleModels(subsection, ctx))
    _verifySlotId(ctx, slotType, descr.slotId)
    return descr