def __init__(self):
     self.__attachedVehicleMatrix = Math.WGAdaptiveMatrixProvider()
     self.__attachedVehicleMatrix.target = math_utils.createIdentityMatrix()
     self.__ownVehicleMProv = Math.WGAdaptiveMatrixProvider()
     self.__ownVehicleMProv.target = math_utils.createIdentityMatrix()
     self.__ownVehicleTurretMProv = Math.WGAdaptiveMatrixProvider()
     self.__ownVehicleTurretMProv.target = math_utils.createIdentityMatrix()
     self.onVehicleMatrixBindingChanged = Event()
 def enable(self, **args):
     self.measureDeltaTime()
     self.delayCallback(0.0, self._update)
     camMatrix = args.get('camMatrix', BigWorld.camera().matrix)
     self._cam.set(camMatrix)
     self._cam.invViewProvider.a = camMatrix
     self._cam.invViewProvider.b = math_utils.createIdentityMatrix()
     cameraTransitionDuration = args.get('transitionDuration', -1)
     if cameraTransitionDuration > 0:
         self.__cameraTransition.start(BigWorld.camera().matrix, self._cam,
                                       cameraTransitionDuration)
         BigWorld.camera(self.__cameraTransition)
     else:
         BigWorld.camera(self._cam)
     worldMat = Math.Matrix(self._cam.invViewMatrix)
     self.__ypr = Math.Vector3(worldMat.yaw, worldMat.pitch, worldMat.roll)
     self.__position = worldMat.translation
     self.__velocity = Math.Vector3()
     self.__yprVelocity = Math.Vector3()
     self.__zoomVelocity = 0.0
     self.__resetSenses()
     self.__basisMProv.bind(None)
     self.__rotateAroundPointEnabled = False
     self._alignerToLand.disable()
     self._cam.speedTreeTarget = self._cam.invViewMatrix
     self.resetMovement()
     if isPlayerAvatar() and self.guiSessionProvider.getCtx(
     ).isPlayerObserver():
         BigWorld.player().positionControl.moveTo(self.__position)
         BigWorld.player().positionControl.followCamera(True)
     return
 def selectPlacement(self, placement):
     if self.__vehicle is None:
         return
     else:
         self.__placement = placement
         self.__lookAtProvider = None
         if placement == _VehicleBounder.SELECT_CHASSIS:
             self.matrix = self.__vehicle.matrix
         elif placement == _VehicleBounder.SELECT_TURRET:
             self.matrix = AimingSystems.getTurretMatrixProvider(
                 self.__vehicle.typeDescriptor, self.__vehicle.matrix,
                 self.__vehicle.appearance.turretMatrix)
         elif placement == _VehicleBounder.SELECT_GUN:
             turretMatrixProv = AimingSystems.getTurretMatrixProvider(
                 self.__vehicle.typeDescriptor, self.__vehicle.matrix,
                 self.__vehicle.appearance.turretMatrix)
             self.matrix = AimingSystems.getGunMatrixProvider(
                 self.__vehicle.typeDescriptor, turretMatrixProv,
                 self.__vehicle.appearance.gunMatrix)
         elif placement == _VehicleBounder.SELECT_LOOK_AT:
             self.matrix = math_utils.createIdentityMatrix()
             self.__lookAtProvider = math_utils.MatrixProviders.product(
                 math_utils.createTranslationMatrix(self.__boundLocalPos),
                 self.__vehicle.matrix)
         return
 def __refineVehicleMProv(self, vehicleMProv):
     vehicleTranslationOnly = Math.WGTranslationOnlyMP()
     vehicleTranslationOnly.source = vehicleMProv
     refinedMatrixProvider = Math.MatrixProduct()
     refinedMatrixProvider.a = math_utils.createIdentityMatrix()
     refinedMatrixProvider.b = vehicleTranslationOnly
     return refinedMatrixProvider
 def __init__(self):
     self.matrix = math_utils.createIdentityMatrix()
     self.__boundLocalPos = None
     self.__vehicle = None
     self.__lookAtProvider = None
     self.__placement = _VehicleBounder.SELECT_CHASSIS
     return
Beispiel #6
0
 def __init__(self, model, nodeToAttach):
     self.__model = model
     self.__stickerModel = BigWorld.WGStickerModel()
     self.__stickerModel.setLODDistance(1000.0)
     self.__stickerModel.setupSuperModel(model,
                                         math_utils.createIdentityMatrix())
     nodeToAttach.attach(self.__stickerModel)
     self.__damageStickers = {}
Beispiel #7
0
 def __generateDestructionEffect(self, debris):
     debrisDesc = debris.debrisDesc
     effectData = debrisDesc.destructionEffectData
     if effectData is not None:
         keyPoints, effects, _ = random.choice(effectData)
         debris.boundEffects.addNewToNode(
             tankStructure.TankPartNames.CHASSIS,
             math_utils.createIdentityMatrix(),
             effects,
             keyPoints,
             isPlayerVehicle=debris.isPlayer)
     return
Beispiel #8
0
def computeTransform(confDict):
    matDict = {
        'preRotate': math_utils.createIdentityMatrix(),
        'postRotate': math_utils.createIdentityMatrix(),
        'vect': math_utils.createIdentityMatrix()
    }
    if any(
            isinstance(confDict[confKey][0], tuple)
            for confKey in matDict.keys()):
        for confKey in matDict.keys():
            if isinstance(confDict[confKey][0], tuple):
                keyframes = []
                for keyframe in confDict[confKey]:
                    timeStamp, value = keyframe
                    if 'vect' in confKey:
                        Mat = math_utils.createTranslationMatrix(value)
                    else:
                        Mat = math_utils.createRotationMatrix(value)
                    keyframes.append((timeStamp, Mat))
                MatAn = Math.MatrixAnimation()
                MatAn.keyframes = keyframes
                MatAn.time = 0.0
                MatAn.loop = True
            elif 'vect' in confKey:
                MatAn = math_utils.createTranslationMatrix(confDict[confKey])
            else:
                MatAn = math_utils.createRotationMatrix(confDict[confKey])
            matDict[confKey] = MatAn

        matProd = math_utils.MatrixProviders.product(matDict['vect'],
                                                     matDict['postRotate'])
        LightMat = math_utils.MatrixProviders.product(matDict['preRotate'],
                                                      matProd)
    else:
        preRotate = math_utils.createRotationMatrix(confDict['preRotate'])
        postRotate = math_utils.createRotationMatrix(confDict['postRotate'])
        LightMat = math_utils.createTranslationMatrix(confDict['vect'])
        LightMat.postMultiply(postRotate)
        LightMat.preMultiply(preRotate)
    return LightMat
def createSwingingAnimator(gameObject, vehicleDesc, basisMatrix=None, worldMProv=None, lodLink=None):
    swingingAnimator = gameObject.createComponent(Vehicular.SwingingAnimator)
    swingingAnimator.basisMatrix = basisMatrix
    swingingCfg = vehicleDesc.hull.swinging
    pp = tuple((p * m for p, m in zip(swingingCfg.pitchParams, (0.9, 1.88, 0.3, 4.0, 1.0, 1.0))))
    swingingAnimator.setupPitchSwinging(*pp)
    swingingAnimator.setupRollSwinging(*swingingCfg.rollParams)
    swingingAnimator.setupShotSwinging(swingingCfg.sensitivityToImpulse)
    swingingAnimator.maxMovementSpeed = vehicleDesc.physics['speedLimits'][0]
    swingingAnimator.lodSetting = swingingCfg.lodDist
    swingingAnimator.worldMatrix = worldMProv if worldMProv is not None else math_utils.createIdentityMatrix()
    swingingAnimator.lodLink = lodLink
    return swingingAnimator
 def bind(self, vehicle, bindWorldPos=None):
     self.__vehicle = vehicle
     if vehicle is None:
         self.matrix = math_utils.createIdentityMatrix()
         self.__lookAtProvider = None
         return
     else:
         toLocalMat = Matrix(vehicle.matrix)
         toLocalMat.invert()
         self.__boundLocalPos = None if bindWorldPos is None else toLocalMat.applyPoint(
             bindWorldPos)
         self.selectPlacement(_VehicleBounder.SELECT_CHASSIS)
         return
Beispiel #11
0
def nodeWatcher(section, nodeName, upperMat=math_utils.createIdentityMatrix()):
    retMat = None
    for curName, curSect in section.items():
        if curName == 'node':
            returnMat = Math.Matrix()
            returnMat.set(upperMat)
            returnMat.postMultiply(curSect['transform'].asMatrix)
            if curSect['identifier'].asString == nodeName:
                return returnMat
            retMat = nodeWatcher(curSect, nodeName, returnMat)
            if retMat is not None:
                return retMat

    return retMat
 def __getInsigniaAttachNode(self, insigniaType, isDamaged, compoundModel):
     if isDamaged:
         toPartRoot = math_utils.createIdentityMatrix()
         gunNode = compoundModel.node(TankPartNames.GUN)
     else:
         if self.__animateGunInsignia:
             idx = Insignia.Types.ALL.index(insigniaType)
             gunNode = compoundModel.node(Insignia.NodeNames.ALL[idx])
         else:
             gunNode = compoundModel.node(TankNodeNames.GUN_INCLINATION)
         if gunNode is None:
             return (None, None)
         toPartRoot = Math.Matrix(gunNode)
         toPartRoot.invert()
         toPartRoot.preMultiply(compoundModel.node(TankNodeNames.GUN_INCLINATION))
     return (gunNode, toPartRoot)
    def __init__(self, componentIdx, stickerPacks, vDesc, emblemSlots):
        self.__componentIdx = componentIdx
        self.__stickerPacks = stickerPacks
        for slot in emblemSlots:
            if slot.type in self.__stickerPacks:
                stickerPackTuple = self.__stickerPacks[slot.type]
                for stickerPack in stickerPackTuple:
                    stickerPack.bind(componentIdx, slot)

        self.__model = None
        self.__toPartRootMatrix = math_utils.createIdentityMatrix()
        self.__parentNode = None
        self.__isDamaged = False
        self.__stickerModel = BigWorld.WGStickerModel()
        self.__stickerModel.setLODDistance(vDesc.type.emblemsLodDist)
        return
Beispiel #14
0
def attach(vehicleID, modID=None, visible=False):
    if vehicleID not in dynamic_db:
        return
    for mod, dyn in dynamic_db[vehicleID].iteritems():
        if modID is not None and modID != mod:
            continue
        dyn['entered'] = True
        if not dyn['loaded']:
            return
        vEntity = BigWorld.entity(vehicleID)
        if vEntity is None:
            return
        compoundModel = vEntity.model
        scaleMat = math_utils.createIdentityMatrix()
        attachMode = dyn['mode']
        if 'scale' in attachMode:
            scaleMat.setScale(Math.Vector3(1.025))
        for modelDict in dyn['models'].itervalues():
            model = modelDict['model']
            if model is not None:
                if 'attach' in attachMode:
                    try:
                        compoundModel.node(modelDict['nodeName']).attach(
                            model, scaleMat)
                    except StandardError:
                        if g_config.data['isDebug']:
                            traceback.print_exc()
                elif 'motor' in attachMode:
                    if model not in BigWorld.models():
                        modelDict['motor'] = motor = BigWorld.Servo(
                            math_utils.MatrixProviders.product(
                                compoundModel.node(modelDict['nodeName']),
                                scaleMat))
                        model.addMotor(motor)
                        BigWorld.addModel(model)
                model.visible = visible and dyn['visible']
Beispiel #15
0
def new_setupModel(base, self, buildIdx):
    base(self, buildIdx)
    if not g_config.data['enabled']:
        return
    if g_config.collisionMode:
        vEntity = self._HangarVehicleAppearance__vEntity
        vDesc = self._HangarVehicleAppearance__vDesc
        compoundModel = vEntity.model
        self.collisionLoaded = True
        self.modifiedModelsDesc = {}
        failList = []
        for partName in TankPartNames.ALL:
            modelName = ''
            try:
                modelName = getattr(vDesc, partName).hitTester.bspModelName
                model = BigWorld.Model(modelName)
                model.visible = False
                self.modifiedModelsDesc[partName] = {
                    'model': model,
                    'matrix': None
                }
            except StandardError:
                self.collisionLoaded = False
                failList.append(modelName if modelName else partName)
        if failList:
            print g_config.ID + ': collision load failed: models not found', failList
        if not self.collisionLoaded:
            return
        # Getting offset matrices
        hullOffset = math_utils.createTranslationMatrix(
            vDesc.chassis.hullPosition)
        self.modifiedModelsDesc[TankPartNames.CHASSIS][
            'matrix'] = fullChassisMP = math_utils.createIdentityMatrix()
        hullMP = math_utils.MatrixProviders.product(
            math_utils.createIdentityMatrix(), hullOffset)
        self.modifiedModelsDesc[TankPartNames.HULL][
            'matrix'] = fullHullMP = math_utils.MatrixProviders.product(
                hullMP, fullChassisMP)
        for idx in xrange(len(vDesc.hull.turretPositions)):
            if idx:
                print g_config.ID + ': WARNING: multiple turrets are present!', vDesc.name
                break
            turretOffset = math_utils.createTranslationMatrix(
                vDesc.hull.turretPositions[idx])
            gunOffset = math_utils.createTranslationMatrix(
                vDesc.turret.gunPosition)
            # Getting local transform matrices
            turretMP = math_utils.MatrixProviders.product(
                math_utils.createIdentityMatrix(), turretOffset)
            gunMP = math_utils.MatrixProviders.product(
                math_utils.createIdentityMatrix(), gunOffset)
            # turretMP = math_utils.MatrixProviders.product(vEntity.appearance.turretMatrix, turretOffset)
            # gunMP = math_utils.MatrixProviders.product(vEntity.appearance.gunMatrix, gunOffset)
            # Getting full transform matrices relative to vehicle coordinate system
            self.modifiedModelsDesc[TankPartNames.TURRET][
                'matrix'] = fullTurretMP = math_utils.MatrixProviders.product(
                    turretMP, fullHullMP)
            self.modifiedModelsDesc[TankPartNames.GUN][
                'matrix'] = math_utils.MatrixProviders.product(
                    gunMP, fullTurretMP)
        for moduleDict in self.modifiedModelsDesc.itervalues():
            motor = BigWorld.Servo(
                math_utils.MatrixProviders.product(moduleDict['matrix'],
                                                   vEntity.matrix))
            moduleDict['model'].addMotor(motor)
            if moduleDict['model'] not in tuple(vEntity.models):
                try:
                    vEntity.addModel(moduleDict['model'])
                except StandardError:
                    pass
            moduleDict['model'].visible = True
        addCollisionGUI(self)
    if g_config.collisionMode == 1:
        for moduleName in TankPartNames.ALL:
            # noinspection PyUnboundLocalVariable
            if compoundModel.node(moduleName) is not None:
                scaleMat = Math.Matrix()
                scaleMat.setScale((0.001, 0.001, 0.001))
                compoundModel.node(moduleName, scaleMat)
            else:
                print g_config.ID + ': model rescale for', moduleName, 'failed'
                                   Math.Vector4(DEFAULT_GLOSS),
                                   Math.Vector4(DEFAULT_METALLIC), False, '')
ProjectionDecalGenericParams = namedtuple(
    'ProjectionDecalGenericParams',
    ('tintColor', 'position', 'rotation', 'scale', 'decalMap', 'glossDecalMap',
     'applyAreas', 'clipAngle', 'mirroredHorizontally', 'mirroredVertically',
     'doubleSided', 'scaleBySlotSize'))
ProjectionDecalGenericParams.__new__.__defaults__ = (Math.Vector4(0.0),
                                                     Math.Vector3(0.0),
                                                     Math.Vector3(
                                                         0.0, 1.0, 0.0), 1.0,
                                                     '', '', 0.0, 0.0, False,
                                                     False, False, True)
ModelAnimatorParams = namedtuple('ModelAnimatorParams',
                                 ('transform', 'attachNode', 'animatorName'))
ModelAnimatorParams.__new__.__defaults__ = (math_utils.createIdentityMatrix(),
                                            '', '')
LoadedModelAnimator = namedtuple('LoadedModelAnimator',
                                 ('animator', 'node', 'attachmentPartNode'))
AttachmentParams = namedtuple(
    'AttachmentParams',
    ('transform', 'attachNode', 'modelName', 'sequenceId', 'attachmentLogic',
     'initialVisibility', 'partNodeAlias'))
AttachmentParams.__new__.__defaults__ = (math_utils.createIdentityMatrix(), '',
                                         '', None, '', True, '')
_isDeferredRenderer = isRendererPipelineDeferred()


def prepareFashions(isDamaged):
    if isDamaged:
        fashions = [None, None, None, None]
Beispiel #17
0
def lightsCreate(vehicleID, callPlace=''):
    try:
        vehicle = BigWorld.player().arena.vehicles[vehicleID]
        vEntity = BigWorld.entity(vehicleID)
        if vEntity is None:
            return
        vDesc = vEntity.typeDescriptor
        if vehicleID == BigWorld.player().playerVehicleID:
            print 'LampLights: Create at %s' % callPlace
        constNodesList = [
            TankNodeNames.TRACK_LEFT_UP_FRONT,
            TankNodeNames.TRACK_LEFT_UP_REAR,
            TankNodeNames.TRACK_RIGHT_UP_FRONT,
            TankNodeNames.TRACK_RIGHT_UP_REAR
        ]
        compoundModel = vEntity.appearance.compoundModel
        nodeListML, nodeListNL = findWheelNodes(vehicleID, 'L')
        nodeListMR, nodeListNR = findWheelNodes(vehicleID, 'R')
        fakesDict[vehicleID] = fakeDict = {}
        fakeMotorsDict[vehicleID] = fakeMotorDict = {}

        sourcesDict = {TankPartNames.CHASSIS: None, TankPartNames.HULL: None}
        for tankPartName in sourcesDict.keys():
            curSource = getattr(vDesc, tankPartName).models.undamaged
            modelSec = ResMgr.openSection(curSource)
            if modelSec is None:
                print 'LampLights: file not found:', curSource
            sourceSecStr = modelSec['nodefullVisual'].asString
            sourceSec = ResMgr.openSection(sourceSecStr + '.visual')
            if sourceSec is None:
                sourceSec = ResMgr.openSection(sourceSecStr +
                                               '.visual_processed')
            if sourceSec is None:
                print 'LampLights: visual not found for', curSource
                print callPlace
            else:
                sourcesDict[tankPartName] = sourceSec
        HullMat = math_utils.createIdentityMatrix()
        deHullMat = math_utils.createIdentityMatrix()
        if sourcesDict[TankPartNames.CHASSIS] is not None:
            deHullMat = nodeWatcher(sourcesDict[TankPartNames.CHASSIS], 'V')
            deHullMat.invert()
        for tankPartName in (TankPartNames.CHASSIS, TankPartNames.HULL):
            fakeDict[tankPartName] = BigWorld.Model('objects/fake_model.model')
            fakeDict[tankPartName +
                     'Root'] = BigWorld.Model('objects/fake_model.model')
            compoundModel.node(TankPartNames.HULL).attach(
                fakeDict[tankPartName + 'Root'],
                HullMat if 'hull' in tankPartName else deHullMat)
            if fakeMotorDict.get(tankPartName) not in tuple(
                    fakeDict[tankPartName].motors):
                fakeMotorDict[tankPartName] = BigWorld.Servo(
                    fakeDict[tankPartName + 'Root'].matrix)
                fakeDict[tankPartName].addMotor(fakeMotorDict[tankPartName])
            if fakeDict[tankPartName] not in tuple(BigWorld.models()):
                BigWorld.addModel(fakeDict[tankPartName])
        for idx, node in enumerate(nodeListNL):
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            fakeDict[TankPartNames.CHASSIS].node('', nodeListML[idx]).attach(
                fakeDict[node])

        for idx, node in enumerate(nodeListNR):
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            fakeDict[TankPartNames.CHASSIS].node('', nodeListMR[idx]).attach(
                fakeDict[node])

        for node in constNodesList:
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            restoreMat = math_utils.createIdentityMatrix()
            transMat = None
            isChassis = False
            if sourcesDict[TankPartNames.HULL] is not None:
                transMat = nodeWatcher(sourcesDict[TankPartNames.HULL], node)
            if transMat is None and sourcesDict[
                    TankPartNames.CHASSIS] is not None:
                transMat = nodeWatcher(sourcesDict[TankPartNames.CHASSIS],
                                       node)
                if transMat is None:
                    transMat = nodeWatcher(sourcesDict[TankPartNames.CHASSIS],
                                           node.replace('Up', ''))
                isChassis = True
            if transMat is None:
                print _config.ID + ': restore Matrix not found for node', node, 'in', vDesc.hull.models.undamaged
                print callPlace
            else:
                restoreMat.setTranslate(transMat.translation)
            fakeDict[TankPartNames.HULL if not isChassis else TankPartNames.
                     CHASSIS].node('', restoreMat).attach(fakeDict[node])

        fakeDict[TankPartNames.GUN +
                 'Root'] = BigWorld.Model('objects/fake_model.model')
        compoundModel.node(TankPartNames.GUN).attach(
            fakeDict[TankPartNames.GUN + 'Root'])
        fakeDict[TankPartNames.GUN] = BigWorld.Model(
            'objects/fake_model.model')
        if fakeMotorDict.get(TankPartNames.GUN) not in tuple(
                fakeDict[TankPartNames.GUN].motors):
            fakeMotorDict[TankPartNames.GUN] = BigWorld.Servo(
                fakeDict[TankPartNames.GUN + 'Root'].matrix)
            fakeDict[TankPartNames.GUN].addMotor(
                fakeMotorDict[TankPartNames.GUN])
        if fakeDict[TankPartNames.GUN] not in tuple(BigWorld.models()):
            BigWorld.addModel(fakeDict[TankPartNames.GUN])
        fakeDict[TankPartNames.TURRET] = BigWorld.Model(
            'objects/fake_model.model')
        fakeDict[TankPartNames.TURRET +
                 'Root'] = BigWorld.Model('objects/fake_model.model')
        fakeDict[TankPartNames.TURRET +
                 'RootRoot'] = BigWorld.Model('objects/fake_model.model')
        hull_bbox_min, hull_bbox_max, _ = vDesc.hull.hitTester.bbox
        turret_pos_on_hull = vDesc.hull.turretPositions[0]
        turret_bbox_max = vDesc.turret.hitTester.bbox[1]
        gun_pos_on_turret = vDesc.turret.gunPosition
        gun_pos_on_hull = gun_pos_on_turret + turret_pos_on_hull
        gun_bbox_max = vDesc.gun.hitTester.bbox[1]
        if hull_bbox_max.y >= turret_pos_on_hull.y + turret_bbox_max.y:
            observer_pos = Math.Vector3(0, hull_bbox_max.y, 0)
            node = TankPartNames.HULL
        elif gun_pos_on_turret.y + gun_bbox_max.y >= turret_bbox_max.y:
            observer_pos = Math.Vector3(0, gun_bbox_max.y, 0)
            node = TankPartNames.GUN
        else:
            observer_pos = Math.Vector3(0, turret_bbox_max.y, 0)
            node = TankPartNames.TURRET
        mat = Math.Matrix()
        mat.setTranslate(observer_pos)
        compoundModel.node(node).attach(fakeDict[TankPartNames.TURRET +
                                                 'RootRoot'])
        if fakeMotorDict.get(TankPartNames.TURRET + 'Root') not in tuple(
                fakeDict[TankPartNames.TURRET + 'Root'].motors):
            fakeMotorDict[TankPartNames.TURRET + 'Root'] = BigWorld.Servo(
                fakeDict[TankPartNames.TURRET + 'RootRoot'].matrix)
            fakeDict[TankPartNames.TURRET + 'Root'].addMotor(
                fakeMotorDict[TankPartNames.TURRET + 'Root'])
        if fakeDict[TankPartNames.TURRET + 'Root'] not in tuple(
                BigWorld.models()):
            BigWorld.addModel(fakeDict[TankPartNames.TURRET + 'Root'])
        fakeDict[TankPartNames.TURRET + 'Root'].node('', mat).attach(
            fakeDict[TankPartNames.TURRET])

        hullLocalCenterY = (hull_bbox_min.y + hull_bbox_max.y) / 2.0
        hullLocalCenterZ = (hull_bbox_min.z + hull_bbox_max.z) / 2.0
        nodes = {
            'hullLocalPt1':
            Math.Vector3(0.0, hullLocalCenterY, hull_bbox_max.z),
            'hullLocalPt2':
            Math.Vector3(0.0, hullLocalCenterY, hull_bbox_min.z),
            'hullLocalPt3':
            Math.Vector3(hull_bbox_max.x, gun_pos_on_hull.y, hullLocalCenterZ),
            'hullLocalPt4':
            Math.Vector3(hull_bbox_min.x, gun_pos_on_hull.y, hullLocalCenterZ),
            'hullGunLocal':
            gun_pos_on_hull
        }
        for node in nodes:
            fakeDict[node] = BigWorld.Model('objects/fake_model.model')
            fakeDict[TankPartNames.HULL].node(
                '', math_utils.createTranslationMatrix(nodes[node])).attach(
                    fakeDict[node])

        lightDBDict.setdefault(vehicleID, {})
        for configDict in _config.configsDict.values():
            for name in sorted(configDict.keys()):
                try:
                    if name in ('enable', 'meta', 'attachToPlayer',
                                'attachToAlly', 'attachToEnemy'):
                        continue
                    confDict = configDict[name]
                    needToAttach = \
                        confDict['attachToPlayer'] and vehicleID == BigWorld.player().playerVehicleID or \
                        confDict['attachToEnemy'] and vehicle['team'] != BigWorld.player().team or \
                        confDict['attachToAlly'] and vehicleID != BigWorld.player().playerVehicleID and \
                        vehicle['team'] == BigWorld.player().team
                    if not needToAttach:
                        continue
                    nodeL = []
                    if '.' in name:
                        nodeL.append(confDict['place'])
                    elif confDict['place'] == 'leftFront':
                        nodeL.append(TankNodeNames.TRACK_LEFT_UP_FRONT)
                    elif confDict['place'] == 'rightFront':
                        nodeL.append(TankNodeNames.TRACK_RIGHT_UP_FRONT)
                    elif confDict['place'] == 'leftRear':
                        nodeL.append(TankNodeNames.TRACK_LEFT_UP_REAR)
                    elif confDict['place'] == 'rightRear':
                        nodeL.append(TankNodeNames.TRACK_RIGHT_UP_REAR)
                    elif confDict['place'] == 'hull':
                        nodeL.append(TankPartNames.HULL)
                    elif confDict['place'] == 'turret':
                        nodeL.append(TankPartNames.TURRET)
                    elif confDict['place'] == 'spot':
                        nodeL.extend([TankPartNames.TURRET, TankPartNames.GUN])
                        nodeL.extend(
                            ['hullLocalPt%s' % num for num in xrange(1, 5)])
                        nodeL.append('hullGunLocal')
                    elif 'wheels' in confDict['place']:
                        if 'left' in confDict['place']:
                            nodeL.extend(nodeListNL)
                        else:
                            nodeL.extend(nodeListNR)

                    nameTree = name.split('.')[:-1]
                    namesList = []
                    for curKey in lightDBDict[vehicleID].keys():
                        curTree = curKey.split('.')
                        if len(curTree) != len(nameTree) or any(
                                upperName not in curTree[depth]
                                for depth, upperName in enumerate(nameTree)):
                            continue
                        namesList.append(curKey + '.' + name.split('.')[-1])
                    if not namesList:
                        namesList = [name]
                    for fullName in namesList:
                        for node in nodeL:
                            curName = fullName + ':' + node
                            if 'model' not in confDict['type']:
                                if confDict['type'] == 'spotLight':
                                    LightSource = BigWorld.PySpotLight()
                                    LightSource.coneAngle = confDict['ca']
                                else:
                                    LightSource = BigWorld.PyOmniLight()
                                    if confDict['type'] != 'omniLight':
                                        LOG_ERROR(
                                            'Unknown type of %s: %s. Set to omniLight'
                                            % (name, confDict['type']))
                                LightSource.innerRadius = confDict[
                                    'innerRadius']
                                LightSource.outerRadius = confDict[
                                    'outerRadius']
                                LightSource.castShadows = confDict['cs']
                                LightSource.multiplier = confDict['bright']
                                if isinstance(confDict['colour'][0], tuple):
                                    if confDict['type'] != 'spotLight':
                                        FrontLightShader = Math.Vector4Animation(
                                        )
                                        FrontLightShader.duration = confDict[
                                            'dur']
                                        FrontLightShader.keyframes = confDict[
                                            'colour']
                                        LightSource.colorAnimator = FrontLightShader
                                    else:
                                        LightSource.colour = confDict[
                                            'colour'][0][1]
                                else:
                                    LightSource.colour = confDict['colour']
                            else:
                                LightSource = BigWorld.Model(confDict['path'])
                            if '.' not in name:
                                if node in fakeDict:
                                    fakeNode = fakeDict[node].node(
                                        '', computeTransform(confDict))
                            else:
                                if curName not in fakeDict:
                                    fakeDict[curName] = BigWorld.Model(
                                        'objects/fake_model.model')
                                    lightDBDict[vehicleID][curName.rsplit(
                                        '.', 1)[0]].node(node).attach(
                                            fakeDict[curName])
                                fakeNode = fakeDict[curName].node(
                                    '', computeTransform(confDict))
                            if 'model' not in confDict['type']:
                                # noinspection PyUnboundLocalVariable
                                LightSource.source = fakeNode
                            elif not LightSource.attached:
                                fakeNode.attach(LightSource)
                            lightVisible(
                                LightSource, _config.isLampsVisible
                                and name in _config.modes['constant'])
                            lightDBDict[vehicleID][curName] = LightSource

                except StandardError:
                    traceback.print_exc()
                    print name
                    print callPlace
                    print vDesc.name

    except StandardError:
        traceback.print_exc()
        print callPlace
 def __init__(self):
     self._matrix = math_utils.createIdentityMatrix()
 def __relinkToIdentity(self):
     self.__outputMProv.rotationSrc = math_utils.createIdentityMatrix()
     self.__outputMProv.translationSrc = self.__outputMProv.rotationSrc
     self.__stabilisedMProv.target = self.__outputMProv.rotationSrc