def __onModelLoaded(self, attachNode, scaleMatrix, translationMatrix, resourceRefs): if self.__modelName not in resourceRefs.failedIDs: model = resourceRefs[self.__modelName] if not self.__active: return if attachNode.isDangling: return BigWorld.player().addModel(model) yawOnly = Math.WGYawOnlyTransform() yawOnly.source = attachNode posOnly = Math.WGTranslationOnlyMP() posOnly.source = attachNode noPithRollMatrix = Math.WGCombinedMP() noPithRollMatrix.rotationSrc = yawOnly noPithRollMatrix.translationSrc = posOnly localTransform = Math.MatrixProduct() localTransform.a = scaleMatrix localTransform.b = translationMatrix refinedMatrixProvider = Math.MatrixProduct() refinedMatrixProvider.a = localTransform refinedMatrixProvider.b = noPithRollMatrix servo = BigWorld.Servo(refinedMatrixProvider) model.addMotor(servo) self.__models.append({'model': model, 'servo': servo}) else: LOG_ERROR('Could not load model %s' % self.__modelName)
def __init__(self, configDataSec): CallbackDelayer.__init__(self) TimeDeltaMeter.__init__(self, time.clock) self._cam = BigWorld.FreeCamera() self._cam.invViewProvider = Math.MatrixProduct() self.__cameraTransition = BigWorld.TransitionCamera() self.__ypr = Math.Vector3() self.__position = Math.Vector3() self.__defaultFov = BigWorld.projection().fov self.__velocity = Math.Vector3() self.__isVerticalVelocitySeparated = False self.__yprVelocity = Math.Vector3() self.__zoomVelocity = 0.0 self._inertiaEnabled = False self._movementInertia = None self._rotationInertia = None self._movementSensor = None self._verticalMovementSensor = None self._rotationSensor = None self._zoomSensor = None self._targetRadiusSensor = None self._mouseSensitivity = 0.0 self._scrollSensitivity = 0.0 self.__rotateAroundPointEnabled = False self.__rotationRadius = 40.0 self._alignerToLand = _AlignerToLand() self.__predefinedVelocities = {} self.__predefinedVerticalVelocities = {} self._keySwitches = {} self._readCfg(configDataSec) self.__isModeOverride = False self.__basisMProv = _VehicleBounder() self.__entityPicker = _VehiclePicker() return
def onHangarUnloaded(self): if self.__delayedInitCB: BigWorld.cancelCallback(self.__delayedInitCB) self.__delayedInitCB = None if self.__hangarLoaded: if self.__soPlane: cam = BigWorld.camera() if cam: soundPos = Math.Matrix( self.__soPlane.transform).translation offsMatrix = Math.Matrix() offsMatrix.translation = soundPos - cam.position matProduct = Math.MatrixProduct() matProduct.b = offsMatrix matProduct.a = cam.invViewMatrix self.__soPlane.transform = matProduct else: self.__soPlane.position = Math.Vector3(0.0, 0.0, 0.0) self.__soPlane.transform = None self.__soPlane.postEvent(STOP_SOUND_NAME, False, None) BigWorld.callback( PLANE_SOUND_DESTROY_DELAY, partial(self.__postponeDestroy, self.__soPlane)) self.__soPlane = None self.__clear() self.__hangarLoaded = False return
def __init__(self, cameraPosition, cameraTarget, sourceMatrix, cursor): self._planeMtxProvider = Math.MatrixProduct() self._planeMtxProvider.a = sourceMatrix self._planeMtxProvider.b = Math.Matrix() self._planeMtxProvider.b.setIdentity() self.__camera = BigWorld.CombatCamera(cameraPosition, cameraTarget, Math.Vector4(0.0, 1.0, 0.0, 0.0), self._planeMtxProvider) self.__camera.Reset()
def __refineVehicleMProv(self, vehicleMProv): vehicleTranslationOnly = Math.WGTranslationOnlyMP() vehicleTranslationOnly.source = vehicleMProv refinedMatrixProvider = Math.MatrixProduct() refinedMatrixProvider.a = mathUtils.createIdentityMatrix() refinedMatrixProvider.b = vehicleTranslationOnly return refinedMatrixProvider
def __pickVehicle(self): if self.__boundVehicleMProv is not None: return else: x, y = GUI.mcursor().position from AvatarInputHandler import cameras dir, start = cameras.getWorldRayAndPoint(x, y) end = start + dir.scale(100000.0) pos, colldata = collideDynamicAndStatic(start, end, (), 0) vehicle = None if colldata is not None: entity = colldata[0] from Vehicle import Vehicle if isinstance(entity, Vehicle): vehMatProv = entity.matrix vehMatInv = Matrix(vehMatProv) vehMatInv.invert() localPos = vehMatInv.applyPoint(pos) result = Math.MatrixProduct() localTransMat = Matrix() localTransMat.translation = localPos result.a = localTransMat result.b = vehMatProv return result return
def enable(self, targetPos, saveDist): self.__prevTime = BigWorld.time() self.__aimingSystem.enable(targetPos) self.__activeDistRangeSettings = self.__getActiveDistRangeForArena() if self.__activeDistRangeSettings is not None: self.__aimingSystem.height = self.__getDistRange()[0] srcMat = math_utils.createRotationMatrix((self.__cameraYaw, -math.pi * 0.499, 0.0)) self.__cam.source = srcMat if not saveDist: self.__updateCamDistCfg() self.__camDist = self._cfg['camDist'] self.__cam.pivotPosition = Math.Vector3(0.0, self.__camDist, 0.0) camTarget = Math.MatrixProduct() camTarget.b = self.__aimingSystem.matrix self.__cam.target = camTarget self.__cam.forceUpdate() BigWorld.camera(self.__cam) BigWorld.player().positionControl.moveTo(self.__aimingSystem.matrix.translation) BigWorld.player().positionControl.followCamera(True) FovExtended.instance().enabled = False BigWorld.projection().fov = StrategicCamera.ABSOLUTE_VERTICAL_FOV self.__cameraUpdate() self.delayCallback(0.0, self.__cameraUpdate) self.__needReset = 1 return
def addEntityTransformViz(entity, scale=0.25): m = transformVizModel() m.empty = 'Custom' m.empty.clothesColour4 = (1, 1, 0.5, 0) mp = Math.MatrixProduct() translate = Math.Matrix() translate.setTranslate((0, 0.35, 0)) t = entity.matrix t.notModel = True mp.a = t mp.b = translate mp2 = Math.MatrixProduct() mp2.a = Math.Matrix() mp2.a.setScale((scale, scale, scale)) mp2.b = mp s = BigWorld.Servo(mp2) m.motors = [s] entity.addModel(m)
def makeVehicleTurretMatrixMP(): matrixProvider = Math.WGCombinedMP() vehicleMatrix = BigWorld.player().consistentMatrices.attachedVehicleMatrix matrixProvider.translationSrc = vehicleMatrix localTransform = Math.MatrixProduct() localTransform.a = BigWorld.player( ).consistentMatrices.ownVehicleTurretMProv localTransform.b = vehicleMatrix matrixProvider.rotationSrc = localTransform return matrixProvider
def __init__(self): self.__dataProvider = None self.__ui = None self.__movie = None self.__matrixProvider = None mtx = Math.MatrixProduct() mtx.a = GameEnvironment.getHUD().offsetMtx.reduction mtx.b = Math.Matrix() mtx.b.setIdentity() self.__targetMtx = mtx return
def __setupCamera(self, targetPos): player = BigWorld.player() desc = player.vehicleTypeDescriptor angles = self.__angles self.__yawLimits = desc.gun['turretYawLimits'] angles[0], angles[1] = getShotAngles(desc, player.getOwnVehicleMatrix(), (0, 0), targetPos, False) self.__pitchLimits = calcPitchLimitsFromDesc(angles[0], desc.gun['pitchLimits']) gunOffs = desc.turret['gunPosition'] self.__gunOffsetMat = Math.Matrix() self.__gunOffsetMat.setTranslate(gunOffs) calc = True if self._USE_SWINGING: vehicle = BigWorld.entity(player.playerVehicleID) if vehicle is not None and vehicle.isStarted: self.__turretJointMat = vehicle.appearance.modelsDesc['hull'][ 'model'].node('HP_turretJoint') self.__chassisMat = vehicle.matrix calc = False if calc: turretOffs = desc.chassis['hullPosition'] + desc.hull[ 'turretPositions'][0] turretOffsetMat = Math.Matrix() turretOffsetMat.setTranslate(turretOffs) self.__turretJointMat = Math.MatrixProduct() self.__turretJointMat.a = turretOffsetMat self.__turretJointMat.b = player.getOwnVehicleMatrix() self.__chassisMat = player.getOwnVehicleMatrix() invGunJointMat = Math.Matrix() invGunJointMat.set(self.__gunOffsetMat) invGunJointMat.postMultiply(self.__turretJointMat) invGunJointMat.invert() invTurretJointMat = Math.Matrix(self.__turretJointMat) invTurretJointMat.invert() gunYawRotateMat = Math.Matrix() gunYawRotateMat.setRotateY(angles[0]) camPosMat = Math.Matrix() camPosMat.set(self.__gunOffsetMat) camPosMat.postMultiply(gunYawRotateMat) camPosMat.postMultiply(self.__turretJointMat) camDir = targetPos - camPosMat.applyToOrigin() angles[0] = invTurretJointMat.applyVector(camDir).yaw angles[1] = invGunJointMat.applyVector(camDir).pitch camMat = Math.Matrix() if self._USE_ALIGN_TO_VEHICLE: up = camPosMat.applyToAxis(1) else: up = Math.Vector3(0, 1, 0) camMat.lookAt(camPosMat.applyToOrigin(), camDir, up) self.__cam.set(camMat) return
def prepareMatrices(self): scaleMatrix = Math.Matrix() scaleMatrix.setScale( (self._settings.modelScaling, self._settings.modelScaling, self._settings.modelScaling)) self.modelTranslationsMatrix = Math.Matrix() productMatrix = Math.MatrixProduct() productMatrix.a = scaleMatrix productMatrix.b = None self.resMatrix = productMatrix self.targetMatrix = productMatrix return
def addModelTransformViz(entity, scale=0.25): m = transformVizModel() m.empty = 'Custom' m.empty.clothesColour4 = (1.0, 0.33, 0.33, 1.0) t = entity.matrix t.notModel = False mp = Math.MatrixProduct() mp.a = Math.Matrix() mp.a.setScale((scale, scale, scale)) mp.b = t s = BigWorld.Servo(mp) m.motors = [s] entity.addModel(m)
def getMarkerParams(cls, matrix, markerStyle=MarkerItem.DEFAULT, bitMask=FLAG.NONE): params = cls.MARKER_DATA.get(markerStyle, {}) if bitMask == FLAG.NONE: bitMask = MarkerParamsFactory.buildBitMask(params) offset = params.get('offset', (0, 10, 0)) mp = Math.MatrixProduct() mp.a = matrix mp.b = Math.Matrix() mp.b.translation = offset params.update({'matrixProduct': mp, 'bitMask': bitMask}) return params
def bomberCloudEffectVisible(self, value): from CommonSettings import BOMBER_EFFECTS if self._bomber_idle_effect is None: om = Math.Matrix() om.translation = BOMBER_EFFECTS.idleClouds.params['offset'] m = Math.MatrixProduct() m.a = BigWorld.player().realMatrix m.b = om effectID = db.DBLogic.g_instance.getEffectId( BOMBER_EFFECTS.idleClouds.name) self._bomber_idle_effect = self._emInst.createModelTargetEffect( effectID, {'matrix': m}) self._bomber_idle_effect.setVisible(value) return
def enable(self, preferredPos=None, closesDist=False, postmortemParams=None): camSource = None camDist = None camTarget = BigWorld.player().getOwnVehicleMatrix() camTargetTransOnly = Math.WGTranslationOnlyMP() camTargetTransOnly.source = camTarget camTarget = Math.MatrixProduct() shift = Math.Matrix() shift.setIdentity() camTarget.a = shift camTarget.b = camTargetTransOnly if not self.__postmortemMode: if preferredPos is not None: self.__calcStartAngles(camTarget, preferredPos) if closesDist: camDist = self.__cfg['distRange'][0] elif postmortemParams is not None: self.__yaw = postmortemParams[0][0] self.__pitch = postmortemParams[0][1] camDist = postmortemParams[1] camSource = Math.Matrix() camSource.setRotateYPR((self.__yaw, self.__pitch, 0)) else: camDist = self.__cfg['distRange'][1] replayCtrl = BattleReplay.g_replayCtrl if replayCtrl.isPlaying: camDist = None vehicle = BigWorld.entity(replayCtrl.playerVehicleID) if vehicle is not None: camTarget = vehicle.matrix if camDist is not None: self.__camDist = camDist self.__cam.pivotMaxDist = camDist if camSource is not None: self.__cam.source = camSource self.__cam.target = camTarget self.__cam.sptHiding = True self.__cam.wg_setModelsToCollideWith(self.__modelsToCollideWith) BigWorld.camera(self.__cam) self.__cameraUpdate() return
def enable(self, targetPos, saveDist): self.__prevTime = BigWorld.time() self.__aimingSystem.enable(targetPos) srcMat = mathUtils.createRotationMatrix((0.0, -math.pi * 0.499, 0.0)) self.__cam.source = srcMat if not saveDist: self.__camDist = self.__cfg['camDist'] self.__cam.pivotPosition = Math.Vector3(0.0, self.__camDist, 0.0) camTarget = Math.MatrixProduct() camTarget.b = self.__aimingSystem.matrix self.__cam.target = camTarget BigWorld.camera(self.__cam) BigWorld.player().positionControl.moveTo( self.__aimingSystem.matrix.translation) BigWorld.player().positionControl.followCamera(True) FovExtended.instance().enabled = False BigWorld.projection().fov = StrategicCamera.ABSOLUTE_VERTICAL_FOV self.__cameraUpdate() self.delayCallback(0.0, self.__cameraUpdate) self.__needReset = 1
def __buid(self): hierarchy = [] linearHierarchy = self.__rootNode.linearHierarchy for parentId, node in linearHierarchy: try: hierarchy.append((parentId, node.localMatrix or Math.Matrix())) except HierarchyWorker.HardpointNotFound: debug_utils.LOG_WARNING_DEBUG('Hardpoint not found "{0}" in object "{1}, {2}"'.format(node.path, self.__context.objDBData.name, getattr(self.__context.objDBData, 'fileName', ''))) hierarchy.append((parentId, Math.Matrix())) matrixProviders = [] matrixProviders.append((0, self.__context.rootMP)) for nodeId, mp in self.__matrixProviderList: matrix = Math.MatrixProduct() matrix.b = linearHierarchy[nodeId][1].localMatrix matrix.a = mp matrixProviders.append((nodeId, matrix)) self.__compoundsForLoad += 1 self.__context.cidProxy.handle = cid = CompoundSystem.addDynamicModel(hierarchy, matrixProviders, self.__modelsList, self.__particleList, self.__loftList, self.__onCompoundLoaded) self.__fashionSyncLists = {} for modelId, fashion, nodeSyncList in self.__fashions: CompoundSystem.setModelFashion(cid, modelId, fashion) hierarchyUpdates = [] for syncNodePath in nodeSyncList: for parentId, node in linearHierarchy: if node.path == syncNodePath: hierarchyUpdates.append((node.id, node.name)) self.__fashionSyncLists.setdefault(modelId, []).extend(hierarchyUpdates) active = 1 if self.__context.rootMP.a is not None and self.__context.isActive else 0 CompoundSystem.changeCompoundActive(cid, active) for dropModelObject, hardpoints, resourceName in self.__dropModels: self.__createDropModel(dropModelObject, hardpoints, resourceName) return
def enable(self, targetPos, saveDist, switchToPos=None, switchToPlace=None): self.__prevTime = BigWorld.time() self.__aimingSystem.enable(targetPos) self.__activeDistRangeSettings = self.__getActiveDistRangeForArena() if self.__activeDistRangeSettings is not None: self.__aimingSystem.height = self.__getDistRange()[0] minDist, maxDist = self.__getDistRange() maxPivotHeight = maxDist - minDist self.__updateCameraYaw() if switchToPlace == SwitchToPlaces.TO_TRANSITION_DIST: self.__camDist = self.__getTransitionCamDist() elif switchToPlace == SwitchToPlaces.TO_RELATIVE_POS and switchToPos is not None: self.__camDist = maxPivotHeight * switchToPos elif switchToPlace == SwitchToPlaces.TO_NEAR_POS and switchToPos is not None: switchToPos = math_utils.clamp(minDist, maxDist, switchToPos) self.__camDist = switchToPos - minDist elif self.settingsCore.getSetting(settings_constants.SPGAim.AUTO_CHANGE_AIM_MODE): self.__camDist = math_utils.clamp(self.__getTransitionCamDist(), maxPivotHeight, self.__camDist) self.__saveDist = saveDist self.__camDist = math_utils.clamp(0, maxPivotHeight, self.__camDist) self.__cam.pivotPosition = Math.Vector3(0.0, self.__camDist, 0.0) self.__scrollSmoother.start(self.__camDist) self.__enableSwitchers() camTarget = Math.MatrixProduct() camTarget.b = self.__aimingSystem.matrix self.__cam.target = camTarget self.__cam.forceUpdate() BigWorld.camera(self.__cam) BigWorld.player().positionControl.moveTo(self.__aimingSystem.matrix.translation) BigWorld.player().positionControl.followCamera(True) FovExtended.instance().enabled = False BigWorld.projection().fov = StrategicCamera.ABSOLUTE_VERTICAL_FOV self.__cameraUpdate() self.delayCallback(0.0, self.__cameraUpdate) self.__needReset = 1 return
def product(a, b): m = Math.MatrixProduct() m.a = a m.b = b return m
def __init__(self, cameraPosition, cameraTarget, sourceMatrix, cursor): self.defaultFov = 0.0 self.fovMultiplier = 1.0 self.__needUpdate = 1 self.__behaviorHorizon = 1 self.__isInDebugMode = False self._planeMtxProvider = Math.MatrixProduct() self._planeMtxProvider.a = sourceMatrix self._planeMtxProvider.b = Math.Matrix() self._planeMtxProvider.b.setIdentity() self._cursorProvider = Math.MatrixProduct() self._cursorProvider.b = Math.Matrix() self._cursorProvider.b.setIdentity() self._cursor = cursor self._cursor.sourceMatrix = self._planeMtxProvider self._cursorProvider.a = self._cursor.matrix fov = BigWorld.CameraComponentGround() fov.minPositionSettings.planeDistance = 0.0 fov.maxPositionSettings.planeDistance = 0.0 fov.minFovMultiplier = 1.0 fov.maxFovMultiplier = 1.0 fov.interpolationFunc = SplineEasing([Math.Vector2(0, 0), Math.Vector2(1, 1)]) fov.minArgumentValue = 0 fov.maxArgumentValue = 1 fov.duration = 0.01 speed = BigWorld.CameraComponentGround() speed.maxPositionSettings.rotationAngle = math.radians(0.0) speed.maxPositionSettings.horizontalOffset = 1.0 speed.maxPositionSettings.verticalOffset = 1.0 speed.maxPositionSettings.planeDistance = -2 speed.minPositionSettings.rotationAngle = math.radians(0.0) speed.minPositionSettings.horizontalOffset = 1.0 speed.minPositionSettings.verticalOffset = 1.0 speed.minPositionSettings.planeDistance = 0.0 speed.maxFovMultiplier = 1.0 speed.minFovMultiplier = 1.0 speed.interpolationFunc = BigWorld.EaseInOutSinusoidal speed.minArgumentValue = 200 speed.maxArgumentValue = 750 speed.duration = 0.01 ground = BigWorld.CameraComponentGround() ground.maxArgumentValue = 100.0 ground.minArgumentValue = 1.0 ground.maxPositionSettings.verticalOffset = 1.0 ground.minPositionSettings.verticalOffset = 0.7 ground.interpolationFunc = BigWorld.EaseInOutSinusoidal ground.duration = 10.0 forsage = BigWorld.CameraComponentForsage() forsage.positionSettings.rotationAngle = math.radians(0.0) forsage.positionSettings.horizontalOffset = 1.0 forsage.positionSettings.verticalOffset = 1.0 forsage.maxFovMultiplier = 1.1 forsage.durationIn = 1.5 forsage.interpolationFuncIn = SplineEasing('0.0, 0.0, 1.0, 1.0') forsage.durationOut = 5.0 forsage.interpolationFuncOut = SplineEasing('0.0, 0.0, 1.0, 1.0') forsage.shakeDuration = 1.0 forsage.shakeAmplitude = math.radians(0.0) forsage.shakeMultiplier = 4.0 forsage.maxArgumentValue = 1.0 forsage.minArgumentValue = 0.0 forsage.planeMatrix = self._planeMtxProvider forsage.cursorMatrix = self._cursorProvider brake = BigWorld.CameraComponentForsage() brake.positionSettings.rotationAngle = math.radians(0.0) brake.positionSettings.horizontalOffset = 1.0 brake.positionSettings.verticalOffset = 1.0 brake.maxFovMultiplier = 0.9 brake.durationIn = 5.0 brake.interpolationFuncIn = SplineEasing('0.0, 0.0, 1.0, 1.0') brake.durationOut = 5.0 brake.interpolationFuncOut = SplineEasing('0.0, 0.0, 1.0, 1.0') brake.shakeDuration = 1.0 brake.shakeAmplitude = math.radians(0.0) brake.shakeMultiplier = 4.0 brake.maxArgumentValue = -1.0 brake.minArgumentValue = 0.0 brake.planeMatrix = self._planeMtxProvider brake.cursorMatrix = self._cursorProvider overlook = BigWorld.CameraComponentOverlook() overlook.maxFovMultiplier = 1.0 overlook.duration = 0.005 overlook.interpolationFunc = BigWorld.EaseInOutExponential overviewMode = BigWorld.CameraComponentForsage() overviewMode.maxFovMultiplier = 1.0 overviewMode.positionSettings.planeDistance = -2 overviewMode.durationIn = 0.4 overviewMode.interpolationFuncIn = BigWorld.EaseInOutCubic overviewMode.durationOut = 0.4 overviewMode.interpolationFuncOut = BigWorld.EaseInOutCubic overviewMode.maxArgumentValue = 1.0 overviewMode.minArgumentValue = 0.0 overviewMode.planeMatrix = Math.Matrix() overviewMode.planeMatrix.setIdentity() overviewMode.cursorMatrix = Math.Matrix() overviewMode.cursorMatrix.setIdentity() self.__offsetProvider = Math.Vector4Combiner() self.__offsetProvider.a = BigWorld.EllipticalPositionProvider() self.__offsetProvider.a.position = cameraPosition self.__offsetProvider.b = Math.Vector4(0.0, 0.0, 0.0, 0.0) self.__targetProvider = Math.Vector4Combiner() self.__targetProvider.a = cameraTarget self.__targetProvider.b = Math.Vector4(0.0, 0.0, 0.0, 0.0) self._cameraBasis = Math.MatrixProduct() self._cameraBasis.b = self._cursorProvider self._cameraBasis.a = overlook.effectMatrix self._input = BigWorld.CameraInput() self._input.accelerationDuration = 0.075 self._input.decelerationDuration = 0.075 self._input.planeMatrix = self._planeMtxProvider self._input.cursorMatrix = self._cursorProvider self._components = {'zoomStateFov': fov, 'forsage': forsage, 'brake': brake, 'speed': speed, 'ground': ground, 'overlook': overlook, 'overviewMode': overviewMode} self.__camera = BigWorld.CombatCamera(self.__offsetProvider, self.__targetProvider, Math.Vector4(0.0, 1.0, 0.0, 0.0), self._cameraBasis)
def __init__(self, isPlayer, entityId, objDBData, partTypes, partsStates, gunsData = [], shelsData = {}, weaponsSlotsDBData = None, weaponSlots = None, fullLoading = True, callback = None, copyFromCompoundID = 0, weaponSoundID = None, turretSoundID = None, camouflage = None, decals = None, builder = ObjectsBuilder): """ :param isPlayer: is main current player model :param entityId: id of parent entity :param objDBData: settings from DBLogic :param partTypes: part types setup ( [{'key':partId, 'value':typeId},...]) :param partsStates: part states setup ( [(partId, stateId),...]) :param gunsData: data of main guns [ (gun.flamePath, group.gunDescription.bulletShot, gun.uniqueId),... ] :param shelsData: data of bombs and rockets [ shellTypeId: [(model, hpName),...] ] :param weaponsSlotsDBData: settingsRoot.components.weapons2 from object DB :param weaponSlots: configuration of weapon slots [(slotId, typeId),...] :param fullLoading: load all states or only current :param callback: loading complete callback """ context = ObjectContext() context.isPlayer = isPlayer context.entityId = entityId context.objDBData = objDBData context.partTypes = dict(((it['key'], it['value']) for it in partTypes)) context.partsStates = dict() context.groundDecalMap = dict() context.weaponsSlotsDBData = weaponsSlotsDBData context.weaponSlots = weaponSlots context.gunsData = gunsData context.shelsData = shelsData context.fullLoading = fullLoading context.isAircraft = hasattr(objDBData, 'flightModel') context.curTimeAction = False context.rootModel = BigWorld.Model(AIRCRAFT_FAKE_MODEL_NAME) context.rootMP = Math.MatrixProduct() context.velocity = Math.Vector3(0, 0, 0) context.cidProxy = BigWorld.PyHandleProxy() context.isLoaded = False context.isDestroyed = False context.partNodeIds = dict() context.effectNodeIds = dict() context.isActive = True context.ikSystems = [] context.ikSystemByPart = {} self.__vseTriggerAgent = VseTriggerAgentDummy from db.DBBaseObject import DBBaseObject context.isBaseObject = issubclass(objDBData.__class__, DBBaseObject) self.__context = context self.__loadingCallback = callback self.__externalNodeNames = [] self.__animatorsController = PartAnimator2.PartAnimatorController(objDBData, entityId) self.__boolCombiner = Helpers.BoolCombiner.BoolCombiner() self.__eventSystem = EventSystem() if hasattr(self.__context.objDBData, 'visualSettings'): self.__surfaceManipulator = SurfaceManipulator.SurfaceManipulator(self.__context.objDBData.visualSettings, self.__getTextureQuality(), self.compoundIDProxy, self.__context) if camouflage is not None and decals is not None: self.__surfaceManipulator.setDecalsByIds(camouflage, decals) else: self.__surfaceManipulator = None self.__externalNodes = {} self.__shelsCount = dict() self.__isForsageOn = False self.__lastSpeedwiseEngineEffectID = -1 for partId, stateId in partsStates: self.__updatePartState(partId, stateId) modelParts = context.objDBData.partsSettings.getPartsOnlyList() for partDb in modelParts: if partDb.partId not in self.__context.partsStates: self.__updatePartState(partDb.partId, 1) self.setCondition(ObjectDataReader.stateEffect(), self.__context.fullLoading or consts.IS_EDITOR) self.setCondition(ObjectDataReader.fallingParts(), self.__context.fullLoading) objectBuilder = builder(self.__animatorsController, self.__boolCombiner, self.__eventSystem, self.__context, self.onLoaded_internal) ObjectDataReader.partsRead(objectBuilder, context) self.__copyFromCompoundID = copyFromCompoundID objectBuilder.loadResources() self.__context.rootNode = objectBuilder.rootNode self.statistic = None self.consumablesEffects = list() self.__turretGunFlamesMP = {} self.__axisEffectsAssociates = {} self.__createAxisEffectsAssociates() self.__flapsOppened = {consts.FORCE_AXIS: False, consts.FLAPS_AXIS: False} self._eManager = Event.EventManager() self.eCompoundLoaded = Event.Event(self._eManager) self.setCondition(HIDE_ALL_MODELS_CONDITION_KEY, False) return
def getMatrixProduct(matrixProviderA, matrixProviderB): result = Math.MatrixProduct() result.a = matrixProviderA result.b = matrixProviderB return result
def __init__(self): super(LaserSightMatrixProvider, self).__init__() self.__beamLength = 0.0 self.__beamMatrix = Math.MatrixProduct() self.__beamMatrix.a = Math.Matrix() self.__beamMatrix.b = Math.Matrix()