class EffectPreviewer(AssetPreviewer): def createWidget(self, container): self.canvas = MOCKEditCanvas(container) self.canvas.loadScript(_getModulePath('EffectPreview.lua')) return self.canvas def accept(self, assetNode): return assetNode.getType() in ['effect'] def onStart(self, assetNode): atype = assetNode.getType() self.canvas.makeCurrentCanvas() self.canvas.safeCallMethod('preview', 'showEffect', assetNode.getPath()) self.canvas.startUpdateTimer(60) def onPause(self, paused): if paused: self.canvas.stopUpdateTimer() else: self.canvas.startUpdateTimer(60) def onStop(self): self.canvas.stopUpdateTimer() self.canvas.safeCallMethod('preview', 'clearEffect')
class ProtoPreviewer( AssetPreviewer ): def createWidget(self, container): self.canvas = MOCKEditCanvas( container ) self.canvas.loadScript( _getModulePath('ProtoPreviewer.lua') ) return self.canvas def accept(self, assetNode): return assetNode.getType() in [ 'proto', 'prefab', ] def onStart(self, assetNode): self.canvas.safeCallMethod( 'preview', 'setTaretProto', assetNode.getPath() ) def onStop(self): self.canvas.safeCallMethod( 'preview', 'setTaretProto', None )
class ParticlePreviewer(AssetPreviewer): def createWidget(self, container): self.canvas = MOCKEditCanvas(container) self.canvas.loadScript( _getModulePath('ParticlePreview.lua') ) return self.canvas def accept(self, assetNode): return assetNode.getType() in [ 'particle_system', 'particle_pex', 'particle_simple' ] def onStart(self, assetNode): atype = assetNode.getType() self.canvas.makeCurrentCanvas() self.canvas.safeCallMethod( 'preview', 'showParticle', assetNode.getPath() ) self.canvas.startUpdateTimer( 60 ) def onStop(self): self.canvas.stopUpdateTimer() self.canvas.safeCallMethod( 'preview', 'clearParticle' )
class Deck2DPreviewer(AssetPreviewer): def createWidget(self, container): self.canvas = MOCKEditCanvas(container) self.canvas.loadScript(_getModulePath('Deck2DPreview.lua')) return self.canvas def accept(self, assetNode): return assetNode.getType() in [ 'deck2d.quad', 'deck2d.stretchpatch', 'deck2d.quad_array', 'deck2d.tileset', 'deck2d.polygon', 'deck2d.mquad', 'deck2d.quads', ] def onStart(self, assetNode): self.canvas.safeCallMethod('preview', 'show', assetNode.getPath()) def onStop(self): self.canvas.safeCallMethod('preview', 'show', None)