本文整理汇总了Python中Pixie类的典型用法代码示例。如果您正苦于以下问题:Python Pixie类的具体用法?Python Pixie怎么用?Python Pixie使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pixie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __createTrailParticlesIfNeeded
def __createTrailParticlesIfNeeded(self, node, iTrack, effectGroup, effectIndex, drawOrder, isActiveNode):
if effectIndex is None:
return
else:
effectDesc = self.__vehicle.typeDescriptor.chassis['effects'].get(effectGroup)
if effectDesc is None:
return
effectName = effectDesc[0].get(effectIndex)
if effectName is None or effectName == 'none' or effectName == 'None':
return
if isinstance(effectName, list):
effectIdx = iTrack
effectIdx += 0 if isActiveNode else 2
effectName = effectName[effectIdx]
nodeEffects = self.__trailParticles.get(node)
if nodeEffects is None:
nodeEffects = []
self.__trailParticles[node] = nodeEffects
else:
for nodeEffect in nodeEffects:
createdForActiveNode = nodeEffect[5]
if nodeEffect[1] == effectIndex and createdForActiveNode == isActiveNode:
return
elemDesc = [drawOrder,
node,
effectName,
effectIndex,
isActiveNode,
nodeEffects]
Pixie.createBG(effectName, partial(self._callbackTrailParticleLoaded, elemDesc))
return
示例2: create
def create(self, model, list, args):
elem = {}
elem['newPos'] = args.get('position', None)
nodePos = self._pos
if elem['newPos'] is not None:
nodePos = string.split(elem['newPos'][0], '/') if elem['newPos'][0] else []
scale = args.get('scale')
if scale is not None:
elem['scale'] = scale
elem['surfaceNormal'] = args.get('surfaceNormal', None)
surfaceMatKind = args.get('surfaceMatKind', None)
if surfaceMatKind is not None and self._surfaceMatKinds is not None:
if surfaceMatKind not in self._surfaceMatKinds:
return
elem['node'] = _findTargetNode(model, nodePos, elem['newPos'][1] if elem['newPos'] else None, self._orientByClosestSurfaceNormal, elem['surfaceNormal'])
elem['model'] = model
elem['typeDesc'] = self
elem['pixie'] = None
elem['cancelLoadCallback'] = False
elem['callbackID'] = None
if self._havokFiles is None:
file = random.choice(self._files)
else:
file, fileToClear = random.choice(zip(self._files, self._havokFiles))
if args.get('havokEnabled', False):
file, fileToClear = fileToClear, file
self.__prototypePixies.pop(fileToClear, None)
prototypePixie = self.__prototypePixies.get(file)
if prototypePixie is not None:
elem['pixie'] = prototypePixie.clone()
self._callbackCreate(elem)
else:
elem['file'] = file
Pixie.createBG(file, partial(self._callbackAfterLoading, elem))
list.append(elem)
示例3: create
def create(self, model, list, args):
elem = {}
elem['newPos'] = args.get('position', None)
nodePos = self._pos
if elem['newPos'] is not None:
nodePos = string.split(elem['newPos'][0], '/') if elem['newPos'][0] else []
scale = args.get('scale')
if scale is not None:
elem['scale'] = scale
elem['surfaceNormal'] = args.get('surfaceNormal', None)
surfaceMatKind = args.get('surfaceMatKind', None)
if surfaceMatKind is not None and self._surfaceMatKinds is not None:
if surfaceMatKind not in self._surfaceMatKinds:
return
elem['node'] = _findTargetNode(model, nodePos, elem['newPos'][1] if elem['newPos'] else None, self._orientByClosestSurfaceNormal, elem['surfaceNormal'])
elem['model'] = model
elem['typeDesc'] = self
elem['pixie'] = None
elem['cancelLoadCallback'] = False
elem['callbackID'] = None
if self._alwaysUpdate:
BigWorld.addAlwaysUpdateModel(model)
file = random.choice(self._files)
prototypePixie = self.__prototypePixies.get(file)
if prototypePixie is not None:
elem['pixie'] = prototypePixie.clone()
elem['callbackID'] = BigWorld.callback(0.001, partial(self._callbackCreate, elem))
else:
elem['file'] = file
Pixie.createBG(file, partial(self._callbackAfterLoading, elem))
list.append(elem)
return
示例4: __init__
def __init__(self, name, onLoadCallback, pixie = None):
if pixie is None:
self.__loader = stricted_loading.restrictBySpace(self.__onLoad)
self.__callback = onLoadCallback
else:
self.__loader = None
self.__callback = None
self.name = name
self.pixie = pixie
Pixie.createBG(name, self.__loader)
return
示例5: beginPlasmaWarp
def beginPlasmaWarp(target):
global warpEffects
allFinished = 1
for finished, i, s, t in warpEffects:
if not finished:
allFinished = 0
if allFinished:
warpEffects = []
ps = Pixie.create('particles/plasma_suck.xml')
try:
target.node('biped Head').attach(ps)
except:
target.root.attach(ps)
m = target.root
m2 = Matrix()
m2.setScale((1, 1, 1))
m2.postMultiply(m)
v1 = Vector4(3.0, -100000, 0, 0)
v2 = Vector4(0.0, 0, 0, 0)
v = Vector4Animation()
v.keyframes = [(0, v2), (3, v1)]
v.duration = 1000000
v.time = 0
warpEffects.append([0,
v,
ps,
target])
try:
BigWorld.addWarp(100000, m2, v)
except:
pass
return len(warpEffects) - 1
示例6: getPixie
def getPixie(name, onLoadCallback):
pixieInfo = PixieCache.pixieCache.get(name, (None, set()))
if pixieInfo[0] is None:
cbksSize = len(pixieInfo[1])
pixieInfo[1].add(onLoadCallback)
if cbksSize == 0:
Pixie.createBG(name, partial(PixieCache.onPixieLoaded, name))
PixieCache.pixieCache[name] = pixieInfo
return
else:
if len(pixieInfo) == 1:
newPixie = pixieInfo[0].clone()
else:
newPixie = pixieInfo.pop()
return newPixie
return
示例7: __update
def __update(self):
self.__cbID = None
visibility = self.__motor.warplaneAlpha
if self.__sound is not None and self.__sound.isPlaying:
self.__sound.volume = visibility
if visibility == 1.0 and not self.__fadedIn:
self.__fadedIn = True
ds = self.__curve.getChannelProperty(0, 'effectName')
effectName = ds.asString if ds is not None else ''
if effectName != '':
Pixie.createBG(effectName, self.__onParticlesLoaded)
elif visibility <= 0.1 and self.__fadedIn:
self.stop()
return
self.__cbID = BigWorld.callback(0, self.__update)
return
示例8: __init__
def __init__(self, exhaustEffectsDescriptor, drawOrder, uniqueEffects = None):
if uniqueEffects is None:
self.__uniqueEffects = {}
else:
self.__uniqueEffects = {name:effect.clone() for name, effect in uniqueEffects.iteritems()}
self.__tables = []
self.__maxDrawOrder = drawOrder - 1
for rangeTable in exhaustEffectsDescriptor.tables:
effectsValues = []
for name in rangeTable.values:
effect = self.__uniqueEffects.get(name)
if effect is None:
effect = Pixie.create(name)
self.__maxDrawOrder += 1
effect.drawOrder = self.__maxDrawOrder
self.__uniqueEffects[name] = effect
effectsValues.append(effect)
self.__tables.append(RangeTable(rangeTable.keys, effectsValues))
if self.__maxDrawOrder < drawOrder:
self.__maxDrawOrder = drawOrder
self.__activeEffect = None
for effect in self.__uniqueEffects.itervalues():
enablePixie(effect, False)
示例9: __update
def __update(self):
self.__cbID = None
visibility = self.__motor.warplaneAlpha
if visibility == 1.0 and not self.__fadedIn:
self.__fadedIn = True
ds = self.__curve.getChannelProperty(0, 'effectName')
effectName = ds.asString if ds is not None else ''
if effectName != '':
Pixie.createBG(effectName, partial(self.__onParticlesLoaded, effectName))
elif visibility <= 0.1 and self.__fadedIn or Timer.getTime() > self.__endTime:
self.pause()
return
if self.__sound is not None:
if self.__sound.isPlaying:
self.__sound.volume = visibility
else:
self.__playSound()
self.__cbID = BigWorld.callback(0.25, self.__update)
示例10: __init__
def __init__(self, exhaustEffectsDescriptor, drawOrder, uniqueEffects=None):
if uniqueEffects is None:
self.__uniqueEffects = {}
else:
self.__uniqueEffects = {name: effect.clone() for name, effect in uniqueEffects.iteritems()}
self.__tables = []
self.__maxDrawOrder = drawOrder - 1
self.__node = None
for rangeTable in exhaustEffectsDescriptor.tables:
effectsValues = []
for name in rangeTable.values:
effect = self.__uniqueEffects.get(name)
if effect is None:
elemDesc = [name, effectsValues]
Pixie.createBG(name, partial(self._callbackExhaustPixieLoaded, elemDesc))
else:
effectsValues.append(effect)
self.__tables.append(RangeTable(rangeTable.keys, effectsValues))
if self.__maxDrawOrder < drawOrder:
self.__maxDrawOrder = drawOrder
self.__activeEffect = None
示例11: __createTrailParticlesIfNeeded
def __createTrailParticlesIfNeeded(self, node, iTrack, effectGroup, effectIndex, drawOrder, isActiveNode):
if effectIndex is None:
return
else:
effectDesc = self.__vehicle.typeDescriptor.chassis['effects'].get(effectGroup)
if effectDesc is None:
return
effectName = effectDesc[0].get(effectIndex)
if effectName is None or effectName == 'none' or effectName == 'None':
return
if isinstance(effectName, list):
effectIdx = iTrack
effectIdx += 0 if isActiveNode else 2
effectName = effectName[effectIdx]
nodeEffects = self.__trailParticles.get(node)
if nodeEffects is None:
nodeEffects = []
self.__trailParticles[node] = nodeEffects
else:
for nodeEffect in nodeEffects:
createdForActiveNode = nodeEffect[5]
if nodeEffect[1] == effectIndex and createdForActiveNode == isActiveNode:
return
pixie = Pixie.create(effectName)
pixie.drawOrder = drawOrder
node.attach(pixie)
basicRates = []
for i in xrange(pixie.nSystems()):
try:
source = pixie.system(i).action(1)
basicRates.append(source.rate)
source.rate = source.rate * 0.001
except:
basicRates.append(-1.0)
source = pixie.system(i).action(16)
source.MultRate(0.01)
nodeEffects.append([pixie,
effectIndex,
0,
0,
basicRates,
isActiveNode])
return
示例12: __init__
def __init__(self, vehicleTypeDescriptor):
self.__enabled = True
self.__exhaust = []
exhaust = vehicleTypeDescriptor.hull['exhaust']
engineTags = vehicleTypeDescriptor.engine['tags']
pixieName = None
for tag in engineTags:
pixieName = exhaust.get('pixie/' + tag, pixieName)
rates = exhaust['rates']
for i in xrange(len(exhaust['nodes'])):
pixie = Pixie.create(pixieName)
pixie.drawOrder = 50 + i
self.__exhaust.append([None, pixie])
for i in xrange(pixie.nSystems()):
source = pixie.system(i).action(1)
source.rate = rates[0]
return
示例13: load
def load(self, pSection, prereqs = None):
"""
This method loads the ParticleSystem Actor from a data section. The
the particle system resource ID is read from the section name.
It is recommended to call this method with prerequisites passed in, as
even if the textures referred to by the particle system are already in
memory, a PyMetaParticleSystem can still take a significant time to
construct.
"""
try:
actor = prereqs.pop(pSection.asString)
except:
try:
actor = Pixie.create(pSection.asString)
except:
ERROR_MSG('Could not create particle system', pSection.asString)
actor = None
return actor
示例14: setupTank
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
示例15: onEnterWorld
def onEnterWorld( self, prereqs ):
Avatar.onEnterWorld( self, prereqs )
# Set the position/movement filter to correspond to an player avatar
self.filter = BigWorld.PlayerAvatarFilter()
# Setup the physics for the Avatar
self.physics = BigWorld.STANDARD_PHYSICS
self.physics.velocityMouse = "Direction"
self.physics.oldStyleCollision = True
self.physics.collide = True
self.physics.collideTerrain = True
self.physics.collideObjects = True
self.physics.fall = True
# Spawn
self.spawnAtRandomLocation()
# Dust particles
self.dustTrail = Pixie.create ("particles/dust_trail.xml")
self.attachDustTrail()