Fix Shot_Builder
fails to invoke with correct project root directory
#8
@ -149,35 +149,35 @@ class SHOTBUILDER_OT_NewShotFile(bpy.types.Operator):
|
|||||||
|
|
||||||
if addon_prefs.session.is_auth() is False:
|
if addon_prefs.session.is_auth() is False:
|
||||||
self.report(
|
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'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
if project.id == "":
|
if project.id == "":
|
||||||
self.report(
|
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'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
if not addon_prefs.is_project_root_valid:
|
if not addon_prefs.is_project_root_valid:
|
||||||
self.report(
|
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'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
if not addon_prefs.is_editorial_dir_valid:
|
if not addon_prefs.is_editorial_dir_valid:
|
||||||
self.report(
|
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'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
self.production_root = addon_prefs.project_root_dir
|
self.production_root = addon_prefs.project_root_dir
|
||||||
self.production_name = project.name
|
self.production_name = project.name
|
||||||
|
|
||||||
|
|
||||||
ensure_loaded_production(context)
|
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'}
|
||||||
|
|
||||||
production = get_active_production()
|
production = get_active_production()
|
||||||
|
|
||||||
|
|
||||||
self.production_root = addon_prefs.project_root_dir
|
|
||||||
self.production_name = project.name
|
|
||||||
|
|
||||||
global _production_task_type_items
|
global _production_task_type_items
|
||||||
_production_task_type_items = production.get_task_type_items(
|
_production_task_type_items = production.get_task_type_items(
|
||||||
context=context)
|
context=context)
|
||||||
|
@ -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.default import DefaultConnector
|
||||||
from blender_kitsu.shot_builder.connectors.connector import Connector
|
from blender_kitsu.shot_builder.connectors.connector import Connector
|
||||||
|
import os
|
||||||
|
|
||||||
from blender_kitsu import prefs
|
from blender_kitsu import prefs
|
||||||
from pathlib import Path
|
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.
|
Returns if the production of for the given context is loaded.
|
||||||
"""
|
"""
|
||||||
global _PRODUCTION
|
global _PRODUCTION
|
||||||
production_root = get_production_root(context)
|
addon_prefs = prefs.addon_prefs_get(bpy.context)
|
||||||
if production_root is None:
|
base_path = Path(addon_prefs.project_root_dir)
|
||||||
_PRODUCTION = None
|
production_root = os.path.join(base_path, "pro") #TODO Fix during refactor should use base_path
|
||||||
return False
|
if is_valid_production_root(Path(production_root)):
|
||||||
if _PRODUCTION and (_PRODUCTION.path == production_root):
|
logger.debug(
|
||||||
return True
|
|
||||||
|
|
||||||
logger.debug(
|
|
||||||
f"loading new production configuration from '{production_root}'.")
|
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,
|
def __load_production_configuration(context: bpy.types.Context,
|
||||||
|
Loading…
Reference in New Issue
Block a user