コード例 #1
0
def draw_version_panel(
    layout: bpy.types.UILayout,
    context: bpy.types.Context,
    actual_version: str,
    latest_version: str,
) -> None:
    """Draws the panel to connect to Tresorio"""
    user_props = context.window_manager.tresorio_user_props
    report_props = bpy.context.window_manager.tresorio_report_props

    title = layout.row()
    title.label(text=f"{TRADUCTOR['desc']['new_version'][CONFIG_LANG]}")
    title = layout.row()
    title.label(
        text=
        f"{TRADUCTOR['desc']['actual_version'][CONFIG_LANG]} : {actual_version}"
    )
    title = layout.row()
    title.label(
        text=
        f"{TRADUCTOR['desc']['latest_version'][CONFIG_LANG]} : {latest_version}"
    )
    layout.operator(
        'tresorio.download_addon',
        text=f"{TRADUCTOR['desc']['download_latest'][CONFIG_LANG]}",
        icon_value=til.icon('TRESORIO_LEAF'))
コード例 #2
0
    def draw_filter(self, layout: bpy.types.UILayout,
                    sel_props: LocalProps) -> None:
        row = layout.row()
        split = compat.layout_split(row, factor=0.75)
        split.prop(sel_props, 'key', icon='NONE')
        split.operator(BUTL_OT_ArmSelectNameOprator.bl_idname,
                       icon='NONE',
                       text='Select')

        row = layout.row()
        row.alignment = 'RIGHT'
        row.prop(sel_props, 'ignore_case', icon='NONE')
コード例 #3
0
def draw_connection_panel(layout: bpy.types.UILayout,
                          context: bpy.types.Context
                          ) -> None:
    """Draws the panel to connect to Tresorio"""
    user_props = context.window_manager.tresorio_user_props
    report_props = bpy.context.window_manager.tresorio_report_props

    case = layout.row().split(factor=0.5)
    case.label(text=TRADUCTOR['field']['connection'][CONFIG_LANG])
    align_case = case.column().row().split(factor=0.8)
    align_case.column().prop(user_props, 'langs')
    align_case.column().operator('tresorio.advanced_settings_navigation_in',
                                 icon_value=til.icon('TRESORIO_SETTINGS'),
                                 text='')

    box = layout.box()
    box.label(text=TRADUCTOR['field']['mail'][CONFIG_LANG] + ':')
    box.prop(user_props, 'email', text='')
    box.label(text=TRADUCTOR['field']['password'][CONFIG_LANG] + ':')

    row = box.row().split(factor=0.9)
    if user_props.show_password:
        row.prop(user_props, 'clear_password', text='')
    else:
        row.prop(user_props, 'hidden_password', text='')
    row.prop(user_props, 'show_password',
             icon_only=True, icon='HIDE_OFF')

    row = layout.row().split(factor=0.5)
    row.column().prop(user_props, 'remember_email',
                      text=TRADUCTOR['field']['remember_email'][CONFIG_LANG])
    col = row.column()
    if not report_props.login_in:
        col.operator('tresorio.login', icon_value=til.icon('TRESORIO_LOGIN'),
                     text=TRADUCTOR['field']['login'][CONFIG_LANG])
    else:
        col.label(text=TRADUCTOR['notif']['login_in'][CONFIG_LANG])

    layout.separator(factor=2.0)

    layout.operator('tresorio.redirect_forgot_password',
                    text=TRADUCTOR['field']['forgot_password'][CONFIG_LANG],
                    icon_value=til.icon('TRESORIO_KEY'))
    layout.operator('tresorio.redirect_register',
                    text=TRADUCTOR['field']['create_account'][CONFIG_LANG],
                    icon_value=til.icon('TRESORIO_PROFILE'))
コード例 #4
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])
コード例 #5
0
def draw_prop_row(data,
                  layout: bpy.types.UILayout,
                  label: str,
                  prop_names: [],
                  align=True):
    row = layout.row(align=align)
    row.label(text=label)
    for prop_name in prop_names:
        row.prop(data, prop_name, text="")
コード例 #6
0
def draw_prop_array(data,
                    layout: bpy.types.UILayout,
                    label: str,
                    prop_array_name: str,
                    prop_indices: [],
                    align=True):
    row = layout.row(align=align)
    row.label(text=label)
    for index in prop_indices:
        row.prop(data, prop_array_name, index=index, text="")
コード例 #7
0
ファイル: bl_panels.py プロジェクト: pypingyi/mixer
def draw_shared_folders_settings_ui(layout: bpy.types.UILayout):
    mixer_props = get_mixer_props()
    mixer_prefs = get_mixer_prefs()
    row = layout.row()
    row.template_list(
        "SHAREDFOLDER_UL_ItemRenderer", "", mixer_prefs, "shared_folders", mixer_props, "shared_folder_index", rows=4
    )
    col = row.column(align=True)
    col.operator(bl_operators.SharedFoldersAddFolderOperator.bl_idname, text="", icon="ADD")
    col.operator(bl_operators.SharedFoldersRemoveFolderOperator.bl_idname, text="", icon="REMOVE")
コード例 #8
0
def collapsable_panel(
    layout: bpy.types.UILayout, data: bpy.types.AnyType, property: str, alert: bool = False, **kwargs
):
    row = layout.row()
    row.prop(
        data, property, icon="TRIA_DOWN" if getattr(data, property) else "TRIA_RIGHT", icon_only=True, emboss=False,
    )
    if alert:
        row.alert = True
    row.label(**kwargs)
    return getattr(data, property)
コード例 #9
0
ファイル: bl_panels.py プロジェクト: UPBGE/blender-addons
def draw_connection_settings_ui(layout: bpy.types.UILayout):
    mixer_prefs = get_mixer_prefs()

    row = layout.row()
    split = row.split(factor=0.233, align=False)
    split.label(text="Host:")
    sub_row = split.row()
    sub_row.prop(mixer_prefs, "host", text="")
    sub_row.prop(mixer_prefs, "port")

    layout.separator()
    row = layout.row()
    split = row.split(factor=0.233, align=False)
    split.label(text="Session Log:")
    sub_row = split.row()
    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
    sub_row.operator("mixer.open_explorer",
                     text="Open Log Folder",
                     icon_value=icon.icon_id).path = str(user_data_path)
コード例 #10
0
 def draw_mask_properties(self,
                          mask,
                          index: int,
                          col: bpy.types.UILayout,
                          *,
                          colors=False,
                          interpolate=False,
                          normalize=False,
                          p1p2=False,
                          stripes=False,
                          relative_boundaries=False,
                          expotent=False,
                          strength=False,
                          hard_edge=False,
                          horizontal=False,
                          seed=False,
                          color=False,
                          children=False,
                          mode=False):
     '''Draws properties of UV-mask.'''
     if colors:
         self.draw_colors(mask, index, col)  # colors
     if interpolate:
         col.prop(mask, "interpolate")
     if normalize:
         col.prop(mask, "normalize")
     if p1p2:
         row = col.row()
         if mask.relative_boundaries:
             row.prop(mask, "p1_relative")
             row = col.row()
             row.prop(mask, "p2_relative")
         else:
             row.prop(mask, "p1")
             row = col.row()
             row.prop(mask, "p2")
     if relative_boundaries:
         col.prop(mask, "relative_boundaries")
     if stripes:
         self.draw_stripes(mask, index, col)  # stripes
     if expotent:
         col.prop(mask, "expotent")
     if strength:
         col.row().prop(mask, "strength")
     if hard_edge:
         col.prop(mask, "hard_edge")
     if horizontal:
         col.prop(mask, "horizontal")
     if seed:
         row = col.row()
         row.prop(mask, "use_seed")
         if mask.use_seed:
             row.prop(mask, "seed")
     if color:
         col.prop(mask.color, "color")
     if mode:
         col.prop(mask, "mode")
     if children:
         col.prop(mask, "children")
コード例 #11
0
 def draw_symmetry(self, layout: bpy.types.UILayout,
                   sel_props: LocalProps) -> None:
     row = layout.row()
     split = compat.layout_split(row, factor=0.18, align=True)
     split.label(text=' ')
     label = bpy.app.translations.pgettext('selutl.SymmetryLTB')
     split.operator(BUTL_OT_MeshSelectSymOperator.bl_idname,
                    icon='NONE',
                    text=label).target = 'lt'
     label = bpy.app.translations.pgettext('selutl.SymmetryGTB')
     split.operator(BUTL_OT_MeshSelectSymOperator.bl_idname,
                    icon='NONE',
                    text=label).target = 'gt'
コード例 #12
0
ファイル: panel.py プロジェクト: Nusiq/mcblend
 def draw_render_controller(self, rc, col: bpy.types.UILayout):
     '''
     Draws single render controller GUI
     '''
     geo_cache = rc.geometry_cache
     texture_cache = rc.texture_cache
     geo_choice = geo_cache.is_cached and len(geo_cache.values) > 1
     texture_choice = texture_cache.is_cached and len(
         texture_cache.values) > 1
     material_choice = False
     for mat in rc.materials:
         mat_cache = mat.value_cache
         # Not cached (shouldn't happen) -> assume you can select something
         # Cached -> check if there are at least 2 items (a choice for user)
         if (not mat_cache.is_cached
                 or (mat_cache.is_cached and len(mat_cache.values) > 1)):
             material_choice = True
             break
     if (not geo_choice and not texture_choice and not material_choice):
         return  # Nothing to draw
     box = col.box()
     col = box.column()
     row = col.row()
     row.label(text=f'{rc.name}')
     if geo_choice:
         col.prop(rc, "geometry", text="Geometry")
     if texture_choice:
         col.prop(rc, "texture", text="Texture")
     if material_choice:
         box = col.box()
         col = box.column()
         row = col.row()
         row.label(text="Materials")
         for mat in rc.materials:
             mat_cache = mat.value_cache
             if (not mat_cache.is_cached or
                 (mat_cache.is_cached and len(mat_cache.values) > 1)):
                 col.prop(mat, "value", text=mat.name)
コード例 #13
0
 def draw_filter(unused_self, context: bpy.types.Context,
                 layout: bpy.types.UILayout) -> None:
     """Draw the filter part of the ui list"""
     del unused_self
     user_settings = context.window_manager.tresorio_user_settings_props
     layout.separator()
     # layout.prop(user_settings,
     #             'decompress_results',
     #             text=TRADUCTOR['field']['decompress_results'][CONFIG_LANG])
     row = layout.row()
     if user_settings.decompress_results is False:
         row.enabled = False
     row.prop(
         user_settings,
         'open_image_on_download',
         text=TRADUCTOR['field']['open_image_on_download'][CONFIG_LANG])
コード例 #14
0
ファイル: panel.py プロジェクト: Nusiq/mcblend
    def draw_effect(self, effect, index: int, col: bpy.types.UILayout):
        '''Draw single effect in the event'''

        # If parent is collapsed don't draw anything
        box = col.box()
        col = box.column()
        row = col.row()
        row.label(text=f'{effect.effect_type}')

        # Delete button
        op_props = row.operator("mcblend.remove_effect", icon='X', text='')
        op_props.effect_index = index
        if effect.effect_type == EffectTypes.PARTICLE_EFFECT.value:
            col.prop(effect, "effect", text="Effect")
            col.prop(effect, "locator", text="Locator")
            col.prop(effect, "pre_effect_script", text="Pre effect script")
            col.prop(effect, "bind_to_actor", text="Bind to actor")
        elif effect.effect_type == EffectTypes.SOUND_EFFECT.value:
            col.prop(effect, "effect", text="Effect")
コード例 #15
0
    def template_list(
        self,
        context: bpy.types.Context,
        layout: bpy.types.UILayout,
        listtype_name: str,
        list_id: str,
        dataptr: Any,
        propname: str,
        active_dataptr: Any,
        active_propname: str,
        item_dyntip_propname: str = "",
        min_rows: int = 1,
        header_labels: List[str] = None,
        add_op: Optional[Union[str, Tuple[str, Dict[str, Any]]]] = None,
        remove_op: Optional[Union[str, Tuple[str, Dict[str, Any]]]] = None,
        reorder_up_op: Optional[Union[str, Tuple[str, Dict[str, Any]]]] = None,
        reorder_down_op: Optional[Union[str, Tuple[str, Dict[str,
                                                             Any]]]] = None):
        """Helper method for standardizing the appearance of lists within the addon, as well as being able to add some controls along the right side.

        Most arguments match their equivalent in bpy.types.UILayout.template_list. Operator arguments can be either the argument name by itself, or the name
        plus a dictionary of key-value pairs to pass to the operator.
        """

        list_obj = getattr(dataptr, propname)
        show_header_row = header_labels and len(header_labels) > 0
        header_row_scale = 0.5

        row = layout.row()
        list_col = row.column()

        # Header row above the list: these settings make them roughly aligned with the columns in the list
        if show_header_row:
            sub = list_col.row()

            for label in header_labels:
                text: str

                if isinstance(label, str):
                    text = label
                elif isinstance(label, tuple):
                    if len(label) == 2:
                        text, split_factor = label
                        sub = sub.split(factor=split_factor)
                    else:
                        raise ValueError(
                            f"Don't know how to process header label {label}")
                else:
                    raise ValueError(
                        f"Don't know how to process header label {label}")

                col = sub.column()
                UIUtil.wrapped_label(context, col, text)

        # Mostly passthrough but with a couple of standardized params
        list_col.template_list(listtype_name,
                               list_id,
                               dataptr,
                               propname,
                               active_dataptr,
                               active_propname,
                               item_dyntip_propname=item_dyntip_propname,
                               rows=min(5, max(min_rows, len(list_obj))),
                               maxrows=5)

        if add_op or remove_op or reorder_up_op or reorder_down_op:
            button_col = row.column(align=True)

            if show_header_row:
                row = button_col.row()
                row.scale_y = header_row_scale + 0.1
                row.alignment = "CENTER"
                row.label(text="")

            if add_op:
                self._emit_operator(button_col, add_op, "ADD")

            if remove_op:
                self._emit_operator(button_col, remove_op, "REMOVE")

            button_col.separator()

            if reorder_up_op:
                self._emit_operator(button_col, reorder_up_op, "TRIA_UP")

            if reorder_down_op:
                self._emit_operator(button_col, reorder_down_op, "TRIA_DOWN")

        return list_col