def _run_gui(req, pgroup_id, cam_id, lens_id): """ Run when the user presses the 'ok' button in the window. :param req: The 3DEqualizer window requester id. :type req: str :param pgroup_id: The Point Group ID with the active camera in it. :type pgroup_id: str :param cam_id: The Camera ID to apply data to. :type cam_id: str :param lens_id: The Lens ID to apply data to. :type lens_id: str """ # Query all widgets. options = dict() names_and_widgets = [ ('file_path', FILE_BROWSER_WIDGET), ('plate_load', PLATE_LOAD_WIDGET), ('plate_path', PLATE_PATH_WIDGET), ('set_cam_name', CAMERA_NAME_WIDGET), ('start_frame', START_FRAME_WIDGET), ('end_frame', END_FRAME_WIDGET), ('fl', ATTR_FOCAL_LENGTH_WIDGET), ('fbk_size', ATTR_FBK_SIZE_WIDGET), ('fbk_offset', ATTR_FBK_OFFSET_WIDGET), ('par', PIXEL_ASPECT_WIDGET), ('translate', ATTR_TRANSLATE_WIDGET), ('rotate', ATTR_ROTATE_WIDGET), ] for name, widget in names_and_widgets: if tde4.widgetExists(req, widget): options[name] = tde4.getWidgetValue(req, widget) file_path = options.get('file_path') is_valid_file_path = _file_path_is_valid(file_path) if is_valid_file_path is False: print 'Error: File path is not valid.' return file_data = _parse_data(file_path) has_valid_data = _file_data_has_valid_data(file_data) if has_valid_data is False: print 'Error: File data is not valid.' return # Pass widget values to run function. file_data = _parse_data(file_path) mmcamera_format.apply_to_camera( pgroup_id, cam_id, lens_id, options, file_data, ) return
def _remove_all_dynamic_widgets(req, widget, action): """ Remove all dynamically generated widgets. A clean up function to prepare for all the widgets being created again. """ for widget_name in BUILD_WIDGET_LIST: exists = tde4.widgetExists(req, widget_name) if not exists: continue tde4.removeWidget(req, widget_name) return
def exportNOID(): # print 'Start exportNOID' req = buildUI() ret = tde4.postCustomRequester(req, "Export NOID - (Maya & Nuke)", 0, 0, "Export", "Cancel") if ret == 1: # Canceled by the user # get the parameters selecteds params = {} params['file_browser'] = tde4.getWidgetValue(req, "file_browser") #params['nukeVersion'] = tde4.getWidgetValue(req, "nukeVersion") #params['openNuke'] = tde4.getWidgetValue(req, "openNuke") params['cameras'] = [] params['camerasOutSize'] = [] params['camerasFirstFrame'] = list() date = strftime("%y%m%d%H%M%S", gmtime()) # YYMMDDhhmmss params['date'] = date for cameraIndex in range(tde4.getNoCameras()): cameraObj = tde4.getIndexCamera(cameraIndex) # cameraName = str(tde4.getCameraName(cameraObj)) # NO USED exprtCamWidgetName = "exportCamera" + str(cameraIndex) exprtCamWidgetExists = tde4.widgetExists(req, exprtCamWidgetName) exprtCamWidgetValue = tde4.getWidgetValue(req, exprtCamWidgetName) if exprtCamWidgetExists and exprtCamWidgetValue: camResWidgetName = camWidgetPrefix + str(cameraIndex) log.debug('camResWidgetName : ' + str(camResWidgetName)) camResWidgetValue = tde4.getWidgetValue(req, camResWidgetName) log.debug('camResWidgetValue: ' + str(camResWidgetValue)) imageWidth, imageHeight, firstFrame = camResWidgetValue.split( resSpliter) imageResolution = tools.Resolution(width=imageWidth, height=imageHeight) params['cameras'].append(cameraObj) params['camerasOutSize'].append(imageResolution) params['camerasFirstFrame'].append(firstFrame) log.debug('imageResolution : ' + str(imageResolution)) if params['cameras'] == []: message = 'Aborting, Nothing selected to Export' log.debug(message) return # debug params for paramName in params: paramValue = params[paramName] log.debug('param : ' + str(paramName)) log.debug('value : ' + str(paramValue)) # Export to Maya mayaExporter.toMaya(params) # Export to Nuke nukeFilesPath = nukeExporter.toNuke(params) # open Nuke or not # if params['openNuke']: # for nukeFilePath in nukeFilesPath: # nukeExePath = findNukeExe(int(params['nukeVersion'])) # toExecute = [nukeExePath, '-q', nukeFilePath] # # log.debug(toExecute) # # useSubProcess = True # if useSubProcess: # subprocess.Popen(toExecute, executable=nukeExePath) # else: # os.system(toExecute) tde4.postQuestionRequester('Export finished', 'All the cameras selected were exported', 'OK') else: message = 'Canceled by user' log.debug(message) message = 'End exportCGEV' log.debug(message)