コード例 #1
0
def draw_stat_label(layout: bpy.types.UILayout, label: str, value: str):
    """Add a label-value pair to Blender's UI, aligned as a split property"""

    split = layout.split(factor=0.4, align=True)
    split.alignment = 'RIGHT'
    split.label(text=label)
    split.alignment = 'LEFT'
    split.label(text=value)
コード例 #2
0
ファイル: bl_panels.py プロジェクト: UPBGE/blender-addons
def draw_user_settings_ui(layout: bpy.types.UILayout):
    mixer_prefs = get_mixer_prefs()

    split = layout.split(factor=0.258, align=False)
    split.label(text="User:"******"user", text="")
    sub_row = row.row()
    sub_row.scale_x = 0.4
    sub_row.prop(mixer_prefs, "color", text="")
コード例 #3
0
def draw_frame_prop(layout: bpy.types.UILayout, prop_label: str,
                    prop_value: int):
    """Add a property to Blender's UI, showing timestamp and number of frames"""

    split = layout.split(factor=0.4, align=True)
    split.alignment = 'RIGHT'
    split.label(text=prop_label)
    split = split.split(factor=0.75, align=True)
    split.label(text=timestamp_str(prop_value))
    split.alignment = 'RIGHT'
    split.label(text=f"{prop_value} ")
コード例 #4
0
ファイル: arm_sockets.py プロジェクト: anderlli0053/armory
def draw_socket_layout_split(socket: bpy.types.NodeSocket,
                             layout: bpy.types.UILayout,
                             prop_name='default_value_raw'):
    if not socket.is_output and not socket.is_linked:
        # Blender layouts use 0.4 splits
        layout = layout.split(factor=0.4, align=True)

    layout.label(text=socket.name)

    if not socket.is_output and not socket.is_linked:
        layout.prop(socket, prop_name, text='')
コード例 #5
0
 def draw_item(self, context: bpy.types.Context, layout: bpy.types.UILayout,
               data: 'AddonPreferences', item: CustomPipelineProperty,
               icon: int, active_data: 'AddonPreferences',
               active_propname: str) -> None:
     """Defines the layout of a {sfm_flow.prefs.CustomPipelineProperty} list item."""
     if self.layout_type in {'DEFAULT', 'COMPACT'}:
         split = layout.split(factor=0.3)
         split.label(text=item.name)
         split.label(text=item.command)
     elif self.layout_type in {'GRID'}:
         raise NotImplementedError(
             "`GRID` mode is not supported custom pipeline list items.")
コード例 #6
0
    def draw_item(unused_self, context: bpy.types.Context,
                  layout: bpy.types.UILayout, data: bpy.types.WindowManager,
                  render: TresorioRendersDetailsProps, icon: int,
                  active_data: bpy.types.WindowManager, active_propname: str,
                  index: int) -> None:
        """Draw one element in the ui list"""
        del unused_self, context, data, active_data, active_propname

        split = layout.split(factor=0.05)
        # STATUS_ICON
        if render.status == RenderStatus.FINISHED:
            split.label(text='', icon='KEYTYPE_JITTER_VEC')
        elif render.status == RenderStatus.RUNNING:
            split.label(text='', icon='KEYTYPE_BREAKDOWN_VEC')
        elif render.status == RenderStatus.STOPPING or render.status == RenderStatus.STOPPED:
            split.label(text='', icon_value=til.icon('TRESORIO_STOPPING'))
        elif render.status == RenderStatus.STARTING:
            split.label(text='', icon_value=til.icon('TRESORIO_LAUNCHING'))
        elif render.status == RenderStatus.ERROR:
            split.label(text='', icon='KEYTYPE_KEYFRAME_VEC')
        icon = 'RENDER_ANIMATION' if render.type == 'ANIMATION' else 'RESTRICT_RENDER_OFF'
        split.label(text=render.name, icon=icon)

        # INFO_CASE
        row = split.row(align=True)
        row.alignment = 'RIGHT'
        if render.downloading:
            row.label(text=TRADUCTOR['notif']['downloading'][CONFIG_LANG])
        elif render.status == RenderStatus.STARTING:
            row.label(text=TRADUCTOR['notif']['launching'][CONFIG_LANG])
        elif render.status == RenderStatus.RUNNING or render.status == RenderStatus.STOPPED:
            row.prop(render, 'progress')
        elif render.status == RenderStatus.STOPPING:
            row.label(text=TRADUCTOR['notif']['stopping'][CONFIG_LANG])

        # OPS_CASE
        if render.is_downloadable:
            row.operator('tresorio.download_render_results',
                         text='',
                         icon='IMPORT').index = index
        if render.is_resumable:
            row.operator('tresorio.resume_render', icon='PLAY').index = index
        if render.is_restartable:
            row.operator('tresorio.resume_render',
                         icon='FILE_REFRESH').index = index
        if render.is_stoppable:
            row.operator('tresorio.stop_render', icon='PAUSE').index = index
        row.operator('tresorio.delete_render', text='',
                     icon='TRASH').index = index
コード例 #7
0
def draw_advanced_settings_panel(layout: bpy.types.UILayout,
                                 context: bpy.types.Context) -> None:
    """Draws the advanced settings panel"""
    user_props = context.window_manager.tresorio_user_props

    case = layout.row().split(factor=0.5)
    case.label(text=TRADUCTOR['field']['advanced_settings'][CONFIG_LANG])
    case = case.row().split(factor=0.7)
    case.operator(
        'tresorio.advanced_settings_reset',
        text=TRADUCTOR['field']['reset_advanced_settings'][CONFIG_LANG],
        icon='MODIFIER')
    case.operator('tresorio.advanced_settings_navigation_out',
                  text='',
                  icon='CANCEL')

    latest_version = user_props.latest_version
    actual_version = f"{API_CONFIG['version']['major']}.{API_CONFIG['version']['minor']}.{API_CONFIG['version']['patch']}"
    box = layout.split(factor=0.5).box()
    box.enabled = False
    box.scale_x = 0.5
    box.scale_y = 0.5
    box.label(text=TRADUCTOR['field']['version'][CONFIG_LANG] + " : " +
              actual_version)
    box.label(text=TRADUCTOR['field']['latest'][CONFIG_LANG] + " : " +
              latest_version)

    box = layout.box()
    split = box.split(factor=0.4, align=True)
    split.alignment = 'RIGHT'
    split.label(text=TRADUCTOR['field']['backend_ip'][CONFIG_LANG])
    split.prop(user_props, 'backend_ip_address', text='')

    split = box.split(factor=0.4)
    split.alignment = 'RIGHT'
    split.label(text=TRADUCTOR['field']['backend_port'][CONFIG_LANG])
    split.prop(user_props, 'backend_port', text='')

    split = box.split(factor=0.4)
    split.alignment = 'RIGHT'
    split.label(text=TRADUCTOR['field']['backend_https'][CONFIG_LANG])
    split.prop(user_props, 'backend_https', text='')

    layout.operator('tresorio.advanced_settings',
                    icon='CHECKMARK',
                    text=TRADUCTOR['field']['save_settings'][CONFIG_LANG])
コード例 #8
0
    def draw_item(self, _context: bpy.types.Context, layout: bpy.types.UILayout, _data: AnyType, item: LS3DLensProperty, icon: int, _active_data: AnyType, _active_propname: str, _index: int) -> None:
        lens = item
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            if lens:
                split = layout.split()

                col = split.column()
                col.prop(lens, "material", text="", emboss=True, icon_only=True)
                col = split.column()
                row = col.row()
                row.prop(lens, "unknown_a", text="", emboss=False, icon_value=icon)
                row.prop(lens, "unknown_b", text="", emboss=False, icon_value=icon)
            else:
                layout.label(text="", icon_value=icon)
        elif self.layout_type == 'GRID':
            layout.alignment = 'CENTER'
            layout.label(text="", icon_value=icon)
コード例 #9
0
def draw_selected_render(layout: bpy.types.UILayout,
                         context: bpy.types.Context) -> None:
    """Draw the information of a selected render"""
    nb_renders = len(context.window_manager.tresorio_renders_details)
    box_layout = layout.split(factor=0.03)
    box_layout.row()
    box = box_layout.box()
    render_index = context.window_manager.tresorio_renders_list_index

    if nb_renders == 0:
        box.label(text=TRADUCTOR['field']['its_all_empty'][CONFIG_LANG])
    elif render_index < 0 or render_index >= nb_renders:
        box.label(text=TRADUCTOR['field']['no_selected_render'][CONFIG_LANG])
    else:
        render = context.window_manager.tresorio_renders_details[render_index]

        box = box.split(factor=0.4)
        left = box.column()
        right = box.column()

        left.label(text=TRADUCTOR['field']['project'][CONFIG_LANG] + ':')
        right.label(text=render.project_name.capitalize())

        left.label(text=TRADUCTOR['field']['name'][CONFIG_LANG] + ':')
        right.label(text=render.name.capitalize())

        left.label(text=TRADUCTOR['field']['status'][CONFIG_LANG] + ':')
        right.label(text=TRADUCTOR['field'][render.status][CONFIG_LANG])

        left.label(text=TRADUCTOR['field']['engine'][CONFIG_LANG] + ':')
        right.label(text=render.engine.capitalize())

        left.label(text=TRADUCTOR['field']['format'][CONFIG_LANG] + ':')
        right.label(text=render.output_format.capitalize())

        left.label(text=TRADUCTOR['field']['advancement'][CONFIG_LANG] + ':')
        if render.total_frames == 1:
            suffix = TRADUCTOR['field']['frame_singular'][CONFIG_LANG]
            text = text = f'{render.rendered_frames} / {render.total_frames} {suffix}'
            right.label(text=text)
        else:
            suffix = TRADUCTOR['field']['frame_plural'][CONFIG_LANG]
            text = f'{render.rendered_frames} / {render.total_frames} {suffix}'
            right.label(text=text)

        left.label(text=TRADUCTOR['field']['uptime'][CONFIG_LANG] + ':')
        right.label(text=format_uptime(render.uptime))

        left.label(text=TRADUCTOR['field']['total_cost'][CONFIG_LANG] + ':')
        right.label(text=str(float("{:.2f}".format(render.total_cost))) +
                    " Tc")

        left.label(text=TRADUCTOR['field']['farm'][CONFIG_LANG] + ':')
        res_box = right.box().split()
        res_left = res_box.column()
        res_right = res_box.column()
        if render.gpu != 0:
            res_left.label(text='Gpu:')
            res_right.label(text=str(render.gpu))
        res_left.label(text='Cpu:')
        res_right.label(text=str(render.cpu))
        res_left.label(text='Ram:')
        res_right.label(text=str(math.floor(render.ram / 1000)) + " " +
                        TRADUCTOR['field']['GB'][CONFIG_LANG])
        res_left.label(text=TRADUCTOR['field']['cost'][CONFIG_LANG] + ':')
        res_right.label(text=str(float("{:.2f}".format(render.cost))) +
                        " Tc / h")
コード例 #10
0
 def _draw_row(col: bpy.types.UILayout, text: str, val: Any):
     split = col.split(factor=0.4)
     split.label(text=text)
     split.label(text=str(val))