def draw_transpose_operator(instrument, steps: int, text: str, row: bpy.types.UILayout): col = row.column(align=True) transpose_operator = col.operator(TransposeInstrument.bl_idname, text=text) transpose_operator.transpose_steps = steps col.enabled = MidiInstrumentPanel.can_transpose(instrument, steps)
def wrapped_label(context: bpy.types.Context, layout: bpy.types.UILayout, text: str): lines = wrap_text_in_region(context, text) col = layout.column(align=True) col.scale_y = .7 # bring text lines a little closer together for line in lines: col.label(text=line)
def draw_numpy_ui(context: bpy.types.Context, layout: bpy.types.UILayout): numpy_is_installed = moduleutil.is_installed('numpy') col = layout.column(align=True) if numpy_is_installed: col.label(text='NumPy is already installed', icon='INFO') else: col.label(text='NumPy is not installed', icon='ERROR') row = col.row() row.enabled = not numpy_is_installed op = row.operator(operators.SCRIPT_OT_install_module.bl_idname, text='Install NumPy') op.name = 'numpy'
def draw_connection_settings_ui(layout: bpy.types.UILayout): mixer_prefs = get_mixer_prefs() col = layout.column() col.separator(factor=0.5) grid = col.column_flow(columns=2) row = grid.row() sub_row = row.row() sub_row.scale_x = 0.4 sub_row.label(text="Host:") row.prop(mixer_prefs, "host", text="") row = grid.row() row.prop(mixer_prefs, "port") col.separator(factor=0.5)
def draw_scipy_ui(context: bpy.types.Context, layout: bpy.types.UILayout): numpy_is_installed = moduleutil.is_installed('numpy') scipy_is_installed = moduleutil.is_installed('scipy') col = layout.column(align=True) if scipy_is_installed: col.label(text='SciPy is already installed', icon='INFO') else: col.label(text='SciPy is not installed', icon='ERROR') row = col.row() row.enabled = numpy_is_installed and not scipy_is_installed op = row.operator(operators.SCRIPT_OT_install_module.bl_idname, text='Install SciPy') op.name = 'scipy' op.options = '--no-deps'
def draw_check_result(layout: bpy.types.UILayout, result: CheckResult): row = layout.column().split(factor=0.1, align=True) row.alignment = 'RIGHT' row.label(text=f'{result.impact:+.2f}%') if result.indent > 0: row = row.split(factor=result.indent * 0.01, align=True) row.label(text='') row = row.split(factor=0.15, align=True) row.label(text=result.status.value, text_ctxt='Status', icon=result.icon) row = row.split(factor=0.75, align=True) if result.editable: data, property_name = self.resolve_data_path(context, result.data_path) row.prop(data, property_name, text=result.name) else: row.label(text='{}: {}'.format(iface_(result.name), result.data_path)) row.label(text=result.message)
def draw_user_settings_ui(layout: bpy.types.UILayout): mixer_prefs = get_mixer_prefs() col = layout.column() col.separator(factor=0.5) grid = col.column_flow(columns=2) row = grid.row() sub_row = row.row() sub_row.scale_x = 0.4 sub_row.label(text="User:"******"user", text="") row = grid.row() row.prop(mixer_prefs, "color", text="") icon = icons.icons_col["General_Explorer_32"] user_data_path = os.environ.get("MIXER_DATA_DIR", get_data_directory()) # from pathlib import Path # user_data_path = Path(user_data_path).parent row.operator("mixer.open_explorer", text="", icon_value=icon.icon_id).path = str(user_data_path) col.separator(factor=1.0)
def draw_mat_props(layout: bpy.types.UILayout, mat: bpy.types.Material): col = layout.column(align=True) col.prop(mat, 'arm_celshade_shade_color') col.prop(mat, 'arm_celshade_shade_softness')