Fix Shot_Builder
fails to invoke with correct project root directory
#8
@ -149,34 +149,34 @@ class SHOTBUILDER_OT_NewShotFile(bpy.types.Operator):
|
||||
|
||||
if addon_prefs.session.is_auth() is False:
|
||||
self.report(
|
||||
{'ERROR'}, "Must be logged into Kitsu to continue. Check login status in 'Blender Kitsu' addon preferences.")
|
||||
{'ERROR'}, "Must be logged into Kitsu to continue. \nCheck login status in 'Blender Kitsu' addon preferences.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
if project.id == "":
|
||||
self.report(
|
||||
{'ERROR'}, "Operator is not able to determine the Kitsu production's name. Check project is selected in 'Blender Kitsu' addon preferences.")
|
||||
{'ERROR'}, "Operator is not able to determine the Kitsu production's name. \nCheck project is selected in 'Blender Kitsu' addon preferences.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
if not addon_prefs.is_project_root_valid:
|
||||
self.report(
|
||||
{'ERROR'}, "Operator is not able to determine the project root directory. Check project root directiory is configured in 'Blender Kitsu' addon preferences.")
|
||||
{'ERROR'}, "Operator is not able to determine the project root directory. \nCheck project root directiory is configured in 'Blender Kitsu' addon preferences.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
if not addon_prefs.is_editorial_dir_valid:
|
||||
self.report(
|
||||
{'ERROR'}, "Shot builder is dependant on a valid editorial export path and file pattern. Check Preferences, errors appear in console")
|
||||
{'ERROR'}, "Shot builder is dependant on a valid editorial export path and file pattern. \nCheck Preferences, errors appear in console")
|
||||
return {'CANCELLED'}
|
||||
|
||||
self.production_root = addon_prefs.project_root_dir
|
||||
self.production_name = project.name
|
||||
|
||||
|
||||
ensure_loaded_production(context)
|
||||
production = get_active_production()
|
||||
if not ensure_loaded_production(context):
|
||||
self.report(
|
||||
{'ERROR'}, "Shot builder configuration files not found in current project directory. \nCheck addon preferences to ensure project root contains shot_builder config.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
self.production_root = addon_prefs.project_root_dir
|
||||
self.production_name = project.name
|
||||
production = get_active_production()
|
||||
|
||||
global _production_task_type_items
|
||||
_production_task_type_items = production.get_task_type_items(
|
||||
|
@ -32,6 +32,7 @@ from blender_kitsu.shot_builder.hooks import Hooks, register_hooks
|
||||
|
||||
from blender_kitsu.shot_builder.connectors.default import DefaultConnector
|
||||
from blender_kitsu.shot_builder.connectors.connector import Connector
|
||||
import os
|
||||
|
||||
from blender_kitsu import prefs
|
||||
from pathlib import Path
|
||||
@ -400,16 +401,16 @@ def ensure_loaded_production(context: bpy.types.Context) -> bool:
|
||||
Returns if the production of for the given context is loaded.
|
||||
"""
|
||||
global _PRODUCTION
|
||||
production_root = get_production_root(context)
|
||||
if production_root is None:
|
||||
_PRODUCTION = None
|
||||
return False
|
||||
if _PRODUCTION and (_PRODUCTION.path == production_root):
|
||||
return True
|
||||
|
||||
logger.debug(
|
||||
addon_prefs = prefs.addon_prefs_get(bpy.context)
|
||||
base_path = Path(addon_prefs.project_root_dir)
|
||||
production_root = os.path.join(base_path, "pro") #TODO Fix during refactor should use base_path
|
||||
if is_valid_production_root(Path(production_root)):
|
||||
logger.debug(
|
||||
f"loading new production configuration from '{production_root}'.")
|
||||
return __load_production_configuration(context, production_root)
|
||||
__load_production_configuration(context, Path(production_root))
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def __load_production_configuration(context: bpy.types.Context,
|
||||
|
Loading…
Reference in New Issue
Block a user