def generateVRScene(self, context, vrs): field = self.field('path') if (not field) or field.linked: return True with NamedTemporaryFile(delete=False, suffix='.vrscene') as temp: path = temp.name log.debug2("GENERATE SCENE {0}".format(path)) base = os.path.dirname(path) if not os.path.exists(base): os.makedirs(base) # vrs = self._outScenes[context] vrs.save(path) if not os.path.exists(path): log.error("Failed to generate scene {0}", path) return False context.set('vrscene', vrs) log.debug2("Scene DONE !") token = Token(path, source=self, index=1, size=1) field.push(context, token) return True
def preRun(self, context): log.debug2("{0} vrsceneNode.preRun ...", self.id) path = self.field('path') ret = True if not path: return False for token in path.heap(context): scene = token.value if not (scene and os.path.exists(scene)): log.error('Cannot access vrscene file {0}', scene) else: ctx = context.push(self, token) log.debug2("->" * 20, tags=['stream']) log.debug2("VRSCENE SPAWN {0}", ctx, tags=['stream']) scene = VRScene(scene) log.debug2("setting context scene") ctx.set('vrscene', scene) ret &= self.run(ctx) ret &= super(vrsceneNode, self).preRun(context) log.debug2("... {0} vrsceneNode.preRun: {1}", self.id, ret) return ret
def run(self, context): log.debug2("{0} vrsceneNode.run ...", self.id) ret = True scene = context.get('vrscene') self.parseScene(context, scene) log.debug2("{0} vrsceneNode.run: {1}", self.id, ret) return True
def run(self, context): # log.debug3("{0} vrconcatNode.run ...", self.id) ret = True scene = context.get('vrscene') if not scene: log.error("Cannot concatenate, context has no scene defined !") ret = False else: ''' if context not in self._outScenes: print "add scene to outs" self._outScenes[context] = VRScene() if context not in self._outPlugins: print "init plugins dict" self._outPlugins[context] = dict() vrs = self._outScenes[context] ''' vrs = VRScene() for field in self.getInputs(): if not field.linked: continue ''' if field.id not in self._outPlugins[context]: self._outPlugins[context][field.id] = None ''' heap = field.heap(context) if not heap: print "{0} has no heap".format(field.id) continue while heap: token = heap.pop(0) if token.isEmpty(): continue plugin = token.value msg = "add {0} {1} to vrscene ({2} {3} / {4} - {5})" msg = msg.format(plugin.getName(), plugin.getType(), field.fieldId, token.index, token.size, context.hash) log.debug2(msg, tags=['run']) vrs.add(token.value, scene.renderer) ret = self.generateVRScene(context, vrs) # log.debug3("{0} vrconcatNode.run: {1}", self.id, ret) return ret
def run(self, context): log.debug2("{0} archiveNode.run ...", self.id) ret = True scene = context.get('vrscene') archive = context.get('archive') self.pushScene(context, scene, archive) log.debug2("{0} archiveNode.run: {1}", self.id, ret) return True
def run(self, context): log.debug2("{0} vrenderUi.run ...", self.id) ret = True super(vrenderUi, self).run(context) scene = context.get("vrscene") self.renderScene(context, scene) log.debug2("{0} vrsceneUi.run: {1}", self.id, ret) return True
def preRun(self, context): log.debug2("... {0} pythonNode.preRun", self.id) code = self.field('pre_code') if code and code.value: exec(code.value) ret = super(python, self).preRun(context) log.debug2("... {0} pythonNode.preRun: {1}", self.id, ret) return ret
def preRun(self, context): log.debug2("... {0} flistNode.preRun", self.id) folder = self.field('folder') ret = True if not folder: return False for token in folder.heap(context): path = token.value if not os.path.exists(path): log.error('Cannot access path {0}', path) else: ret &= self.run(context.push(token)) ret &= super(flistNode, self).preRun(context) log.debug2("... {0} flistNode.preRun: {1}", self.id, ret) return ret
def preRun(self, context): log.debug2("{0} vrenderNode.preRun ...", self.id) path = self.field('path') ret = True if not path: return False for token in path.heap(context): scene = token.value if not (scene and os.path.exists(scene)): log.error('Cannot access vrscene file {0}', scene) else: self._scenes.append(scene) ret &= self.run(context) ret &= super(vrenderNode, self).preRun(context) log.debug2("... {0} vrenderNode.preRun: {1}", self.id, ret) return ret
def run(self, context): log.debug2("... {0} flistNode.run", self.id) pattern = self.field('pattern') pattern = pattern.value if (pattern and pattern.value) else '*' ret = True folder = context.token.value if not (folder and os.path.exists(folder)): return False log.debug2("search {0} files in folder {1}".format(pattern, folder)) match = self.field('match') match = match if (match and not match.linked) else None remain = self.field('remain') remain = remain if (remain and not remain.linked) else None folders = os.listdir(folder) num_folders = len(folders) index = 0 for path in folders: path = os.path.join(folder, path) index += 1 field = None if fnmatch.fnmatch(path, pattern): if not match: continue field = match else: field = remain token = Token(path, source=self, index=index, size=num_folders) field.push(context, token) log.debug2("... {0} flistNode.run: {1}", self.id, ret) return ret