commit working version

pull/254/head
Joe Marshall 2024-01-12 12:14:37 +00:00
rodzic 302ea11809
commit 94860361bc
3 zmienionych plików z 38 dodań i 4 usunięć

Wyświetl plik

@ -47,7 +47,7 @@ from bpy.props import *
from bpy.types import Menu, Operator, UIList, AddonPreferences
from bpy_extras.object_utils import object_data_add
from cam import ui, ops, curvecamtools, curvecamequation, curvecamcreate, utils, simple, \
polygon_utils_cam # , post_processors
polygon_utils_cam, autoupdate # , post_processors
from mathutils import *
from shapely import geometry as sgeometry
@ -129,6 +129,31 @@ class CamAddonPreferences(AddonPreferences):
default=False,
)
update_source: bpy.props.EnumProperty(
name="Source of updates for the addon",
description="",
# first item is filled in by github actions when a release is created
items=[("https://api.github.com/repos/vilemduha/blendercam/releases", "Stable", "Stable releases (github.com/vilemduja/blendercam)"),
("https://api.github.com/repos/pppalain/blendercam/releases", "Unstable", "Unstable releases (github.com/pppalain/blendercam)"),
("https://github.com/pppalain/blendercam/archive/refs/heads/master.zip", "Daily", "Direct from git repository (github.com/pppalain/blendercam)"),
("<CUSTOM_DOWNLOAD_SOURCE>","Source","Where the release was downloaded from"),
("","None","Don't do auto update"),
],
default="",
)
last_update_check: IntProperty(
name="Last update time",
default=0
)
just_updated: BoolProperty(
name="Set to true on update",
default=False
)
default_interface_level: bpy.props.EnumProperty(
name="Interface level in new file",
description="Choose visible options",
@ -148,7 +173,7 @@ class CamAddonPreferences(AddonPreferences):
def draw(self, context):
layout = self.layout
layout.label(text="Use experimental features when you want to help development of Blender CAM:")
layout.prop(self, "update_source")
layout.prop(self, "experimental")

Wyświetl plik

@ -8,6 +8,7 @@ import bpy
import re
import io
import os
import sys
class UpdateChecker(bpy.types.Operator):
"""calculate all CAM paths"""
@ -34,6 +35,8 @@ class UpdateChecker(bpy.types.Operator):
if match:
version_num = tuple(map(int,match.groups()))
print(f"Found version: {version_num}")
bpy.context.preferences.addons['cam'].preferences.last_update_check = today
bpy.ops.wm.save_userpref()
if version_num > current_version:
print("Version is newer, downloading source")
@ -50,7 +53,6 @@ class UpdateChecker(bpy.types.Operator):
path_pos=filename.replace("\\","/").find("/scripts/addons/cam/")
if path_pos!=-1:
relative_path=filename[path_pos+len("/scripts/addons/cam/"):]
print("rp",relative_path,addons_path)
out_path = addons_path / relative_path
print(out_path)
# check folder exists
@ -60,6 +62,13 @@ class UpdateChecker(bpy.types.Operator):
# TODO: what about if a file is deleted...
# updated everything, now mark as updated and reload scripts
bpy.context.preferences.addons['cam'].preferences.just_updated=True
# unload ourself from python module system
delete_list=[]
for m in sys.modules.keys():
if m.startswith("cam.") or m=='cam':
delete_list.append(m)
for d in delete_list:
del sys.modules[d]
bpy.ops.wm.save_userpref()
bpy.ops.script.reload()
return {'FINISHED'}

Wyświetl plik

@ -1 +1 @@
__version__=(0,9,7)
__version__=(0,9,6)