def draw(self, context): from io_scs_tools.ui.shared import draw_export_panel box0 = self.layout.box() box0.use_property_split = True box0.use_property_decorate = False box0.label(text="Export Options:", icon='SETTINGS') box0.prop(_get_scs_globals(), 'export_scope', expand=True) draw_export_panel(box0, ignore_extra_boxes=True)
def _draw_export_panel(scene, layout, scs_globals): """Draw Export panel.""" layout_column = layout.column(align=True) layout_box = layout_column.box() # header if scene.scs_props.export_panel_expand: box_row = layout_box.row() box_row.prop(scene.scs_props, 'export_panel_expand', text="Export Panel:", icon='TRIA_DOWN', icon_only=True, emboss=False) box_row.label('') layout_box = layout_column.box() # body if not scs_globals.preview_export_selection_active: col = layout_box.column(align=True) col.row(align=True).prop(scs_globals, 'export_scope', expand=True) col_row = col.row(align=True) col_row.enabled = scs_globals.export_scope == "selection" icon = "FILE_TICK" if scs_globals.preview_export_selection else "X_VEC" col_row.prop(scs_globals, 'preview_export_selection', text="Preview Selection", icon=icon, toggle=True) col_row = col.row(align=True) col_row.scale_y = 2 col_row.operator('scene.export_scs_content_by_scope', text="EXPORT") else: row = layout_box.box() row.prop(scs_globals, "preview_export_selection_active", text="Export preview mode is active!", icon='ERROR', icon_only=True, emboss=False) row = row.column(align=True) row.label("Press ENTER to export selection!") row.label("Press ESC to cancel export!") box_row = layout_box.row() box = box_row.box() col = box.column() # Default Export Path (FILE_PATH - relative) col_row = col.row() col_row.label("Default Export Path:", icon="FILE_FOLDER") col_row = col.row(align=True) default_export_path = scene.scs_props.default_export_filepath col_row.alert = ((default_export_path != "" and not default_export_path.startswith("//")) or not os.path.isdir( os.path.join(scs_globals.scs_project_path, default_export_path.strip("//")))) if col_row.alert: _shared.draw_warning_operator( col_row, "Default Export Path Warning", str("Current Default Export Path is unreachable, which may result into an error on export!\n" "Make sure you did following:\n" "1. Properly set \"SCS Project Base Path\"\n" "2. Properly set \"Default Export Path\" which must be relative on \"SCS Project Base Path\"" )) col_row.prop(scene.scs_props, 'default_export_filepath', text='', icon='EXPORT') props = col_row.operator('scene.select_directory_inside_base', text='', icon='FILESEL') props.type = "DefaultExportPath" _shared.draw_export_panel(layout_box) else: box_row = layout_box.row() box_row.prop(scene.scs_props, 'export_panel_expand', text="Export Panel:", icon='TRIA_RIGHT', icon_only=True, emboss=False) box_row.label('')
def _draw_export_panel(scene, layout, scs_globals): """Draw Export panel.""" layout_column = layout.column(align=True) layout_box = layout_column.box() # header if scene.scs_props.export_panel_expand: box_row = layout_box.row() box_row.prop(scene.scs_props, 'export_panel_expand', text="Export Panel:", icon='TRIA_DOWN', icon_only=True, emboss=False) box_row.label('') layout_box = layout_column.box() # body if not scs_globals.preview_export_selection_active: col = layout_box.column(align=True) col.row(align=True).prop(scs_globals, 'export_scope', expand=True) col_row = col.row(align=True) col_row.enabled = scs_globals.export_scope == "selection" icon = "FILE_TICK" if scs_globals.preview_export_selection else "X_VEC" col_row.prop(scs_globals, 'preview_export_selection', text="Preview Selection", icon=icon, toggle=True) col_row = col.row(align=True) col_row.scale_y = 2 col_row.operator('scene.export_scs_content_by_scope', text="EXPORT") else: row = layout_box.box() row.prop(scs_globals, "preview_export_selection_active", text="Export preview mode is active!", icon='ERROR', icon_only=True, emboss=False) row = row.column(align=True) row.label("Press ENTER to export selection!") row.label("Press ESC to cancel export!") box_row = layout_box.row() box = box_row.box() col = box.column() # Default Export Path (FILE_PATH - relative) col_row = col.row() col_row.label("Default Export Path:", icon="FILE_FOLDER") col_row = col.row(align=True) default_export_path = scene.scs_props.default_export_filepath col_row.alert = ((default_export_path != "" and not default_export_path.startswith("//")) or not os.path.isdir(os.path.join(scs_globals.scs_project_path, default_export_path.strip("//")))) if col_row.alert: _shared.draw_warning_operator( col_row, "Default Export Path Warning", str("Current Default Export Path is unreachable, which may result into an error on export!\n" "Make sure you did following:\n" "1. Properly set \"SCS Project Base Path\"\n" "2. Properly set \"Default Export Path\" which must be relative on \"SCS Project Base Path\"") ) col_row.prop(scene.scs_props, 'default_export_filepath', text='', icon='EXPORT') props = col_row.operator('scene.select_directory_inside_base', text='', icon='FILESEL') props.type = "DefaultExportPath" _shared.draw_export_panel(layout_box) else: box_row = layout_box.row() box_row.prop(scene.scs_props, 'export_panel_expand', text="Export Panel:", icon='TRIA_RIGHT', icon_only=True, emboss=False) box_row.label('')
def draw(self, context): layout = self.layout scene = context.scene scs_globals = _get_scs_globals() # scs tools main panel if config is being updated layout.enabled = not scs_globals.config_update_lock if not scs_globals.preview_export_selection_active: col = layout.column(align=True) row = col.row(align=True) row.scale_y = 1.2 if scs_globals.export_scope == "selection": icon = _shared.get_on_off_icon( scs_globals.preview_export_selection) row.prop(scs_globals, 'preview_export_selection', text="", icon=icon, toggle=False) row.prop(scs_globals, 'export_scope', expand=True) col_row = col.row(align=True) col_row.scale_y = 2 col_row.operator('scene.scs_tools_export_by_scope', text="EXPORT") else: row = layout.box() row.prop(scs_globals, "preview_export_selection_active", text="Export preview mode is active!", icon='ERROR', icon_only=True, emboss=False) row = row.column(align=True) row.label(text="Rotate view:") row.label(text="* Left Mouse Button + move") row.label(text="* Numpad 2, 4, 6, 8") row.label(text="Zoom in/out:") row.label(text="* Mouse Scroll") row.label(text="* Numpad '+', '-'") row.separator() row.label(text="Press ENTER to export selection!") row.label(text="Press ESC to cancel export!") col = layout.column() # Fallback Export Path (FILE_PATH - relative) col_row = _shared.create_row(col, use_split=True, enabled=True) default_export_path = scene.scs_props.default_export_filepath col_row.alert = ((default_export_path != "" and not default_export_path.startswith("//")) or not os.path.isdir( os.path.join(scs_globals.scs_project_path, default_export_path.strip("//")))) col_row.prop(scene.scs_props, 'default_export_filepath', icon='EXPORT') if col_row.alert: _shared.draw_warning_operator( col_row, "Default Export Path Warning", str("Current Default Export Path is unreachable, which may result into an error on export!\n" "Make sure you did following:\n" "1. Properly set \"SCS Project Base Path\"\n" "2. Properly set \"Default Export Path\" which must be relative on \"SCS Project Base Path\"" )) props = col_row.operator('scene.scs_tools_select_dir_inside_base', text="", icon='FILEBROWSER') props.type = "DefaultExportPath" _shared.draw_export_panel(layout, ignore_extra_boxes=True)