Token expiry bug fixes
This commit is contained in:
Родитель
e04594f464
Коммит
62f047f8ff
|
@ -66,6 +66,7 @@ def start_session(self):
|
|||
except Exception as e:
|
||||
print("BatchApps Addon failed to load.")
|
||||
print ("Error: {0}".format(e))
|
||||
bpy.types.Scene.batchapps_error = e
|
||||
|
||||
finally:
|
||||
bpy.app.handlers.scene_update_post.remove(start_session)
|
||||
|
|
|
@ -391,14 +391,20 @@ class BatchAppsAssets(object):
|
|||
"""
|
||||
#TODO: Test relative vs. absolute paths.
|
||||
session = bpy.context.scene.batchapps_session
|
||||
temp_dir = bpy.context.user_preferences.filepaths.temporary_directory
|
||||
|
||||
if bpy.data.filepath == '' and self.props.temp:
|
||||
session.log.debug(
|
||||
"Blend path: Using current temp {0}".format(self.props.path))
|
||||
return self.props.path
|
||||
|
||||
if self.props.path:
|
||||
return self.props.path
|
||||
|
||||
else:
|
||||
|
||||
return os.path.join(temp_dir, self.name_generator())
|
||||
|
||||
elif bpy.data.filepath == '':
|
||||
temp_dir = bpy.context.user_preferences.filepaths.temporary_directory
|
||||
temp_path = os.path.join(temp_dir, self.name_generator())
|
||||
self.props.temp = True
|
||||
|
||||
|
|
|
@ -230,7 +230,10 @@ class BatchAppsAuth(object):
|
|||
completed its action.
|
||||
"""
|
||||
if self.props.credentials:
|
||||
self.props.credentials.clear_auth()
|
||||
try:
|
||||
self.props.credentials.clear_auth()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
self.props.credentials = None
|
||||
bpy.context.scene.batchapps_session.page = "LOGIN"
|
||||
|
|
|
@ -153,29 +153,29 @@ class Interface(bpy.types.Panel):
|
|||
:Args:
|
||||
- context (bpy.types.Context): The current Blender runtime context.
|
||||
"""
|
||||
if not hasattr(context.scene, 'batchapps_session'):
|
||||
return None
|
||||
if hasattr(context.scene, "batchapps_error"):
|
||||
self.load_failed()
|
||||
return
|
||||
|
||||
layout = self.layout
|
||||
session = context.scene.batchapps_session
|
||||
|
||||
if session.page in session.pages:
|
||||
session.display(self, layout)
|
||||
session.display(self, self.layout)
|
||||
|
||||
elif session.page in session.auth.pages:
|
||||
session.auth.display(self, layout)
|
||||
session.auth.display(self, self.layout)
|
||||
|
||||
elif session.page in session.submission.pages:
|
||||
session.submission.display(self, layout)
|
||||
session.submission.display(self, self.layout)
|
||||
|
||||
elif session.page in session.assets.pages:
|
||||
session.assets.display(self, layout)
|
||||
session.assets.display(self, self.layout)
|
||||
|
||||
elif session.page in session.pools.pages:
|
||||
session.pools.display(self, layout)
|
||||
session.pools.display(self, self.layout)
|
||||
|
||||
elif session.page in session.history.pages:
|
||||
session.history.display(self, layout)
|
||||
session.history.display(self, self.layout)
|
||||
|
||||
else:
|
||||
session.log.error("Cant load page: {0}. "
|
||||
|
@ -184,3 +184,14 @@ class Interface(bpy.types.Panel):
|
|||
session.page = "ERROR"
|
||||
session.display(self, layout)
|
||||
|
||||
def load_failed(self):
|
||||
"""
|
||||
Display error page if the addon failed to load.
|
||||
|
||||
"""
|
||||
sublayout = self.layout.box()
|
||||
self.label("Addon failed to load correctly", sublayout.row(align=True), "CENTER")
|
||||
self.label("Please see console for details.", sublayout.row(align=True), "CENTER")
|
||||
|
||||
self.label("", sublayout)
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ class BatchAppsPools(object):
|
|||
|
||||
return bpy.ops.batchapps_pools.page()
|
||||
|
||||
def _create(self, op):
|
||||
def _create(self, op, context):
|
||||
"""
|
||||
The execute method for the pools.create operator.
|
||||
Display the UI components to create a new pool by setting the page
|
||||
|
|
|
@ -155,7 +155,7 @@ class AssetProps(bpy.types.PropertyGroup):
|
|||
return asset
|
||||
else:
|
||||
log.debug("Found no job asset, using {0}".format(self.path))
|
||||
return self.path
|
||||
raise ValueError("Job Asset not in collection")
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
|
|
|
@ -128,6 +128,10 @@ class BatchAppsSettings(object):
|
|||
|
||||
finally:
|
||||
|
||||
if not os.path.isdir(self.props.data_dir):
|
||||
raise EnvironmentError("Data directory not created - "
|
||||
"please ensure you have adequate permissions.")
|
||||
|
||||
if not cfg:
|
||||
cfg = Configuration(jobtype='Blender', log_level='warning')
|
||||
|
||||
|
@ -201,7 +205,14 @@ class BatchAppsSettings(object):
|
|||
:Returns:
|
||||
- :class:`.BatchAppsPreferences`
|
||||
"""
|
||||
return bpy.context.user_preferences.addons[__package__].preferences
|
||||
props = bpy.context.user_preferences.addons[__package__].preferences
|
||||
if not os.path.isdir(props.data_dir):
|
||||
try:
|
||||
os.mkdir(data_dir)
|
||||
except:
|
||||
raise EnvironmentError("Data directory not created - "
|
||||
"please ensure you have adequate permissions.")
|
||||
return props
|
||||
|
||||
def _register_ui(self):
|
||||
"""
|
||||
|
|
|
@ -40,6 +40,7 @@ from batchapps_blender.props import props_submission
|
|||
from batchapps_blender.utils import BatchAppsOps
|
||||
|
||||
from batchapps.exceptions import (
|
||||
SessionExpiredException,
|
||||
AuthenticationException,
|
||||
InvalidConfigException)
|
||||
|
||||
|
@ -340,6 +341,12 @@ class BatchAppsSubmission(object):
|
|||
session.log.info("No assets referenced yet. Checking now.")
|
||||
bpy.ops.batchapps_assets.refresh()
|
||||
|
||||
if session.page == 'LOGIN':
|
||||
raise SessionExpiredException("AAD token has expired")
|
||||
|
||||
elif session.page == 'ERROR':
|
||||
raise Exception("Failed to set up assets for job")
|
||||
|
||||
file_set = self.batchapps_files.create_file_set(assets.collection)
|
||||
new_job.add_file_collection(file_set)
|
||||
|
||||
|
@ -355,7 +362,11 @@ class BatchAppsSubmission(object):
|
|||
|
||||
else:
|
||||
session.log.debug("Using saved blend file {0}".format(assets.path))
|
||||
jobfile = bpy.context.scene.batchapps_assets.get_jobfile()
|
||||
try:
|
||||
jobfile = bpy.context.scene.batchapps_assets.get_jobfile()
|
||||
except ValueError:
|
||||
jobfile = self.batchapps_files.file_from_path(assets.path)
|
||||
|
||||
new_job.set_job_file(jobfile)
|
||||
|
||||
self.upload_assets(new_job)
|
||||
|
|
|
@ -37,11 +37,6 @@ VERSION = "0.1.0"
|
|||
def main():
|
||||
"""Build Blender Addon package"""
|
||||
|
||||
python_exe = os.path.join(sys.prefix, "python.exe")
|
||||
if not os.path.exists(python_exe):
|
||||
print("Cannot find python.exe at path: {0}".format(python_exe))
|
||||
return
|
||||
|
||||
print("Building package...")
|
||||
|
||||
package_dir = os.path.abspath("build")
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
|
||||
The Blender Batch Apps Sample ver. 0.1.0
|
||||
Batch Apps Blender Addon and C# Cloud Assemblies
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
All rights reserved.
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the ""Software""), to deal
|
||||
|
|
|
@ -253,8 +253,8 @@ To run this addon you will need:
|
|||
Addon Documentation
|
||||
--------------------
|
||||
|
||||
The Addon User Guide can be found `here <PENDING_URL>`_.
|
||||
Auto generated Sphinx documentation for the Addon code can be found `here <PENDING_URL>`_.
|
||||
The Addon User Guide can be found `here <http://dl.windowsazure.com/batchapps/blender/user_guide.html>`_.
|
||||
Auto generated Sphinx documentation for the Addon code can be found `here <http://dl.windowsazure.com/batchapps/blender/batchapps_blender.html>`_.
|
||||
|
||||
|
||||
|
||||
|
|
Двоичные данные
docs.zip
Двоичные данные
docs.zip
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче