Add git updater (beta)
1.9.3 - feat: Add an update button at bottom of preferences if addon is a cloned repository
This commit is contained in:
+29
-3
@@ -15,7 +15,7 @@ bl_info = {
|
||||
"name": "GP toolbox",
|
||||
"description": "Tool set for Grease Pencil in animation production",
|
||||
"author": "Samuel Bernou, Christophe Seux",
|
||||
"version": (1, 9, 2),
|
||||
"version": (1, 9, 3),
|
||||
"blender": (2, 91, 0),
|
||||
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||
"warning": "",
|
||||
@@ -27,6 +27,8 @@ bl_info = {
|
||||
# from . import addon_updater_ops
|
||||
|
||||
# from .utils import *
|
||||
from pathlib import Path
|
||||
from shutil import which
|
||||
from .utils import get_addon_prefs, draw_kmi
|
||||
# from .functions import *
|
||||
|
||||
@@ -54,6 +56,7 @@ from . import OP_layer_manager
|
||||
from . import OP_layer_picker
|
||||
from . import OP_layer_nav
|
||||
from . import OP_material_picker
|
||||
from . import OP_git_update
|
||||
from . import OP_eraser_brush
|
||||
from . import TOOL_eraser_brush
|
||||
from . import handler_draw_cam
|
||||
@@ -141,6 +144,10 @@ class GPTB_prefs(bpy.types.AddonPreferences):
|
||||
|
||||
#--# PROJECT PREFERENCES #--#
|
||||
# subtype (string) – Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILE_NAME', 'BYTE_STRING', 'PASSWORD', 'NONE'].
|
||||
|
||||
# update variables
|
||||
is_git_repo : BoolProperty(default=False)
|
||||
has_git : BoolProperty(default=False)
|
||||
|
||||
## fps
|
||||
|
||||
@@ -472,6 +479,17 @@ class GPTB_prefs(bpy.types.AddonPreferences):
|
||||
# row.prop(self, 'nav_interval') # Do not expose refresh rate for now, not usefull to user...
|
||||
|
||||
box.prop(self, 'use_precise_eraser')
|
||||
|
||||
if self.is_git_repo:
|
||||
box = layout.box()
|
||||
box.label(text='Addon Update')
|
||||
if self.is_git_repo and self.has_git:
|
||||
box.operator('gptb.git_pull', text='Check / Get Last Update', icon='PLUGIN')
|
||||
else:
|
||||
box.label(text='Toolbox can be updated using git')
|
||||
row = box.row()
|
||||
row.operator('wm.url_open', text='Download and install git here', icon='URL').url = 'https://git-scm.com/download/'
|
||||
row.label(text='then restart blender')
|
||||
|
||||
if self.pref_tabs == 'KEYS':
|
||||
# layout.label(text='Shortcuts :')
|
||||
@@ -702,6 +720,7 @@ def register():
|
||||
OP_layer_manager.register()
|
||||
OP_eraser_brush.register()
|
||||
OP_material_picker.register()
|
||||
OP_git_update.register()
|
||||
OP_layer_picker.register()
|
||||
OP_layer_nav.register()
|
||||
TOOL_eraser_brush.register()
|
||||
@@ -713,10 +732,16 @@ def register():
|
||||
set_env_properties()
|
||||
|
||||
## add handler (if option is on)
|
||||
if get_addon_prefs().use_relative_remap_on_save:
|
||||
prefs = get_addon_prefs()
|
||||
if prefs.use_relative_remap_on_save:
|
||||
if not 'remap_relative' in [hand.__name__ for hand in bpy.app.handlers.save_pre]:
|
||||
bpy.app.handlers.save_pre.append(remap_relative)
|
||||
|
||||
|
||||
prefs.is_git_repo = (Path(__file__).parent / '.git').exists()
|
||||
prefs.has_git = bool(which('git'))
|
||||
|
||||
## change a variable in prefs if a '.git is detected'
|
||||
|
||||
|
||||
def unregister():
|
||||
# remove handler
|
||||
@@ -732,6 +757,7 @@ def unregister():
|
||||
TOOL_eraser_brush.unregister()
|
||||
OP_layer_nav.unregister()
|
||||
OP_layer_picker.unregister()
|
||||
OP_git_update.unregister()
|
||||
OP_material_picker.unregister()
|
||||
OP_eraser_brush.unregister()
|
||||
OP_layer_manager.unregister()
|
||||
|
||||
Reference in New Issue
Block a user