Ejemplo n.º 1
0
    def onLoaded_internal(self, objectBuilder):
        if not self.__context.isDestroyed:
            if self.__copyFromCompoundID:
                CompoundSystem.modelCopyParms(self.compoundID, self.__copyFromCompoundID)
                self.__copyFromCompoundID = 0
            if CREATE_STATISTIC:
                self.statistic = objectBuilder.getStatistic()
            if self.__context.isPlayer:
                CompoundSystem.reflectionDrawCompound(self.compoundID)
                BigWorld.setPlayersCompoundID(self.compoundID)
            try:
                objectBuilder.loadIKs(self.compoundID)
            except Exception as e:
                debug_utils.LOG_TRACE('Error loading IK: %s' % e.message)

            self.__animatorsController.onLoaded(self.__context)
            self.__fillExternalNodes(objectBuilder.rootNode)
            self.addShadowEntity()
            if self.__surfaceManipulator:
                self.__surfaceManipulator.applySurfaces()
            self.__eventSystem.setEnable(True)
            if self.__loadingCallback is not None:
                self.__loadingCallback()
            self.__updateGroundDecals()
            CompoundSystem.compoundPrepareDraw(self.compoundID)
            debug_utils.LOG_TRACE('onLoaded_internal', self.__context.isPlayer)
            observ = False
            if self.__context.isPlayer and hasattr(BigWorld.player(), 'state'):
                observ = EntityHelpers.EntityStates.inState(BigWorld.player(), EntityHelpers.EntityStates.OBSERVER)
                observ = observ or EntityHelpers.EntityStates.inState(BigWorld.player(), EntityHelpers.EntityStates.DESTROYED)
                observ = observ or EntityHelpers.EntityStates.inState(BigWorld.player(), EntityHelpers.EntityStates.DESTROYED_FALL)
                debug_utils.LOG_TRACE('onLoaded_internal observ:', observ, BigWorld.player().state)
            if not self.__context.isPlayer and not observ:
                CompoundSystem.setCompoundAlpha(self.compoundID, 0)
                CompoundSystem.setCompoundTargetAlpha(self.compoundID, 1)
                debug_utils.LOG_TRACE('onLoaded_internal', self.__context.entityId, self.compoundID)
            for nodeId, gunId, path in objectBuilder.flamePaths:
                nodeMatrixProvider = BigWorld.CompoundNodeMP()
                nodeMatrixProvider.handle = self.compoundID
                nodeMatrixProvider.nodeIdx = nodeId
                self.__turretGunFlamesMP[gunId] = nodeMatrixProvider

            self.eCompoundLoaded()
            self.__animatorsController.showPropellorBlade(False)
        return
Ejemplo n.º 2
0
 def attachToCompound(self, cid):
     self._cid = cid
     nodeMatrixProvider = BigWorld.CompoundNodeMP()
     nodeMatrixProvider.handle = cid
     nodeMatrixProvider.nodeIdx = self.nodeId
     self.tracker.directionProvider.source = nodeMatrixProvider
     self.tracker.mParentMp = nodeMatrixProvider
     trackerNodeInfo = BigWorld.TrackerNodeInfo(
         cid, self.modelId, self.settings.nodeName, [],
         self.settings.nodeName, self.settings.pitchMin,
         self.settings.pitchMax, self.settings.yawMin, self.settings.yawMax,
         self.settings.angularVelocity, self.settings.angularThreshold,
         self.settings.angularHalflife)
     trackerNodeInfo.idleFrequencyScalerX = self.settings.idleFrequencyScalerX
     trackerNodeInfo.idleAmplitudeScalerX = self.settings.idleAmplitudeScalerX
     trackerNodeInfo.idleFrequencyScalerY = self.settings.idleFrequencyScalerY
     trackerNodeInfo.idleAmplitudeScalerY = self.settings.idleAmplitudeScalerY
     trackerNodeInfo.enableIdleAnimation = self.settings.enableIdleAnimation
     self.tracker.nodeInfo = trackerNodeInfo
Ejemplo n.º 3
0
    def attachToCompound(self, cid):
        self.compoundMatrix = BigWorld.CompoundNodeMP()
        self.compoundMatrix.handle = cid
        self.compoundMatrix.nodeIdx = self.nodeId
        self.tracker.mParentMp = self.compoundMatrix
        self.tracker.directionProvider.source = self.compoundMatrix
        try:
            sector = convGlobalToRelativeRotation(self.visualSettings.yawMax,
                                                  self.visualSettings.yawMin,
                                                  self.visualSettings.pitchMax,
                                                  self.visualSettings.pitchMin)
            trackerNodeInfo = BigWorld.TurretNodeAnimator(
                cid, self.visualSettings.pitchNodeName,
                self.visualSettings.yawNodeName,
                self.visualSettings.directionNodeName,
                self.visualSettings.shootingNodeName, sector[1],
                sector[0], sector[2], sector[3],
                int(self.visualSettings.axisDirections.x),
                int(self.visualSettings.axisDirections.y),
                self.visualSettings.angularVelocity,
                self.visualSettings.angularThreshold,
                self.visualSettings.angularHalflife)
        except Exception as e:
            LOG_DEBUG('Failed to create TurretNodeAnimator!', e)
            return

        trackerNodeInfo.idleFrequencyScalerX = self.visualSettings.idleFrequencyScalerX
        trackerNodeInfo.idleAmplitudeScalerX = self.visualSettings.idleAmplitudeScalerX
        trackerNodeInfo.idleFrequencyScalerY = self.visualSettings.idleFrequencyScalerY
        trackerNodeInfo.idleAmplitudeScalerY = self.visualSettings.idleAmplitudeScalerY
        trackerNodeInfo.shootCooldownTime = self.visualSettings.shootCooldownTime
        trackerNodeInfo.enableIdleAnimation = self.visualSettings.enableIdleAnimation
        gunProfile = db.DBLogic.g_instance.getGunData(
            self.settings.gunName) if not IS_EDITOR else None
        if self.visualSettings.useGunProfile and gunProfile is not None:
            trackerNodeInfo.shootTime = 2.0 / (gunProfile.RPM / 60.0)
        else:
            trackerNodeInfo.shootTime = self.visualSettings.shootTime
        trackerNodeInfo.setShotRecoilCurve(
            list(self.visualSettings.recoilCurve.p))
        self.tracker.nodeInfo = trackerNodeInfo
        return