save startup blend for animation tab & whatnot
This commit is contained in:
2026-04-08 12:10:18 -06:00
parent 57a652524a
commit 692e200ffe
180 changed files with 12336 additions and 3431 deletions
@@ -24,11 +24,14 @@ Implements draw calls, popups, and operators that use the addon_updater.
import os
import traceback
import logging
import bpy
from bpy.app.handlers import persistent
from . import client_lib
from . import client_lib, utils
bk_logger = logging.getLogger(__name__)
# Safely import the updater.
@@ -37,9 +40,9 @@ from . import client_lib
try:
from .addon_updater import Updater as updater
except Exception as e:
print("ERROR INITIALIZING UPDATER")
print(str(e))
traceback.print_exc()
bk_logger.error("ERROR INITIALIZING UPDATER")
bk_logger.error(str(e))
bk_logger.error("%s", traceback.format_exc())
class SingletonUpdaterNone(object):
"""Fake, bare minimum fields and functions for the updater object."""
@@ -175,6 +178,10 @@ class AddonUpdaterInstallPopup(bpy.types.Operator):
return True
def invoke(self, context, event):
# Skip opening the popup when we already know there is nothing to show.
if not updater.invalid_updater and updater.update_ready is False:
updater.print_verbose("No update available; skipping popup")
return {"CANCELLED"}
return context.window_manager.invoke_props_dialog(self)
def draw(self, context):
@@ -229,9 +236,9 @@ class AddonUpdaterInstallPopup(bpy.types.Operator):
# Should return 0, if not something happened.
if updater.verbose:
if res == 0:
print("Updater returned successful")
bk_logger.info("Updater returned successful")
else:
print("Updater returned {}, error occurred".format(res))
bk_logger.info("Updater returned {}, error occurred".format(res))
elif updater.update_ready is None:
_ = updater.check_for_update(now=True)
@@ -322,9 +329,9 @@ class AddonUpdaterUpdateNow(bpy.types.Operator):
# Should return 0, if not something happened.
if updater.verbose:
if res == 0:
print("Updater returned successful")
bk_logger.info("Updater returned successful")
else:
print("Updater error response: {}".format(res))
bk_logger.info("Updater error response: {}".format(res))
except Exception as expt:
updater._error = "Error trying to run update"
updater._error_msg = str(expt)
@@ -450,7 +457,7 @@ class AddonUpdaterInstallManually(bpy.types.Operator):
layout.label(text="Updater error")
return
# Display error if a prior autoamted install failed.
# Display error if a prior automated install failed.
if self.error != "":
col = layout.column()
col.scale_y = 0.7
@@ -692,7 +699,7 @@ def updater_run_install_popup_handler(scene):
updater_run_install_popup_handler
)
except Exception as e:
print(e)
bk_logger.error("%s", e)
pass
if "ignore" in updater.json and updater.json["ignore"]:
@@ -833,8 +840,8 @@ def check_for_update_nonthreaded(self, context):
settings = get_user_preferences(bpy.context)
if not settings:
if updater.verbose:
print(
"Could not get {} preferences, update check skipped".format(__package__)
bk_logger.info(
"Could not get %s preferences, update check skipped", __package__
)
return
updater.set_check_interval(
@@ -1128,6 +1135,15 @@ def update_settings_ui(self, context, element=None):
else:
row.label(text="Last update check: Never")
version_row = box.row()
version_row.label(
text=f"BlenderKit v{utils.get_addon_version()} · Blender {bpy.app.version_string}",
icon="INFO",
)
version_row.operator(
"wm.blenderkit_copy_environment_info", text="Copy Info", icon="COPYDOWN"
)
def update_settings_ui_condensed(self, context, element=None):
"""Preferences - Condensed drawing within preferences.
@@ -1359,7 +1375,7 @@ def register(bl_info):
"""Registering the operators in this module"""
# Safer failure in case of issue loading module.
if updater.error:
print("Exiting updater registration, " + updater.error)
bk_logger.error("Exiting updater registration, %s", updater.error)
return
updater.clear_state() # Clear internal vars, avoids reloading oddities.