def edReloadSkyBoxes(self): self.tempCopy = self.skyBoxModels self.skyBoxModels = [] for sb in self.skyBoxes: try: model = BigWorld.Model(sb) except ValueError: model = BigWorld.Model('') self.skyBoxModels.append(model) BigWorld.addSkyBox(model, self.fader)
def assemblePyModels(models, position, vehicleDesc): chassis = BigWorld.Model(models[0]) hull = BigWorld.Model(models[1]) turret = BigWorld.Model(models[2]) gun = BigWorld.Model(models[3]) chassis.node('V').attach(hull) hull.node('HP_turretJoint').attach(turret) turret.node('HP_gunJoint').attach(gun) BigWorld.addModel(chassis) chassis.position = position return chassis
def create_model(self): if self._model: self.delete_model() if self._model_blank: self.delete_blank_model() if self.indicatorModel: self._model = BigWorld.Model(self._model_tex) self._model.visible = False elif self.indicatorEdge and not self.indicatorModel: self._model_blank = BigWorld.Model(self._model_blank_text) self._model_blank.visible = False
def __init__(self, vehicleEffect, cameraEffect, centerPosition): self.__vehicleTM = Math.WGTranslationOnlyMP() self.__vehicleDirMatrix = BigWorld.DiffDirProvider(self.__vehicleTM, mathUtils.createTranslationMatrix(centerPosition)) self.__cameraTM = Math.WGTranslationOnlyMP() self.__cameraDirMatrix = BigWorld.DiffDirProvider(self.__cameraTM, mathUtils.createTranslationMatrix(centerPosition)) self.__vehicleFakeModel = BigWorld.Model('') self.__vehicleFakeModel.addMotor(BigWorld.Servo(self.__vehicleDirMatrix)) self.__cameraFakeModel = BigWorld.Model('') self.__cameraFakeModel.addMotor(BigWorld.Servo(self.__cameraDirMatrix)) self.__vehicleEffects = vehicleEffect self.__vehicleEffectsPlayer = None self.__cameraEffects = cameraEffect self.__cameraEffectsPlayer = None return
def _loadSkyBoxes(self, callback = None, immediate = False): if self.loaded: if callback: callback() elif not immediate: BigWorld.loadResourceListBG(self.skyBoxes, partial(self._onLoadSkyBoxes, callback)) else: resourceRefs = {} for i in self.skyBoxes: try: resourceRefs[i] = BigWorld.Model(i) except ValueError: resourceRefs[i] = BigWorld.Model('') self._onLoadSkyBoxes(callback, resourceRefs)
def __init__(self): self.__model = BigWorld.Model('helpers/models/unit_cube.model') self.__motor = BigWorld.Servo(Math.Matrix()) self.__model.addMotor(self.__motor) self.__model.castsShadow = False self.__thickness = 0.1 BigWorld.addModel(self.__model, BigWorld.player().spaceID)
def _createTerrainSelectedArea(self, position, size, overTerrainHeight, color, terrainSelected=True): if self.__radiusModelName is None: return elif g_ctfManager.isNeedHideAll: return else: self.__fakeModel = BigWorld.Model('objects/fake_model.model') self.__fakeModel.position = position BigWorld.addModel(self.__fakeModel, BigWorld.player().spaceID) self.__fakeModel.addMotor( BigWorld.Servo(Math.Matrix(self.__fakeModel.matrix))) rootNode = self.__fakeModel.node('') self.__terrainSelectedArea = BigWorld.PyTerrainSelectedArea() self.__terrainSelectedArea.setup(self.__radiusModelName, Vector2(size, size), overTerrainHeight, color, terrainSelected) rootNode.attach(self.__terrainSelectedArea) self.__hideListener = _GlobalHideListener(self.__hideCheckPoint) return
def _attachDebugModels(self): for pathPoint in self._moveNavPath: m = BigWorld.Model(Navigation.DEBUG_MODEL_NAME) m.scale = (1, 1, 1) self._player.addModel(m) m.position = pathPoint self._debugNavPathModels.append(m)
def __init__(self, start, end): self.model = BigWorld.Model('helpers/models/unit_cube.model') self.motor = BigWorld.Servo(Math.Matrix()) self.model.addMotor(self.motor) self.__thickness = 0.1 self.set(start, end) BigWorld.addModel(self.model)
def __initHangar(self): from gui.Scaleform.utils.HangarSpace import g_hangarSpace if self.__delayedInitCB: BigWorld.cancelCallback(self.__delayedInitCB) self.__delayedInitCB = None self.__clear() if g_hangarSpace and g_hangarSpace.space: self.__model = BigWorld.Model(MODEL_NAME) if self.__model: self.__model.scale = (0.6, 0.6, 0.6) self.__model.actionScale = 0.5 BigWorld.addModel(self.__model, g_hangarSpace.space.spaceID) positionHpMap = syncHpMap(HP_NAME) LOG_DEBUG('found HPs', positionHpMap) for k, hp in positionHpMap.iteritems(): self.__model.position = Math.Matrix(hp).translation break self.__model.visible = True action = self.__model.action(ANIMATION_NAME) action() self.__effect = EffectManager.g_instance.createNodeAttachedEffect( Effects.getEffectId(PARTICLE_NAME), self.__model.node(ATTACH_HP), {}) self.__soPlane = SoundObject('hangar_1st_of_April_plane', 0, 0) self.__soPlane.transform = self.__model.node(ATTACH_HP) self.__soPlane.postEvent(PLAY_SOUND_NAME, False, None) LOG_DEBUG('effect', PARTICLE_NAME, self.__effect) self.__hangarLoaded = True else: LOG_ERROR("can't load 1 april model", MODEL_NAME) else: self.__delayedInitCB = BigWorld.callback(HANGAR_INIT_DELAY, self.__initHangar) return
def __init__(self, data, position): super(_StaticObjectMarker3D, self).__init__() path = data.get('path') offset = data.get('offset', Math.Vector3(0, 0, 0)) self.__model = None if path is not None: try: self.__model = BigWorld.Model(path) self.__model.position = Math.Vector3(position[:]) + offset self.__model.castsShadow = False except ValueError: LOG_CURRENT_EXCEPTION() LOG_ERROR('Model not found', path) return except AttributeError: LOG_CURRENT_EXCEPTION() return BigWorld.addModel(self.__model) action = data.get('action') if action is not None and len(action): try: self.__model.action(action)() except ValueError: LOG_ERROR('Action not found', path, action) return
def add(self, shotID, effectsDescr, gravity, refStartPoint, refVelocity, startPoint, maxDistance, attackerID = 0, tracerCameraPos = Math.Vector3(0, 0, 0)): import BattleReplay if BattleReplay.g_replayCtrl.isTimeWarpInProgress: return else: if startPoint.distTo(refStartPoint) > ProjectileMover.__START_POINT_MAX_DIFF: startPoint = refStartPoint artID = effectsDescr.get('artilleryID') if artID is not None: self.salvo.addProjectile(artID, gravity, refStartPoint, refVelocity) return projectileMotor = self.__ballistics.addProjectile(shotID, gravity, refStartPoint, refVelocity, startPoint, maxDistance, attackerID, ownVehicleGunPositionGetter(), tracerCameraPos) if projectileMotor is None: return projModelName, projModelOwnShotName, projEffects = effectsDescr['projectile'] isOwnShoot = attackerID == BigWorld.player().playerVehicleID model = BigWorld.Model(projModelOwnShotName if isOwnShoot else projModelName) proj = {'model': model, 'motor': projectileMotor, 'effectsDescr': effectsDescr, 'showExplosion': False, 'fireMissedTrigger': isOwnShoot, 'autoScaleProjectile': isOwnShoot, 'attackerID': attackerID, 'effectsData': {}} if not gEffectsDisabled(): BigWorld.player().addModel(model) model.addMotor(projectileMotor) model.visible = False model.visibleAttachments = True projEffects.attachTo(proj['model'], proj['effectsData'], 'flying', isPlayerVehicle=isOwnShoot, isArtillery=False) self.__projectiles[shotID] = proj FlockManager.getManager().onProjectile(startPoint) return
def edReloadSkyBoxes(self): """ This method resets all sky boxes used by this weather system, and makes sure the skybox models list properly reflects the contents of the skyboxes list. """ self.tempCopy = self.skyBoxModels self.skyBoxModels = [] for sb in self.skyBoxes: try: model = BigWorld.Model(sb) except ValueError: model = BigWorld.Model('') self.skyBoxModels.append(model) BigWorld.addSkyBox(model, self.fader)
def onHangarLoaded(self): from gui.Scaleform.utils.HangarSpace import g_hangarSpace from gui.HangarScripts.PlaneBirthday import ConfigFactory if self.__isEnabled or not g_hangarSpace.space: return config = ConfigFactory.get(g_hangarSpace.space.spaceName) self.__model = BigWorld.Model(config.MODEL_NAME) if self.__model: EffectManager.Init() self.__model.scale = config.SCALE self.__model.actionScale = 4.0 self.__model.visible = False BigWorld.addModel(self.__model, BigWorld.player().spaceID) self.__model.position = g_hangarSpace.space.getHangarPos( ) + config.TRANSLATION_VECTOR self.__model.visible = True action = self.__model.action(config.ANIMATION_NAME) action() LOG_DEBUG('onHangarLoaded hp', [(hp, self.__model.node(hp)) for i, hp in enumerate(config.PARTICLE_HPS)]) self.__effects = [ EffectManager.g_instance.createNodeAttachedEffect( Effects.getEffectId(config.PARTICLE_NAMES[i]), self.__model.node(hp), {}) for i, hp in enumerate(config.PARTICLE_HPS) ] else: LOG_ERROR("can't load model", config.MODEL_NAME) self.__isEnabled = True
def __init__(self): try: self.__model = BigWorld.Model( '../mods/shared_resources/xvm/res/markers/Arrow/arrow.model') except: self.__model = None self.__motor = None
def __init__(self, spaceID, modelName='helpers/models/position_gizmo.model'): self.model = BigWorld.Model(modelName) BigWorld.addModel(self.model, spaceID) self.motor = BigWorld.Servo(Math.Matrix()) self.model.addMotor(self.motor)
def __init__(self, soundName, parent): fakeModelName = Settings.g_instance.scriptConfig.readString( Settings.KEY_FAKE_MODEL) self.soundModel = BigWorld.Model(fakeModelName) self.soundModel.addMotor(BigWorld.Servo(parent.root)) BigWorld.addModel(self.soundModel) self.sound = self.soundModel.playSound(soundName) self.parent = parent
def addLine(self, position, color, width, height): if self.__fakeModel is None: self.__fakeModel = BigWorld.Model('') rootNode = self.__fakeModel.node('') self.__pixelQuad = BigWorld.PyStrictPixelQuad() self.__pixelQuad.setup(width, height, color, position) rootNode.attach(self.__pixelQuad) return
def setupTank(chassisFashion, gunFashion, vehicleDesc, worldMatrix, resources): print resources tank = resources[vehicleDesc.name] tank.matrix = worldMatrix tanks.append(tank) effect = Pixie.create('particles/Tank/exhaust/large_gas_gear.xml') tank.node('HP_gunFire').attach(effect) tank.node('HP_gunFire').attach( BigWorld.Model('helpers/models/position_gizmo.model')) tank.node('HP_Track_Exhaus_1').attach( BigWorld.Model('helpers/models/unit_cube.model')) m = mathUtils.createTranslationMatrix(Vector3(0, 10, 5)) fakeMatrixes.append(m) tank.node('gun').attach(effect.clone(), m) BigWorld.addModel(tank) recoilDescr = vehicleDesc.gun['recoil'] recoil = BigWorld.RecoilAnimator(recoilDescr['backoffTime'], recoilDescr['returnTime'], recoilDescr['amplitude'], recoilDescr['lodDist']) recoil.basisMatrix = tank.node('G').localMatrix recoil = assemblerModule.createGunAnimator(vehicleDesc, tank.node('G').localMatrix) recoil.lodSetting = 10 tank.node('G', recoil) gunFashion.gunLocalMatrix = recoil recoil.lodLink = DataLinks.createFloatLink(chassisFashion, 'lastLod') swingingAnimator = assemblerModule.createSwingingAnimator( vehicleDesc, tank.node('hull').localMatrix, worldMatrix) chassisFashion.setupSwinging(swingingAnimator, 'hull') swingingAnimator.lodLink = DataLinks.createFloatLink( chassisFashion, 'lastLod') tank.setupFashions([chassisFashion, None, None, gunFashion]) fashions.append(swingingAnimator) tank.node('hull', swingingAnimator) animMatrix = Math.MatrixAnimation() keys = [] for x in xrange(100): angle = math.pi * 0.5 * (1 if x & 1 else -1) keys.append((x * 3, mathUtils.createRotationMatrix((angle, 0, 0)))) animMatrix.keyframes = tuple(keys) tank.node('turret', animMatrix) return
def onEnterWorld(self, prereqs): g_replayEvents.onTimeWarpStart += self.__cancelCallback sectorComponent = BigWorld.player().arena.componentSystem.sectorComponent if sectorComponent is not None: sectorComponent.addSector(self) self.model = model = BigWorld.Model('') model.addMotor(BigWorld.Servo(self.matrix)) model.visible = True return
def __getModel(self, modelName): if self.reuseModels[modelName]: model, motor = self.reuseModels[modelName].pop() else: model = BigWorld.Model(modelName) motor = BigWorld.Servo(Matrix()) model.addMotor(motor) BigWorld.addModel(model, self.spaceID) return (model, motor)
def __init__(self): BigWorld.UserDataObject.__init__(self) BigWorld.addSoundZoneTrigger(self.position, Math.Vector3(self.direction.z, self.direction.y, self.direction.x), Math.Vector3(self.Size.x, self.Size.y, self.Size.z), self.ZoneEnter, self.ZoneExit, self.Reverb, self.ReverbLevel, self.VolumeDeviation) if VISUALISE_ZONE: self.model = BigWorld.Model('objects/misc/bbox/unit_cube_1m_proxy.model') BigWorld.player().addModel(self.model) motor = BigWorld.Servo(Math.Matrix()) self.model.addMotor(motor) motor.signal = mathUtils.createSRTMatrix(Math.Vector3(self.Size.x, self.Size.y, self.Size.z), Math.Vector3(self.direction.z, self.direction.y, self.direction.x), self.position)
def __init__(self): self.dummy = BigWorld.Model('') self.turnTrigger = self.angleGizmo(red=False) self.turnCancel = self.angleGizmo(red=True) self.strafeTrigger = self.angleGizmo2(red=False) self.speedTrigger = self.rulerGizmo(red=False) self.speedCancel = self.rulerGizmo(red=True) self.guiAttachment = GUI.Attachment() self.actionText = GUI.Text('') self.guiAttachment.component = self.actionText
def _createTerrainSelectedArea(self, position, size, overTerrainHeight, color): if self.__radiusModelName is None: return self.__fakeModel = BigWorld.Model('objects/fake_model.model') self.__fakeModel.position = position BigWorld.addModel(self.__fakeModel, BigWorld.player().spaceID) rootNode = self.__fakeModel.node('') self.__terrainSelectedArea = BigWorld.PyTerrainSelectedArea() self.__terrainSelectedArea.setup(self.__radiusModelName, Vector2(size, size), overTerrainHeight, color) rootNode.attach(self.__terrainSelectedArea)
def _onLoadSkyBoxes(self, callback, resourceRef): self.loaded = True for sb in self.skyBoxes: try: self.skyBoxModels.append(resourceRef[sb]) except ValueError: self.skyBoxModels.append(BigWorld.Model('')) if callback != None: callback()
def create(self): m = Math.Matrix() m.setRotateYPR(Math.Vector3(self.yaw, 0, 0)) m.translation = self.pos self.motor = BigWorld.Servo(m) self.model = BigWorld.Model(self.modelPath) self.model.addMotor(self.motor) BigWorld.addModel(self.model) self.model.visible = True return self.model
def add(self, shotID, effectsDescr, gravity, refStartPoint, refVelocity, startPoint, isOwnShoot=False, tracerCameraPos=Math.Vector3(0, 0, 0)): import BattleReplay if BattleReplay.g_replayCtrl.isTimeWarpInProgress: return elif shotID in self.__projectiles: return else: proj = dict() projModelName, projModelOwnShotName, projEffects = effectsDescr[ 'projectile'] proj['model'] = BigWorld.Model( projModelOwnShotName if isOwnShoot else projModelName) proj['startTime'] = BigWorld.time() proj['effectsDescr'] = effectsDescr proj['refStartPoint'] = refStartPoint proj['refVelocity'] = refVelocity proj['startPoint'] = startPoint proj['stopPlane'] = None proj['gravity'] = Math.Vector3(0.0, -gravity, 0.0) proj['showExpolosion'] = False proj['impactVelDir'] = None proj['deathTime'] = None proj['fireMissedTrigger'] = isOwnShoot proj['autoScaleProjectile'] = isOwnShoot trajectory = self.__calcTrajectory(refStartPoint, refVelocity, proj['gravity'], isOwnShoot, tracerCameraPos) trajectoryEnd = trajectory[len(trajectory) - 1] if (trajectoryEnd[0] - startPoint).length == 0.0 or trajectoryEnd[1] == 0.0: LOG_CODEPOINT_WARNING() return proj['collisions'] = trajectory proj['velocity'] = self.__calcStartVelocity( trajectoryEnd[0], startPoint, trajectoryEnd[1], proj['gravity']) BigWorld.player().addModel(proj['model']) proj['model'].position = startPoint proj['model'].visible = False proj['model'].visibleAttachments = True proj['effectsData'] = {} projEffects.attachTo(proj['model'], proj['effectsData'], 'flying') if self.__movementCallbackId is None: self.__movementCallbackId = BigWorld.callback( 0.001, self.__movementCallback) self.__projectiles[shotID] = proj return
def destroyFireball(owner, fireball, fx, explosionFXName, targetHitCallback, prereqs): m = Matrix(fireball.motors[0].target) fx.detach() owner.delModel(fireball) explosion = BigWorld.Model('') owner.addModel(explosion) explosion.position = m.applyToOrigin() fireballfx = FX.bufferedOneShotEffect(explosionFXName, explosion, explosion, lambda : owner.delModel(explosion), 10.0, prereqs) if targetHitCallback != None: targetHitCallback(owner, m) return
def testSSO(entity = None): if entity == None: entity = BigWorld.player() m = BigWorld.Model('art/characters/foe/guard/guard.model') BigWorld.player().model = m BigWorld.player().model.motors[0].matchNotifier = partial(onMatchAction, entity) addEntityTransformViz(BigWorld.player()) addModelTransformViz() addWorldVelocityViz() addMatchedActionLabel() return
def update_sphere(position): global sphere if sphere is None: sphere = BigWorld.Model('objects/misc/bbox/sphere1.model') elif sphere in BigWorld.models(): BigWorld.delModel(sphere) if (_explosionRadius is not None) and isAlive and isDownHotkey: sphere.position = position sphere.scale = Vector3(_explosionRadius, _explosionRadius, _explosionRadius) BigWorld.addModel(sphere)