def RenderApparel(outPath, sourceRes, size = 128): from PIL import Image remotefilecache.prefetch_single_file(sourceRes) src = blue.paths.ResolvePath(sourceRes) im = Image.open(src) if im.size > (size, size): im = im.resize((size, size), Image.ANTIALIAS) im.save(outPath)
def RenderApparel(outPath, sourceRes, size=128): from PIL import Image remotefilecache.prefetch_single_file(sourceRes) src = blue.paths.ResolvePath(sourceRes) im = Image.open(src) if im.size > (size, size): im = im.resize((size, size), Image.ANTIALIAS) im.save(outPath)
def RenderApparel(outPath, sourceRes, size=128): """ "Renders" apparel by just copying the sourceRes image to the outPath and downsizing if needed. Eventually this will be a proper rendering, but this is as good as we can do for now. """ from PIL import Image remotefilecache.prefetch_single_file(sourceRes) src = blue.paths.ResolvePath(sourceRes) im = Image.open(src) if im.size > (size, size): im = im.resize((size, size), Image.ANTIALIAS) im.save(outPath)
def __init__(self, data, cache, *args, **kwargs): monitor = kwargs.get('monitor', True) try: import blue if blue.pyos.packaged: monitor = False data = None if boot.role == 'client': import remotefilecache cache = remotefilecache.prefetch_single_file('res:/staticdata/' + cache, verify=True) else: cache = os.path.join(blue.paths.ResolvePath(u'res:/staticdata'), cache) elif os.path.exists(blue.paths.ResolvePath(u'root:/staticData')): data = os.path.join(blue.paths.ResolvePath(u'root:/staticData'), data) cache = os.path.join(blue.paths.ResolvePath(u'root:/autobuild/staticData/server'), cache) elif os.path.exists(blue.paths.ResolvePath(u'res:/staticdata')): data = None cache = os.path.join(blue.paths.ResolvePath(u'res:/staticdata'), cache) else: raise ImportError except ImportError: data = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../eve/staticData/', data)) cache = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../eve/autobuild/staticData/server', cache)) if not os.path.exists(data): data = None if not os.path.exists(os.path.dirname(cache)): cache = None kwargs['monitor'] = monitor Storage.__init__(self, data, cache, *args, **kwargs)
def _GetMaxPartSize(et): if not et.mesh.geometry.isGood: raise MeshLoadError(et.mesh.geometryResPath) geoSize = et.mesh.geometry.GetBoundingBox(0) gs = geo2.Vec3Distance(geoSize[0], geoSize[1]) for em in et.Find('trinity.Tr2DynamicEmitter'): for each in em.generators: if each.name == 'sizeDynamic' or each.name == 'size': return max(each.minRange + each.maxRange) * gs for em in et.Find('trinity.Tr2StaticEmitter'): for ps in em.Find('trinity.Tr2ParticleSystem'): for each in ps.elements: if each.name == 'size': remotefilecache.prefetch_single_file(em.geometryResourcePath) return grannyutils.GetMaxPartSize(blue.paths.ResolvePath(em.geometryResourcePath), each.usageIndex, em.meshIndex) * gs logger.warning('No Particle Emitters found for %s' % et.name)
def _GetMaxPartSize(et): if not et.mesh.geometry.isGood: raise MeshLoadError(et.mesh.geometryResPath) geoSize = et.mesh.geometry.GetBoundingBox(0) gs = geo2.Vec3Distance(geoSize[0], geoSize[1]) for em in et.Find('trinity.Tr2DynamicEmitter'): for each in em.generators: if each.name == 'sizeDynamic' or each.name == 'size': return max(each.minRange + each.maxRange) * gs for em in et.Find('trinity.Tr2StaticEmitter'): for ps in em.Find('trinity.Tr2ParticleSystem'): for each in ps.elements: if each.name == 'size': remotefilecache.prefetch_single_file( em.geometryResourcePath) return grannyutils.GetMaxPartSize( blue.paths.ResolvePath(em.geometryResourcePath), each.usageIndex, em.meshIndex) * gs logger.warning('No Particle Emitters found for %s' % et.name)
def __init__(self, data, cache, *args, **kwargs): monitor = kwargs.get('monitor', True) try: import blue if blue.pyos.packaged: monitor = False data = None if boot.role == 'client': import remotefilecache cache = remotefilecache.prefetch_single_file( 'res:/staticdata/' + cache, verify=True) else: cache = os.path.join( blue.paths.ResolvePath(u'res:/staticdata'), cache) elif os.path.exists(blue.paths.ResolvePath(u'root:/staticData')): data = os.path.join( blue.paths.ResolvePath(u'root:/staticData'), data) cache = os.path.join( blue.paths.ResolvePath( u'root:/autobuild/staticData/server'), cache) elif os.path.exists(blue.paths.ResolvePath(u'res:/staticdata')): data = None cache = os.path.join( blue.paths.ResolvePath(u'res:/staticdata'), cache) else: raise ImportError except ImportError: if data is not None: data = os.path.abspath( os.path.join(os.path.dirname(__file__), '../../eve/staticData/', data)) if not os.path.exists(data): data = None if cache is not None: cache = os.path.abspath( os.path.join(os.path.dirname(__file__), '../../eve/autobuild/staticData/server', cache)) if not os.path.exists(os.path.dirname(cache)): cache = None kwargs['monitor'] = monitor Storage.__init__(self, data, cache, *args, **kwargs)
def taskletfunc(): remotefilecache.prefetch_single_file(videoPath) tex.resPath = videoPath tex.Play() self._isFetchingFile = False