def prerequisites(self, typeDescriptor, vID, health, isCrewActive, isTurretDetached, outfitCD, renderMode=None): self.damageState.update(health, isCrewActive, False) self.__typeDesc = typeDescriptor self.__vID = vID self._isTurretDetached = isTurretDetached self.__updateModelStatus() self.__outfit = self._prepareOutfit(outfitCD) if self.damageState.isCurrentModelUndamaged: self.__attachments = camouflages.getAttachments(self.outfit, self.typeDescriptor) self.__renderMode = renderMode prereqs = self.typeDescriptor.prerequisites(True) prereqs.extend(camouflages.getCamoPrereqs(self.outfit, self.typeDescriptor)) prereqs.extend(camouflages.getModelAnimatorsPrereqs(self.outfit, self.spaceID)) prereqs.extend(camouflages.getAttachmentsAnimatorsPrereqs(self.__attachments, self.spaceID)) splineDesc = self.typeDescriptor.chassis.splineDesc modelsSet = self.outfit.modelsSet if splineDesc is not None: for _, trackDesc in splineDesc.trackPairs.iteritems(): prereqs += trackDesc.prerequisites(modelsSet) modelsSetParams = self.modelsSetParams compoundAssembler = model_assembler.prepareCompoundAssembler(self.typeDescriptor, modelsSetParams, self.spaceID, self.isTurretDetached, renderMode=self.renderMode) prereqs.append(compoundAssembler) if renderMode == TankRenderMode.OVERLAY_COLLISION: self.damageState.update(0, isCrewActive, False) collisionAssembler = model_assembler.prepareCollisionAssembler(self.typeDescriptor, self.isTurretDetached, self.spaceID) prereqs.append(collisionAssembler) physicalTracksBuilders = self.typeDescriptor.chassis.physicalTracks for name, builders in physicalTracksBuilders.iteritems(): for index, builder in enumerate(builders): prereqs.append(builder.createLoader(self.spaceID, '{0}{1}PhysicalTrack'.format(name, index), modelsSetParams.skin)) return prereqs
def __startBuild(self, vDesc, vState): self.__curBuildInd += 1 self.__vState = vState self.__resources = {} self.__vehicleStickers = None cfg = hangarCFG() if vState == 'undamaged': self.__currentEmblemsAlpha = cfg['emblems_alpha_undamaged'] self.__isVehicleDestroyed = False else: self.__currentEmblemsAlpha = cfg['emblems_alpha_damaged'] self.__isVehicleDestroyed = True self.__vDesc = vDesc resources = camouflages.getCamoPrereqs(self.__outfit, vDesc) splineDesc = vDesc.chassis.splineDesc if splineDesc is not None: resources.append(splineDesc.segmentModelLeft) resources.append(splineDesc.segmentModelRight) if splineDesc.leftDesc is not None: resources.append(splineDesc.leftDesc) if splineDesc.rightDesc is not None: resources.append(splineDesc.rightDesc) if splineDesc.segment2ModelLeft is not None: resources.append(splineDesc.segment2ModelLeft) if splineDesc.segment2ModelRight is not None: resources.append(splineDesc.segment2ModelRight) from vehicle_systems import model_assembler resources.append(model_assembler.prepareCompoundAssembler(self.__vDesc, ModelsSetParams(self.__outfit.modelsSet, self.__vState), self.__spaceId)) g_eventBus.handleEvent(CameraRelatedEvents(CameraRelatedEvents.VEHICLE_LOADING, ctx={'started': True, 'vEntityId': self.__vEntity.id}), scope=EVENT_BUS_SCOPE.DEFAULT) cfg = hangarCFG() gunScale = Math.Vector3(1.0, 1.0, 1.1) capsuleScale = Math.Vector3(1.5, 1.5, 1.5) loadedGunScale = cfg.get('cam_capsule_gun_scale', gunScale) if loadedGunScale is not None: gunScale = loadedGunScale loadedCapsuleScale = cfg.get('cam_capsule_scale', capsuleScale) if loadedCapsuleScale is not None: capsuleScale = loadedCapsuleScale bspModels = ((TankPartNames.getIdx(TankPartNames.CHASSIS), vDesc.chassis.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.HULL), vDesc.hull.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.TURRET), vDesc.turret.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.GUN), vDesc.gun.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.GUN) + 1, vDesc.hull.hitTester.bspModelName, capsuleScale), (TankPartNames.getIdx(TankPartNames.GUN) + 2, vDesc.turret.hitTester.bspModelName, capsuleScale), (TankPartNames.getIdx(TankPartNames.GUN) + 3, vDesc.gun.hitTester.bspModelName, gunScale)) collisionAssembler = BigWorld.CollisionAssembler(bspModels, self.__spaceId) resources.append(collisionAssembler) physicalTracksBuilders = vDesc.chassis.physicalTracks for name, builder in physicalTracksBuilders.iteritems(): resources.append(builder.createLoader('{0}PhysicalTrack'.format(name))) BigWorld.loadResourceListBG(tuple(resources), makeCallbackWeak(self.__onResourcesLoaded, self.__curBuildInd)) return
def prerequisites(self, typeDescriptor, vID, health, isCrewActive, isTurretDetached, outfitCD): self.__currentDamageState.update(health, isCrewActive, False) outfit = Outfit(outfitCD) out = camouflages.getCamoPrereqs(outfit, typeDescriptor) splineDesc = typeDescriptor.chassis.splineDesc if splineDesc is not None: out.append(splineDesc.segmentModelLeft) out.append(splineDesc.segmentModelRight) if splineDesc.segment2ModelLeft is not None: out.append(splineDesc.segment2ModelLeft) if splineDesc.segment2ModelRight is not None: out.append(splineDesc.segment2ModelRight) self.__vID = vID self.__typeDesc = typeDescriptor self.__isTurretDetached = isTurretDetached return out
def prerequisites(self, typeDescriptor, vID, health, isCrewActive, isTurretDetached, outfitCD): self.__currentDamageState.update(health, isCrewActive, False) self.__vID = vID self.__typeDesc = typeDescriptor self.__isTurretDetached = isTurretDetached self.__prepareOutfit(outfitCD) out = camouflages.getCamoPrereqs(self.__outfit, self.__typeDesc) splineDesc = typeDescriptor.chassis.splineDesc if splineDesc is not None: out.append(splineDesc.segmentModelLeft) out.append(splineDesc.segmentModelRight) if splineDesc.segment2ModelLeft is not None: out.append(splineDesc.segment2ModelLeft) if splineDesc.segment2ModelRight is not None: out.append(splineDesc.segment2ModelRight) self.__terrainMatKindLodDistance = typeDescriptor.chassis.traces.lodDist return out
def prerequisites(self, typeDescriptor, vID, health, isCrewActive, isTurretDetached, outfitCD, renderState=None): self.damageState.update(health, isCrewActive, False) self.__typeDesc = typeDescriptor self.__vID = vID self._isTurretDetached = isTurretDetached self.__outfit = self._prepareOutfit(outfitCD) if self.damageState.isCurrentModelUndamaged: self.__attachments = camouflages.getAttachments(self.outfit, self.typeDescriptor) self.__renderState = renderState prereqs = self.typeDescriptor.prerequisites(True) prereqs.extend(camouflages.getCamoPrereqs(self.outfit, self.typeDescriptor)) prereqs.extend(camouflages.getModelAnimatorsPrereqs(self.outfit, self.worldID)) prereqs.extend(camouflages.getAttachmentsAnimatorsPrereqs(self.__attachments, self.worldID)) splineDesc = self.typeDescriptor.chassis.splineDesc if splineDesc is not None: modelsSet = self.outfit.modelsSet prereqs.append(splineDesc.segmentModelLeft(modelsSet)) prereqs.append(splineDesc.segmentModelRight(modelsSet)) segment2ModelLeft = splineDesc.segment2ModelLeft(modelsSet) if segment2ModelLeft is not None: prereqs.append(segment2ModelLeft) segment2ModelRight = splineDesc.segment2ModelRight(modelsSet) if segment2ModelRight is not None: prereqs.append(segment2ModelRight) modelsSetParams = self.modelsSetParams compoundAssembler = model_assembler.prepareCompoundAssembler(self.typeDescriptor, modelsSetParams, self.worldID, self.isTurretDetached, renderState=self.renderState) prereqs.append(compoundAssembler) if renderState == RenderStates.OVERLAY_COLLISION: self.damageState.update(0, isCrewActive, False) if not isTurretDetached: bspModels = ((TankPartNames.getIdx(TankPartNames.CHASSIS), typeDescriptor.chassis.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.HULL), typeDescriptor.hull.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.TURRET), typeDescriptor.turret.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.GUN), typeDescriptor.gun.hitTester.bspModelName)) else: bspModels = ((TankPartNames.getIdx(TankPartNames.CHASSIS), typeDescriptor.chassis.hitTester.bspModelName), (TankPartNames.getIdx(TankPartNames.HULL), typeDescriptor.hull.hitTester.bspModelName)) collisionAssembler = BigWorld.CollisionAssembler(bspModels, self.worldID) prereqs.append(collisionAssembler) physicalTracksBuilders = self.typeDescriptor.chassis.physicalTracks for name, builders in physicalTracksBuilders.iteritems(): for index, builder in enumerate(builders): prereqs.append(builder.createLoader(self.worldID, '{0}{1}PhysicalTrack'.format(name, index), modelsSetParams.skin)) return prereqs
def __startBuild(self, vDesc, vState): self.__curBuildInd += 1 self.__vState = vState self.__resources = {} self.__vehicleStickers = None cfg = hangarCFG() if vState == 'undamaged': self.__currentEmblemsAlpha = cfg['emblems_alpha_undamaged'] self.__isVehicleDestroyed = False else: self.__currentEmblemsAlpha = cfg['emblems_alpha_damaged'] self.__isVehicleDestroyed = True self.__vDesc = vDesc resources = camouflages.getCamoPrereqs(self.__outfit, vDesc) if not self.__isVehicleDestroyed: self.__attachments = camouflages.getAttachments(self.__outfit, vDesc) modelsSet = self.__outfit.modelsSet splineDesc = vDesc.chassis.splineDesc if splineDesc is not None: for _, trackDesc in splineDesc.trackPairs.iteritems(): resources += trackDesc.prerequisites(modelsSet) from vehicle_systems import model_assembler resources.append(model_assembler.prepareCompoundAssembler(self.__vDesc, ModelsSetParams(modelsSet, self.__vState, self.__attachments), self.__spaceId)) g_eventBus.handleEvent(CameraRelatedEvents(CameraRelatedEvents.VEHICLE_LOADING, ctx={'started': True, 'vEntityId': self.__vEntity.id, 'intCD': self.__vDesc.type.compactDescr}), scope=EVENT_BUS_SCOPE.DEFAULT) cfg = hangarCFG() gunScale = Math.Vector3(1.0, 1.0, 1.1) capsuleScale = Math.Vector3(1.5, 1.5, 1.5) loadedGunScale = cfg.get('cam_capsule_gun_scale', gunScale) if loadedGunScale is not None: gunScale = loadedGunScale loadedCapsuleScale = cfg.get('cam_capsule_scale', capsuleScale) if loadedCapsuleScale is not None: capsuleScale = loadedCapsuleScale hitTesterManagers = {TankPartNames.CHASSIS: vDesc.chassis.hitTesterManager, TankPartNames.HULL: vDesc.hull.hitTesterManager, TankPartNames.TURRET: vDesc.turret.hitTesterManager, TankPartNames.GUN: vDesc.gun.hitTesterManager} bspModels = () crashedBspModels = () for partName, htManager in hitTesterManagers.iteritems(): partId = TankPartNames.getIdx(partName) bspModel = (partId, htManager.modelHitTester.bspModelName) bspModels = bspModels + (bspModel,) if htManager.crashedModelHitTester: crashedBspModel = (partId, htManager.crashedModelHitTester.bspModelName) crashedBspModels = crashedBspModels + (crashedBspModel,) bspModels = bspModels + ((TankPartNames.getIdx(TankPartNames.GUN) + 1, vDesc.hull.hitTesterManager.modelHitTester.bspModelName, capsuleScale), (TankPartNames.getIdx(TankPartNames.GUN) + 2, vDesc.turret.hitTesterManager.modelHitTester.bspModelName, capsuleScale), (TankPartNames.getIdx(TankPartNames.GUN) + 3, vDesc.gun.hitTesterManager.modelHitTester.bspModelName, gunScale)) if vDesc.hull.hitTesterManager.crashedModelHitTester: crashedBspModels = crashedBspModels + ((TankPartNames.getIdx(TankPartNames.GUN) + 1, vDesc.hull.hitTesterManager.crashedModelHitTester.bspModelName, capsuleScale),) if vDesc.turret.hitTesterManager.crashedModelHitTester: crashedBspModels = crashedBspModels + ((TankPartNames.getIdx(TankPartNames.GUN) + 2, vDesc.turret.hitTesterManager.crashedModelHitTester.bspModelName, capsuleScale),) if vDesc.gun.hitTesterManager.crashedModelHitTester: crashedBspModels = crashedBspModels + ((TankPartNames.getIdx(TankPartNames.GUN) + 3, vDesc.gun.hitTesterManager.crashedModelHitTester.bspModelName, gunScale),) modelCA = BigWorld.CollisionAssembler(bspModels, self.__spaceId) modelCA.name = 'ModelCollisions' resources.append(modelCA) if crashedBspModels: crashedModelCA = BigWorld.CollisionAssembler(crashedBspModels, self.__spaceId) crashedModelCA.name = 'CrashedModelCollisions' resources.append(crashedModelCA) physicalTracksBuilders = vDesc.chassis.physicalTracks for name, builders in physicalTracksBuilders.iteritems(): for index, builder in enumerate(builders): resources.append(builder.createLoader(self.__spaceId, '{0}{1}PhysicalTrack'.format(name, index), modelsSet)) BigWorld.loadResourceListBG(tuple(resources), makeCallbackWeak(self.__onResourcesLoaded, self.__curBuildInd)) return