예제 #1
0
    def draw_shader_presets(layout, scs_props, scs_globals, scs_inventories, is_imported_shader=False):
        """Creates Shader Presets sub-panel."""
        layout_box = layout.box()
        layout_box.enabled = not is_imported_shader
        if scs_props.shader_presets_expand:
            panel_header = layout_box.split(factor=0.5)
            panel_header_1 = panel_header.row()
            panel_header_1.prop(scs_props, 'shader_presets_expand', text="Shader Presets:", icon='TRIA_DOWN', icon_only=True, emboss=False)
            panel_header_2 = panel_header.row(align=True)
            panel_header_2.alignment = 'RIGHT'
            panel_header_2a = panel_header_2.row()
            panel_header_2a.prop(scs_props, 'shader_presets_sorted', text="", icon='SORTALPHA', expand=True, toggle=True)

            layout_box_row = layout_box.row(align=True)
            if _path_utils.is_valid_shader_presets_library_path():
                layout_box_row.alert = False
            else:
                layout_box_row.alert = True
            layout_box_row.prop(scs_globals, 'shader_presets_filepath', text="", icon='FILE_TEXT')
            layout_box_row.operator('scene.scs_tools_select_shader_presets_path', text="", icon='FILEBROWSER')

            layout_box_row = layout_box.column()
            layout_box_row.prop(scs_inventories, 'shader_presets', expand=True, toggle=True)
        else:
            layout_box_row = layout_box.row().split(factor=0.4)
            layout_box_row.prop(scs_props, 'shader_presets_expand', text="Shader Presets:", icon='TRIA_RIGHT', icon_only=True, emboss=False)

            column = layout_box_row.column(align=True)

            row = column.row(align=True)
            if is_imported_shader:
                row.prop(bpy.context.material.scs_props, "active_shader_preset_name", icon='COLOR', text="")
            else:
                row.prop(scs_inventories, 'shader_presets', text="")
            row.operator("material.scs_tools_search_shader_preset", text="", icon='VIEWZOOM')
예제 #2
0
def _draw_shader_presets(layout, scs_props, scs_globals, read_only=False):
    """Creates Shader Presets sub-panel."""
    layout_box = layout.box()
    layout_box.enabled = not read_only
    if scs_props.shader_presets_expand:
        panel_header = layout_box.split(percentage=0.5)
        panel_header_1 = panel_header.row()
        panel_header_1.prop(scs_props, 'shader_presets_expand', text="Shader Presets:", icon='TRIA_DOWN', icon_only=True, emboss=False)
        panel_header_2 = panel_header.row(align=True)
        panel_header_2.alignment = 'RIGHT'
        panel_header_2a = panel_header_2.row()
        panel_header_2a.prop(scs_props, 'shader_preset_list_sorted', text='', icon='SORTALPHA', expand=True, toggle=True)

        layout_box_row = layout_box.row(align=True)
        if _path_utils.is_valid_shader_presets_library_path():
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
        layout_box_row.prop(scs_globals, 'shader_presets_filepath', text='', icon='FILE_TEXT')
        layout_box_row.operator('scene.select_shader_presets_filepath', text='', icon='FILESEL')

        layout_box_row = layout_box.column()
        layout_box_row.prop(scs_props, 'shader_preset_list', expand=True, toggle=True)
    else:
        layout_box_row = layout_box.row()
        layout_box_row.prop(scs_props, 'shader_presets_expand', text="Shader Presets:", icon='TRIA_RIGHT', icon_only=True, emboss=False)
        layout_box_row.prop(scs_props, 'shader_preset_list', text='')
예제 #3
0
def _draw_shader_presets(layout, scs_props, scs_globals, read_only=False):
    """Creates Shader Presets sub-panel."""
    layout_box = layout.box()
    layout_box.enabled = not read_only
    if scs_props.shader_presets_expand:
        panel_header = layout_box.split(percentage=0.5)
        panel_header_1 = panel_header.row()
        panel_header_1.prop(scs_props, 'shader_presets_expand', text="Shader Presets:", icon='TRIA_DOWN', icon_only=True, emboss=False)
        panel_header_2 = panel_header.row(align=True)
        panel_header_2.alignment = 'RIGHT'
        panel_header_2a = panel_header_2.row()
        panel_header_2a.prop(scs_globals, 'shader_preset_list_sorted', text='', icon='SORTALPHA', expand=True, toggle=True)

        layout_box_row = layout_box.row(align=True)
        if _path_utils.is_valid_shader_presets_library_path():
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
        layout_box_row.prop(scs_globals, 'shader_presets_filepath', text='', icon='FILE_TEXT')
        layout_box_row.operator('scene.select_shader_presets_filepath', text='', icon='FILESEL')

        layout_box_row = layout_box.column()
        layout_box_row.prop(scs_globals, 'shader_preset_list', expand=True, toggle=True)
    else:
        layout_box_row = layout_box.row().split(percentage=0.4)
        layout_box_row.prop(scs_props, 'shader_presets_expand', text="Shader Presets:", icon='TRIA_RIGHT', icon_only=True, emboss=False)

        column = layout_box_row.column(align=True)

        row = column.row(align=True)
        row.prop(scs_globals, 'shader_preset_list', text='')
        row.prop(scs_globals, "shader_preset_use_search", icon="VIEWZOOM", icon_only=True, toggle=True)

        if scs_globals.shader_preset_use_search:
            column.prop_search(scs_globals, "shader_preset_search_value", bpy.data.worlds[0], "scs_shader_presets_inventory", text="", icon="BLANK1")
예제 #4
0
def _draw_shader_presets(layout, scs_props, scs_globals, read_only=False):
    """Creates Shader Presets sub-panel."""
    layout_box = layout.box()
    layout_box.enabled = not read_only
    if scs_props.shader_presets_expand:
        panel_header = layout_box.split(percentage=0.5)
        panel_header_1 = panel_header.row()
        panel_header_1.prop(
            scs_props, "shader_presets_expand", text="Shader Presets:", icon="TRIA_DOWN", icon_only=True, emboss=False
        )
        panel_header_2 = panel_header.row(align=True)
        panel_header_2.alignment = "RIGHT"
        panel_header_2a = panel_header_2.row()
        panel_header_2a.prop(
            scs_globals, "shader_preset_list_sorted", text="", icon="SORTALPHA", expand=True, toggle=True
        )

        layout_box_row = layout_box.row(align=True)
        if _path_utils.is_valid_shader_presets_library_path():
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
        layout_box_row.prop(scs_globals, "shader_presets_filepath", text="", icon="FILE_TEXT")
        layout_box_row.operator("scene.select_shader_presets_filepath", text="", icon="FILESEL")

        layout_box_row = layout_box.column()
        layout_box_row.prop(scs_globals, "shader_preset_list", expand=True, toggle=True)
    else:
        layout_box_row = layout_box.row().split(percentage=0.4)
        layout_box_row.prop(
            scs_props, "shader_presets_expand", text="Shader Presets:", icon="TRIA_RIGHT", icon_only=True, emboss=False
        )

        column = layout_box_row.column(align=True)

        row = column.row(align=True)
        row.prop(scs_globals, "shader_preset_list", text="")
        row.prop(scs_globals, "shader_preset_use_search", icon="VIEWZOOM", icon_only=True, toggle=True)

        if scs_globals.shader_preset_use_search:
            column.prop_search(
                scs_globals,
                "shader_preset_search_value",
                bpy.data.worlds[0],
                "scs_shader_presets_inventory",
                text="",
                icon="BLANK1",
            )
예제 #5
0
def _draw_path_settings_panel(scene, layout, scs_globals):
    """Draw global path settings panel.

    :param layout:
    :type layout: bpy.types.Layout
    :return:
    :rtype:
    """
    layout_box = layout.box()
    if scene.scs_props.global_paths_settings_expand:
        layout_box_row = layout_box.row()
        layout_box_row.prop(scene.scs_props,
                            'global_paths_settings_expand',
                            text="Path Settings:",
                            icon='TRIA_DOWN',
                            icon_only=True,
                            emboss=False)
        layout_box_row.label('')
        layout_box_col = layout_box.column(align=True)

        # SCS Project Path (DIR_PATH - absolute)
        icon = 'SNAP_ON' if _get_scs_globals(
        ).use_alternative_bases else 'SNAP_OFF'
        layout_box_col.label('SCS Project Base Path:', icon='FILE_FOLDER')
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not os.path.isdir(scs_globals.scs_project_path)
        layout_box_row.prop(scs_globals,
                            'scs_project_path',
                            text='',
                            icon='PACKAGE')
        layout_box_row.prop(scs_globals,
                            'use_alternative_bases',
                            icon=icon,
                            icon_only=True)
        layout_box_row.operator('scene.select_scs_project_path',
                                text='',
                                icon='FILESEL')

        # Divide labels and sub paths to columns
        sub_paths_layout = layout_box_col.row().split(percentage=0.3)
        sub_paths_left_col = sub_paths_layout.column(align=True)
        sub_paths_right_col = sub_paths_layout.column(align=True)

        # Trigger Actions File (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals(
        ).trigger_actions_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Trigger Action Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_trigger_actions_rel_path(
        )
        sub_path_right_col_row.prop(scs_globals,
                                    'trigger_actions_rel_path',
                                    text='',
                                    icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals,
                                    'trigger_actions_use_infixed',
                                    icon=icon,
                                    icon_only=True)
        sub_path_right_col_row.operator(
            'scene.select_trigger_actions_rel_path', text='', icon='FILESEL')

        # Sign Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals(
        ).sign_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Sign Library:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_sign_library_rel_path(
        )
        sub_path_right_col_row.prop(scs_globals,
                                    'sign_library_rel_path',
                                    text='',
                                    icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals,
                                    'sign_library_use_infixed',
                                    icon=icon,
                                    icon_only=True)
        sub_path_right_col_row.operator('scene.select_sign_library_rel_path',
                                        text='',
                                        icon='FILESEL')

        # Traffic Semaphore Profile Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals(
        ).tsem_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Semaphore Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_tsem_library_rel_path(
        )
        sub_path_right_col_row.prop(scs_globals,
                                    'tsem_library_rel_path',
                                    text='',
                                    icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals,
                                    'tsem_library_use_infixed',
                                    icon=icon,
                                    icon_only=True)
        sub_path_right_col_row.operator('scene.select_tsem_library_rel_path',
                                        text='',
                                        icon='FILESEL')

        # Traffic Rules Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals(
        ).traffic_rules_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Traffic Rules Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_traffic_rules_library_rel_path(
        )
        sub_path_right_col_row.prop(scs_globals,
                                    'traffic_rules_library_rel_path',
                                    text='',
                                    icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals,
                                    'traffic_rules_library_use_infixed',
                                    icon=icon,
                                    icon_only=True)
        sub_path_right_col_row.operator(
            'scene.select_traffic_rules_library_rel_path',
            text='',
            icon='FILESEL')

        # Hookup Library Directory (DIR_PATH - relative)
        sub_paths_left_col.label("Hookup Lib Dir:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_hookup_library_rel_path(
        )
        sub_path_right_col_row.prop(scs_globals,
                                    'hookup_library_rel_path',
                                    text='',
                                    icon='FILE_FOLDER')
        sub_path_right_col_row.operator('scene.select_hookup_library_rel_path',
                                        text='',
                                        icon='FILESEL')

        # Material Substance Library Directory (FILE_PATH - relative)
        sub_paths_left_col.label("Mat Substance Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_matsubs_library_rel_path(
        )
        sub_path_right_col_row.prop(scs_globals,
                                    'matsubs_library_rel_path',
                                    text='',
                                    icon='FILE_SCRIPT')
        sub_path_right_col_row.operator(
            'scene.select_matsubs_library_rel_path', text='', icon='FILESEL')

        layout_box_row = layout_box_col.row()
        layout_box_row.separator()

        # Shader Presets File (FILE_PATH)
        layout_box_col.label('Shader Presets Library:', icon='FILE_TEXT')
        layout_box_row = layout_box_col.row(align=True)
        if _path_utils.is_valid_shader_presets_library_path():
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
        layout_box_row.prop(scs_globals,
                            'shader_presets_filepath',
                            text='',
                            icon='NONE')
        layout_box_row.operator('scene.select_shader_presets_filepath',
                                text='',
                                icon='FILESEL')

        # CONVERSION TOOLS PATH
        layout_box_col.label("Conversion Tools Path:", icon="FILE_FOLDER")

        layout_box_row = layout_box_col.row(align=True)
        valid = (os.path.isdir(scs_globals.conv_hlpr_converters_path)
                 and os.path.isfile(
                     os.path.join(scs_globals.conv_hlpr_converters_path,
                                  "extra_mount.txt"))
                 and os.path.isfile(
                     os.path.join(scs_globals.conv_hlpr_converters_path,
                                  "convert.cmd")))
        layout_box_row.alert = not valid
        layout_box_row.prop(scs_globals, "conv_hlpr_converters_path", text="")

    else:
        layout_box_row = layout_box.row()
        layout_box_row.prop(scene.scs_props,
                            'global_paths_settings_expand',
                            text="Path Settings:",
                            icon='TRIA_RIGHT',
                            icon_only=True,
                            emboss=False)
        layout_box_row.label('')
예제 #6
0
def _draw_path_settings_panel(scene, layout, scs_globals):
    """Draw global path settings panel.

    :param layout:
    :type layout: bpy.types.Layout
    :return:
    :rtype:
    """
    layout_box = layout.box()
    if scene.scs_props.global_paths_settings_expand:
        layout_box_row = layout_box.row()
        layout_box_row.prop(
            scene.scs_props,
            'global_paths_settings_expand',
            text="Path Settings:",
            icon='TRIA_DOWN',
            icon_only=True,
            emboss=False
        )
        layout_box_row.label('')
        layout_box_col = layout_box.column()

        # SCS Project Path (DIR_PATH - absolute)
        layout_box_col.label('SCS Project Base Path:', icon='FILE_FOLDER')
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not os.path.isdir(scs_globals.scs_project_path)
        layout_box_row.prop(scs_globals, 'scs_project_path', text='', icon='PACKAGE')
        layout_box_row.operator('scene.select_scs_project_path', text='', icon='FILESEL')

        # Divide labels and sub paths to columns
        sub_paths_layout = layout_box_col.row().split(percentage=0.3)
        sub_paths_left_col = sub_paths_layout.column()
        sub_paths_right_col = sub_paths_layout.column()

        # Trigger Actions File (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().trigger_actions_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Trigger Action Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_trigger_actions_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'trigger_actions_rel_path', text='', icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals, 'trigger_actions_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.select_trigger_actions_rel_path', text='', icon='FILESEL')

        # Sign Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().sign_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Sign Library:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_sign_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'sign_library_rel_path', text='', icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals, 'sign_library_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.select_sign_library_rel_path', text='', icon='FILESEL')

        # Traffic Semaphore Profile Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().tsem_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Semaphore Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_tsem_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'tsem_library_rel_path', text='', icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals, 'tsem_library_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.select_tsem_library_rel_path', text='', icon='FILESEL')

        # Traffic Rules Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().traffic_rules_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label("Traffic Rules Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_traffic_rules_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'traffic_rules_library_rel_path', text='', icon='FILE_SCRIPT')
        sub_path_right_col_row.prop(scs_globals, 'traffic_rules_library_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.select_traffic_rules_library_rel_path', text='', icon='FILESEL')

        # Hookup Library Directory (DIR_PATH - relative)
        sub_paths_left_col.label("Hookup Lib Dir:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_hookup_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'hookup_library_rel_path', text='', icon='FILE_FOLDER')
        sub_path_right_col_row.operator('scene.select_hookup_library_rel_path', text='', icon='FILESEL')

        # Material Substance Library Directory (FILE_PATH - relative)
        sub_paths_left_col.label("Mat Substance Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_matsubs_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'matsubs_library_rel_path', text='', icon='FILE_SCRIPT')
        sub_path_right_col_row.operator('scene.select_matsubs_library_rel_path', text='', icon='FILESEL')

        layout_box_row = layout_box_col.row()
        layout_box_row.separator()

        # Shader Presets File (FILE_PATH)
        layout_box_col.label('Shader Presets Library:', icon='FILE_TEXT')
        layout_box_row = layout_box_col.row(align=True)
        if _path_utils.is_valid_shader_presets_library_path():
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
        layout_box_row.prop(scs_globals, 'shader_presets_filepath', text='', icon='NONE')
        layout_box_row.operator('scene.select_shader_presets_filepath', text='', icon='FILESEL')

    else:
        layout_box_row = layout_box.row()
        layout_box_row.prop(
            scene.scs_props,
            'global_paths_settings_expand',
            text="Path Settings:",
            icon='TRIA_RIGHT',
            icon_only=True,
            emboss=False
        )
        layout_box_row.label('')
예제 #7
0
def _draw_path_settings_panel(scene, layout, scs_globals):
    """Draw global path settings panel.

    :param layout:
    :type layout: bpy.types.Layout
    :return:
    :rtype:
    """
    layout_box = layout.box()
    if scene.scs_props.global_paths_settings_expand:
        layout_box_row = layout_box.row()
        layout_box_row.prop(scene.scs_props,
                            'global_paths_settings_expand',
                            text="Path Settings:",
                            icon='TRIA_DOWN',
                            icon_only=True,
                            emboss=False)
        layout_box_row.label('')
        layout_box_col = layout_box.column()

        # SCS Project Path (DIR_PATH - absolute)
        layout_box_col.label('SCS Project Base Path:', icon='FILE_FOLDER')
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not os.path.isdir(scs_globals.scs_project_path)
        layout_box_row.prop(scs_globals,
                            'scs_project_path',
                            text='',
                            icon='PACKAGE')
        layout_box_row.operator('scene.select_scs_project_path',
                                text='',
                                icon='FILESEL')

        # Sign Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_sign_library_rel_path()
        layout_box_row.prop(scs_globals,
                            'sign_library_rel_path',
                            icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_sign_library_rel_path',
                                text='',
                                icon='FILESEL')

        # Traffic Semaphore Profile Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_tsem_library_rel_path()
        layout_box_row.prop(scs_globals,
                            'tsem_library_rel_path',
                            text="Semaphore Lib",
                            icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_tsem_library_rel_path',
                                text='',
                                icon='FILESEL')

        # Traffic Rules Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_traffic_rules_library_rel_path(
        )
        layout_box_row.prop(scs_globals,
                            'traffic_rules_library_rel_path',
                            text="Traffic Rules Lib",
                            icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_traffic_rules_library_rel_path',
                                text='',
                                icon='FILESEL')

        # Hookup Library Directory (DIR_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_hookup_library_rel_path(
        )
        layout_box_row.prop(scs_globals,
                            'hookup_library_rel_path',
                            text="Hookup Lib Dir",
                            icon='FILE_FOLDER')
        layout_box_row.operator('scene.select_hookup_library_rel_path',
                                text='',
                                icon='FILESEL')

        # Material Substance Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_matsubs_library_rel_path(
        )
        layout_box_row.prop(scs_globals,
                            'matsubs_library_rel_path',
                            text="Mat Substance Lib",
                            icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_matsubs_library_rel_path',
                                text='',
                                icon='FILESEL')

        layout_box_row = layout_box_col.row()
        layout_box_row.separator()

        # Shader Presets File (FILE_PATH)
        layout_box_col.label('Shader Presets Library:', icon='FILE_TEXT')
        layout_box_row = layout_box_col.row(align=True)
        if _path_utils.is_valid_shader_presets_library_path():
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
        layout_box_row.prop(scs_globals,
                            'shader_presets_filepath',
                            text='',
                            icon='NONE')
        layout_box_row.operator('scene.select_shader_presets_filepath',
                                text='',
                                icon='FILESEL')

        # ## CgFX Templates File (FILE_PATH)
        # layout_box_row = layout_box_col.row(align=True)
        # if utils.is_valid_cgfx_template_library_path():
        # layout_box_row.alert = False
        # else:
        # layout_box_row.alert = True
        # layout_box_row.prop(scs_globals, 'cgfx_templates_filepath', icon='FILE_TEXT')
        # layout_box_row.operator('scene.select_cgfx_templates_filepath', text='', icon='FILESEL')
        #
        # ## CgFX Library Directory (DIR_PATH - relative)
        # layout_box_row = layout_box_col.row(align=True)
        # if utils.is_valid_cgfx_library_rel_path():
        # layout_box_row.alert = False
        # else:
        # layout_box_row.alert = True
        # layout_box_row.prop(scs_globals, 'cgfx_library_rel_path', icon='FILE_FOLDER')
        # layout_box_row.operator('scene.select_cgfx_library_rel_path', text='', icon='FILESEL')

    else:
        layout_box_row = layout_box.row()
        layout_box_row.prop(scene.scs_props,
                            'global_paths_settings_expand',
                            text="Path Settings:",
                            icon='TRIA_RIGHT',
                            icon_only=True,
                            emboss=False)
        layout_box_row.label('')
예제 #8
0
def _draw_path_settings_panel(scene, layout, scs_globals):
    """Draw global path settings panel.

    :param layout:
    :type layout: bpy.types.Layout
    :return:
    :rtype:
    """
    layout_box = layout.box()
    if scene.scs_props.global_paths_settings_expand:
        layout_box_row = layout_box.row()
        layout_box_row.prop(
            scene.scs_props,
            'global_paths_settings_expand',
            text="Path Settings:",
            icon='TRIA_DOWN',
            icon_only=True,
            emboss=False
        )
        layout_box_row.label('')
        layout_box_col = layout_box.column()

        # SCS Project Path (DIR_PATH - absolute)
        layout_box_col.label('SCS Project Base Path:', icon='FILE_FOLDER')
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not os.path.isdir(scs_globals.scs_project_path)
        layout_box_row.prop(scs_globals, 'scs_project_path', text='', icon='PACKAGE')
        layout_box_row.operator('scene.select_scs_project_path', text='', icon='FILESEL')

        # Sign Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_sign_library_rel_path()
        layout_box_row.prop(scs_globals, 'sign_library_rel_path', icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_sign_library_rel_path', text='', icon='FILESEL')

        # Traffic Semaphore Profile Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_tsem_library_rel_path()
        layout_box_row.prop(scs_globals, 'tsem_library_rel_path', text="Semaphore Lib", icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_tsem_library_rel_path', text='', icon='FILESEL')

        # Traffic Rules Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_traffic_rules_library_rel_path()
        layout_box_row.prop(scs_globals, 'traffic_rules_library_rel_path', text="Traffic Rules Lib", icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_traffic_rules_library_rel_path', text='', icon='FILESEL')

        # Hookup Library Directory (DIR_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_hookup_library_rel_path()
        layout_box_row.prop(scs_globals, 'hookup_library_rel_path', text="Hookup Lib Dir", icon='FILE_FOLDER')
        layout_box_row.operator('scene.select_hookup_library_rel_path', text='', icon='FILESEL')

        # Material Substance Library Directory (FILE_PATH - relative)
        layout_box_row = layout_box_col.row(align=True)
        layout_box_row.alert = not _path_utils.is_valid_matsubs_library_rel_path()
        layout_box_row.prop(scs_globals, 'matsubs_library_rel_path', text="Mat Substance Lib", icon='FILE_SCRIPT')
        layout_box_row.operator('scene.select_matsubs_library_rel_path', text='', icon='FILESEL')

        layout_box_row = layout_box_col.row()
        layout_box_row.separator()

        # Shader Presets File (FILE_PATH)
        layout_box_col.label('Shader Presets Library:', icon='FILE_TEXT')
        layout_box_row = layout_box_col.row(align=True)
        if _path_utils.is_valid_shader_presets_library_path():
            layout_box_row.alert = False
        else:
            layout_box_row.alert = True
        layout_box_row.prop(scs_globals, 'shader_presets_filepath', text='', icon='NONE')
        layout_box_row.operator('scene.select_shader_presets_filepath', text='', icon='FILESEL')

        # ## CgFX Templates File (FILE_PATH)
        # layout_box_row = layout_box_col.row(align=True)
        # if utils.is_valid_cgfx_template_library_path():
        # layout_box_row.alert = False
        # else:
        # layout_box_row.alert = True
        # layout_box_row.prop(scs_globals, 'cgfx_templates_filepath', icon='FILE_TEXT')
        # layout_box_row.operator('scene.select_cgfx_templates_filepath', text='', icon='FILESEL')
        #
        # ## CgFX Library Directory (DIR_PATH - relative)
        # layout_box_row = layout_box_col.row(align=True)
        # if utils.is_valid_cgfx_library_rel_path():
        # layout_box_row.alert = False
        # else:
        # layout_box_row.alert = True
        # layout_box_row.prop(scs_globals, 'cgfx_library_rel_path', icon='FILE_FOLDER')
        # layout_box_row.operator('scene.select_cgfx_library_rel_path', text='', icon='FILESEL')

    else:
        layout_box_row = layout_box.row()
        layout_box_row.prop(
            scene.scs_props,
            'global_paths_settings_expand',
            text="Path Settings:",
            icon='TRIA_RIGHT',
            icon_only=True,
            emboss=False
        )
        layout_box_row.label('')
예제 #9
0
    def draw(self, context):
        layout = self.get_layout()
        scs_globals = _get_scs_globals()

        # scs tools main panel if config is being updated
        layout.enabled = not scs_globals.config_update_lock

        # SCS Project Path (DIR_PATH - absolute)
        icon = 'SNAP_ON' if _get_scs_globals().use_alternative_bases else 'SNAP_OFF'
        layout.label(text="SCS Project Base Path:", icon='FILE_FOLDER')
        row = layout.row(align=True)
        row.alert = not os.path.isdir(scs_globals.scs_project_path)
        row.prop(scs_globals, 'scs_project_path', text="")
        row.prop(scs_globals, 'use_alternative_bases', icon=icon, icon_only=True)
        row.operator('scene.scs_tools_select_project_path', text="", icon='FILEBROWSER')

        # Divide labels and sub paths to columns
        sub_paths_layout = layout.row().split(factor=0.35)
        sub_paths_left_col = sub_paths_layout.column(align=True)
        sub_paths_right_col = sub_paths_layout.column(align=True)

        # Trigger Actions File (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().trigger_actions_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label(text="Trigger Action Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_trigger_actions_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'trigger_actions_rel_path', text="", icon='FILE_CACHE')
        sub_path_right_col_row.prop(scs_globals, 'trigger_actions_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.scs_tools_select_trigger_actions_lib_path', text="", icon='FILEBROWSER')

        # Sign Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().sign_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label(text="Sign Library:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_sign_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'sign_library_rel_path', text="", icon='FILE_CACHE')
        sub_path_right_col_row.prop(scs_globals, 'sign_library_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.scs_tools_select_sign_lib_path', text="", icon='FILEBROWSER')

        # Traffic Semaphore Profile Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().tsem_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label(text="Semaphore Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_tsem_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'tsem_library_rel_path', text="", icon='FILE_CACHE')
        sub_path_right_col_row.prop(scs_globals, 'tsem_library_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.scs_tools_select_semaphore_lib_path', text="", icon='FILEBROWSER')

        # Traffic Rules Library Directory (FILE_PATH - relative)
        icon = 'SNAP_ON' if _get_scs_globals().traffic_rules_library_use_infixed else 'SNAP_OFF'
        sub_paths_left_col.label(text="Traffic Rules Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_traffic_rules_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'traffic_rules_library_rel_path', text="", icon='FILE_CACHE')
        sub_path_right_col_row.prop(scs_globals, 'traffic_rules_library_use_infixed', icon=icon, icon_only=True)
        sub_path_right_col_row.operator('scene.scs_tools_select_traffic_rules_lib_path', text="", icon='FILEBROWSER')

        # Hookup Library Directory (DIR_PATH - relative)
        sub_paths_left_col.label(text="Hookup Lib Dir:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_hookup_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'hookup_library_rel_path', text="", icon='FILE_FOLDER')
        sub_path_right_col_row.operator('scene.scs_tools_select_hookup_lib_path', text="", icon='FILEBROWSER')

        # Material Substance Library Directory (FILE_PATH - relative)
        sub_paths_left_col.label(text="Mat Substance Lib:")
        sub_path_right_col_row = sub_paths_right_col.row(align=True)
        sub_path_right_col_row.alert = not _path_utils.is_valid_matsubs_library_rel_path()
        sub_path_right_col_row.prop(scs_globals, 'matsubs_library_rel_path', text="", icon='FILE_CACHE')
        sub_path_right_col_row.operator('scene.scs_tools_select_matsubs_lib_path', text="", icon='FILEBROWSER')

        row = layout.row()
        row.separator()

        # Shader Presets File (FILE_PATH)
        layout.label(text="Shader Presets Library:", icon='FILE_TEXT')
        row = layout.row(align=True)
        row.prop(scs_globals, 'shader_presets_use_custom', text="")
        custom_path_row = row.row(align=True)
        custom_path_row.enabled = scs_globals.shader_presets_use_custom
        custom_path_row.alert = not _path_utils.is_valid_shader_presets_library_path()
        custom_path_row.prop(scs_globals, 'shader_presets_filepath', text="")
        custom_path_row.operator('scene.scs_tools_select_shader_presets_path', text="", icon='FILEBROWSER')