def invoke(self, context, _event): try: wm = context.window_manager log_amplitude("Blender import operator opened") return wm.invoke_props_dialog(self) except Exception as e: capture_exception() raise e
def reload_recordings_list(node_path): try: hou = get_hou() node = hou.node(node_path) HoudiniParamsBuilder.set_byplay_recording_ids(node) log_amplitude(u"Recording list reloaded") except Exception, e: capture_exception() raise e
def __init__(self, _doc): super(ByplayDialog, self).__init__() with ExceptionCatcher(): Config.setup_logger() logging.info(u"Creating ByplayDialog") log_amplitude(u"Opened ByplayDialog") self.recording_storage = RecordingLocalStorage() self.recording_ids = list(reversed(self.recording_storage.list_recording_ids())) logging.info(u"Found {} recording ids".format(self.recording_ids)) self.recording_id = None self._value = 0 self._ids_by_names = {} self._last_id = 100000 self.recording_thumbnail_image = None self.recording_manifest = None self.resolution = None
def load_recording_for_ui(node_path): # try: hou = get_hou() node = hou.node(node_path) recording_id = node.parm(u"byplay_recording_id").evalAsString() log_amplitude(u"Recording loaded", recording_id=recording_id) if len(recording_id) < 18: hou.ui.displayMessage(u"Please select a recording", severity=hou.severityType.Error) return config = { u'set_30fps': node.parm(u"byplay_set_30fps").eval(), u'add_chopnet': node.parm(u"byplay_add_chopnet").eval(), } scene.load_recording_for_ui(recording_id, refined=True, config=config) node.setParms({u"byplay_loaded_recording_id": recording_id})
def _import_recording(self, context): log_amplitude("Blender import operator executed", recording_id=self.recording_id) logging.info( "Executing, rec id: {}, ccn: {}, exr: {}".format( self.recording_id, self.create_compositing_nodes, self.use_exr ) ) loader = BlenderSceneLoader( recording_id=self.recording_id, context=context, report=self.report ) loader.load_scene(with_compositing=self.create_compositing_nodes) if self.create_compositing_nodes: loader.load_compositing() if self.use_exr: loader.load_exrs() self.report({'INFO'}, "Loaded recording {}".format(self.recording_id)) logging.info("Success loaded " + self.recording_id)
def Command(self, id, msg): with ExceptionCatcher(): if id == c4d.DLG_CANCEL: log_amplitude(u"Closed ByplayDialog") self.Close() return True if id == self.FetchId(u"refresh_recordings"): logging.info(u"Refreshing recordings") self.recording_ids = list(reversed(self.recording_storage.list_recording_ids())) self.FillRecordingIds() return True # print currently selected "child"" if id == self.FetchId(u"recording_ids"): rec_id_number = self.GetInt32(self.FetchId(u"recording_ids")) - 1 if rec_id_number < 0: return True self.recording_id = self.recording_ids[rec_id_number] logging.info(u"Changed recording id {} / {}".format(rec_id_number, self.recording_id)) log_amplitude(u"Selected recording", recording_id=self.recording_id) bitmap = load_recording_bitmap( self.recording_storage.thumbnail_path(self.recording_id), self.THUMBNAIL_SIZE ) self.resolution = get_image_size(self.recording_storage.first_frame_path(self.recording_id)) self.recording_thumbnail_image.SetImage(bitmap) data = self.recording_storage.read_manifest(self.recording_id) logging.info(u"Got manifest: {}".format(data)) fps = int(data[u'fps']) frames_count = int(data[u'framesCount']) duration = int(frames_count / fps) self.SetString( self.FetchId(u"recording_info"), u"{} fps; {} frames; {}s".format(fps, frames_count, duration) ) if id == c4d.DLG_OK: logging.info(u"Loading recording {}".format(self.recording_id)) if self.recording_id is None: c4d.gui.MessageDialog(u"Please select a recording first") return True data = self.recording_storage.read_manifest(self.recording_id) fps = int(data[u'fps']) frames_count = int(data[u'framesCount']) loader = byplay.c4d_scene_loader.ByplayC4DSceneLoader( doc=c4d.documents.GetActiveDocument(), recording_id=self.recording_id, recording_storage=self.recording_storage, frame_count=frames_count, fps=fps, resolution=self.resolution, settings={} ) loader.load() logging.info(u"Loaded ok") log_amplitude(u"Loaded recording", recording_id=self.recording_id) self.Close() return True return c4d.gui.GeDialog.Command(self, id, msg)
def setup(self): log_amplitude(u"Byplay loader node created") HoudiniParamsBuilder.add_byplay_tab_to_loader(self.node) HoudiniParamsBuilder.set_byplay_recording_ids(self.node) self.apply_config()