2016-03-08 16:22:20 +01:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
# <pep8 compliant>
|
|
|
|
|
|
|
|
bl_info = {
|
2016-06-24 13:48:55 +02:00
|
|
|
'name': 'Blender Cloud',
|
2016-08-01 14:40:56 +02:00
|
|
|
"author": "Sybren A. Stüvel, Francesco Siddi, Inês Almeida, Antony Riakiotakis",
|
2017-01-24 17:22:04 +01:00
|
|
|
'version': (1, 5, 99999),
|
2016-04-19 11:37:46 +02:00
|
|
|
'blender': (2, 77, 0),
|
2016-06-24 13:48:55 +02:00
|
|
|
'location': 'Addon Preferences panel, and Ctrl+Shift+Alt+A anywhere for texture browser',
|
|
|
|
'description': 'Texture library browser and Blender Sync. Requires the Blender ID addon '
|
|
|
|
'and Blender 2.77a or newer.',
|
2016-11-07 11:23:27 +01:00
|
|
|
'wiki_url': 'https://wiki.blender.org/index.php/Extensions:2.6/Py/'
|
2016-04-19 11:37:46 +02:00
|
|
|
'Scripts/System/BlenderCloud',
|
|
|
|
'category': 'System',
|
2016-03-08 16:22:20 +01:00
|
|
|
}
|
|
|
|
|
2016-06-28 16:07:08 +02:00
|
|
|
import logging
|
|
|
|
|
2016-03-09 14:09:22 +01:00
|
|
|
# Support reloading
|
|
|
|
if 'pillar' in locals():
|
|
|
|
import importlib
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2016-03-18 16:53:52 +01:00
|
|
|
wheels = importlib.reload(wheels)
|
|
|
|
wheels.load_wheels()
|
|
|
|
|
2016-03-09 14:09:22 +01:00
|
|
|
pillar = importlib.reload(pillar)
|
2016-03-22 15:20:22 +01:00
|
|
|
cache = importlib.reload(cache)
|
2016-03-09 14:09:22 +01:00
|
|
|
else:
|
2016-03-18 16:53:52 +01:00
|
|
|
from . import wheels
|
2016-06-28 16:07:08 +02:00
|
|
|
|
2016-03-18 16:53:52 +01:00
|
|
|
wheels.load_wheels()
|
2016-03-09 14:09:22 +01:00
|
|
|
|
2016-08-26 17:43:20 +02:00
|
|
|
from . import pillar, cache
|
2016-03-08 17:56:13 +01:00
|
|
|
|
2016-06-28 16:07:08 +02:00
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2016-03-08 16:22:20 +01:00
|
|
|
|
|
|
|
def register():
|
2016-03-18 16:53:52 +01:00
|
|
|
"""Late-loads and registers the Blender-dependent submodules."""
|
2016-03-08 16:22:20 +01:00
|
|
|
|
2016-03-18 16:53:52 +01:00
|
|
|
import sys
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2016-06-28 16:07:08 +02:00
|
|
|
_monkey_patch_requests()
|
|
|
|
|
2016-03-18 16:53:52 +01:00
|
|
|
# Support reloading
|
|
|
|
if '%s.blender' % __name__ in sys.modules:
|
|
|
|
import importlib
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2016-03-18 16:53:52 +01:00
|
|
|
def reload_mod(name):
|
|
|
|
modname = '%s.%s' % (__name__, name)
|
|
|
|
module = importlib.reload(sys.modules[modname])
|
|
|
|
sys.modules[modname] = module
|
|
|
|
return module
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2016-07-06 15:20:50 +02:00
|
|
|
reload_mod('blendfile')
|
|
|
|
reload_mod('home_project')
|
2016-07-21 11:17:53 +02:00
|
|
|
reload_mod('utils')
|
2016-07-06 15:20:50 +02:00
|
|
|
|
2016-03-18 16:53:52 +01:00
|
|
|
blender = reload_mod('blender')
|
|
|
|
async_loop = reload_mod('async_loop')
|
2016-07-15 14:27:42 +02:00
|
|
|
texture_browser = reload_mod('texture_browser')
|
2016-06-16 16:33:35 +02:00
|
|
|
settings_sync = reload_mod('settings_sync')
|
2016-07-06 15:20:50 +02:00
|
|
|
image_sharing = reload_mod('image_sharing')
|
2016-08-26 17:43:20 +02:00
|
|
|
attract = reload_mod('attract')
|
2017-01-13 17:24:37 +01:00
|
|
|
flamenco = reload_mod('flamenco')
|
2016-03-18 16:53:52 +01:00
|
|
|
else:
|
2016-07-15 14:27:42 +02:00
|
|
|
from . import (blender, texture_browser, async_loop, settings_sync, blendfile, home_project,
|
2017-01-13 17:24:37 +01:00
|
|
|
image_sharing, attract, flamenco)
|
2016-03-15 15:44:19 +01:00
|
|
|
|
2016-03-15 14:05:54 +01:00
|
|
|
async_loop.setup_asyncio_executor()
|
2016-03-23 13:45:28 +01:00
|
|
|
async_loop.register()
|
2016-03-18 16:53:52 +01:00
|
|
|
|
2017-01-13 17:24:37 +01:00
|
|
|
flamenco.register()
|
2016-07-15 14:27:42 +02:00
|
|
|
texture_browser.register()
|
2016-06-28 16:41:31 +02:00
|
|
|
blender.register()
|
2016-06-16 16:33:35 +02:00
|
|
|
settings_sync.register()
|
2016-07-06 15:20:50 +02:00
|
|
|
image_sharing.register()
|
2016-08-01 14:40:56 +02:00
|
|
|
attract.register()
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2016-03-08 16:22:20 +01:00
|
|
|
|
2016-06-28 16:07:08 +02:00
|
|
|
def _monkey_patch_requests():
|
|
|
|
"""Monkey-patch old versions of Requests.
|
|
|
|
|
|
|
|
This is required for the Mac version of Blender 2.77a.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
|
|
|
if requests.__build__ >= 0x020601:
|
|
|
|
return
|
|
|
|
|
|
|
|
log.info('Monkey-patching requests version %s', requests.__version__)
|
|
|
|
from requests.packages.urllib3.response import HTTPResponse
|
|
|
|
HTTPResponse.chunked = False
|
|
|
|
HTTPResponse.chunk_left = None
|
|
|
|
|
|
|
|
|
2016-03-08 16:22:20 +01:00
|
|
|
def unregister():
|
2017-01-13 17:24:37 +01:00
|
|
|
from . import (blender, texture_browser, async_loop, settings_sync, image_sharing, attract,
|
|
|
|
flamenco)
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2016-07-06 15:20:50 +02:00
|
|
|
image_sharing.unregister()
|
2016-08-01 14:40:56 +02:00
|
|
|
attract.unregister()
|
2016-06-28 16:41:31 +02:00
|
|
|
settings_sync.unregister()
|
2016-03-18 16:53:52 +01:00
|
|
|
blender.unregister()
|
2016-07-15 14:27:42 +02:00
|
|
|
texture_browser.unregister()
|
2016-03-23 13:45:28 +01:00
|
|
|
async_loop.unregister()
|
2017-01-13 17:24:37 +01:00
|
|
|
flamenco.unregister()
|