SVN: UX improvements #136

Merged
Demeter Dzadik merged 15 commits from Mets/blender-studio-pipeline:svn_ux_improvements into main 2023-08-01 15:39:18 +02:00
3 changed files with 10 additions and 6 deletions
Showing only changes of commit 3da7d983a1 - Show all commits

View File

@ -132,6 +132,8 @@ class May_Modifiy_Current_Blend(SVN_Operator_Single_File, Warning_Operator):
super().execute(context) super().execute(context)
if self.reload_file: if self.reload_file:
bpy.ops.wm.open_mainfile(filepath=bpy.data.filepath, load_ui=False) bpy.ops.wm.open_mainfile(filepath=bpy.data.filepath, load_ui=False)
else:
context.scene.svn.file_is_outdated = True
return {'FINISHED'} return {'FINISHED'}

View File

@ -3,10 +3,9 @@
# (c) 2022, Blender Foundation - Demeter Dzadik # (c) 2022, Blender Foundation - Demeter Dzadik
from .util import get_addon_prefs from .util import get_addon_prefs
from bpy.props import StringProperty, PointerProperty from bpy.props import StringProperty, PointerProperty, BoolProperty
from bpy.types import PropertyGroup from bpy.types import PropertyGroup
import bpy import bpy
from pathlib import Path
from typing import Optional, Dict, Any, List, Tuple, Set from typing import Optional, Dict, Any, List, Tuple, Set
from . import wheels from . import wheels
# This will load the dateutil and BAT wheel files. # This will load the dateutil and BAT wheel files.
@ -27,6 +26,12 @@ class SVN_scene_properties(PropertyGroup):
description="Absolute directory path of the SVN repository's root in the file system", description="Absolute directory path of the SVN repository's root in the file system",
) )
file_is_outdated: BoolProperty(
name="File Is Outdated",
description="Set to True when downloading a newer version of this file without reloading it, so that the warning in the UI can persist. This won't work in some cases involving multiple running Blender instances",
default=False
)
def get_repo(self, context) -> Optional['SVN_repository']: def get_repo(self, context) -> Optional['SVN_repository']:
"""Return the active repository.""" """Return the active repository."""
prefs = get_addon_prefs(context) prefs = get_addon_prefs(context)

View File

@ -17,9 +17,6 @@ def draw_outdated_file_warning(self, context):
# If the current file is not in an SVN repository. # If the current file is not in an SVN repository.
return return
if current_file.status == 'normal' and current_file.repos_status == 'none':
return
layout = self.layout layout = self.layout
row = layout.row() row = layout.row()
row.alert = True row.alert = True
@ -27,7 +24,7 @@ def draw_outdated_file_warning(self, context):
if current_file.status == 'conflicted': if current_file.status == 'conflicted':
row.operator('svn.resolve_conflict', row.operator('svn.resolve_conflict',
text="SVN: This .blend file is conflicted.", icon='ERROR') text="SVN: This .blend file is conflicted.", icon='ERROR')
elif current_file.repos_status != 'none': elif current_file.repos_status != 'none' or context.scene.svn.file_is_outdated:
op = row.operator('svn.revert_and_update_file', text="SVN: This .blend file is outdated.", icon='ERROR') op = row.operator('svn.revert_and_update_file', text="SVN: This .blend file is outdated.", icon='ERROR')
op.file_rel_path = repo.current_blend_file.svn_path op.file_rel_path = repo.current_blend_file.svn_path