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 = {
|
2021-02-16 11:21:06 +01:00
|
|
|
"name": "Blender Cloud",
|
2016-08-01 14:40:56 +02:00
|
|
|
"author": "Sybren A. Stüvel, Francesco Siddi, Inês Almeida, Antony Riakiotakis",
|
2022-02-25 15:09:59 +01:00
|
|
|
"version": (1, 25),
|
2021-02-16 11:21:06 +01:00
|
|
|
"blender": (2, 80, 0),
|
|
|
|
"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.80 or newer.",
|
|
|
|
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
|
|
|
|
"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
|
2021-02-16 11:21:06 +01:00
|
|
|
if "pillar" in locals():
|
2016-03-09 14:09:22 +01:00
|
|
|
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
|
2021-02-16 11:21:06 +01:00
|
|
|
if "%s.blender" % __name__ in sys.modules:
|
2016-03-18 16:53:52 +01:00
|
|
|
import importlib
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2016-03-18 16:53:52 +01:00
|
|
|
def reload_mod(name):
|
2021-02-16 11:21:06 +01:00
|
|
|
modname = "%s.%s" % (__name__, name)
|
2017-05-03 12:12:58 +02:00
|
|
|
try:
|
|
|
|
old_module = sys.modules[modname]
|
|
|
|
except KeyError:
|
|
|
|
# Wasn't loaded before -- can happen after an upgrade.
|
|
|
|
new_module = importlib.import_module(modname)
|
|
|
|
else:
|
|
|
|
new_module = importlib.reload(old_module)
|
|
|
|
|
|
|
|
sys.modules[modname] = new_module
|
|
|
|
return new_module
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2021-02-16 11:21:06 +01:00
|
|
|
reload_mod("blendfile")
|
|
|
|
reload_mod("home_project")
|
|
|
|
reload_mod("utils")
|
|
|
|
reload_mod("pillar")
|
|
|
|
|
|
|
|
async_loop = reload_mod("async_loop")
|
|
|
|
flamenco = reload_mod("flamenco")
|
|
|
|
attract = reload_mod("attract")
|
|
|
|
texture_browser = reload_mod("texture_browser")
|
|
|
|
settings_sync = reload_mod("settings_sync")
|
|
|
|
image_sharing = reload_mod("image_sharing")
|
|
|
|
blender = reload_mod("blender")
|
|
|
|
project_specific = reload_mod("project_specific")
|
2016-03-18 16:53:52 +01:00
|
|
|
else:
|
2021-02-16 11:21:06 +01:00
|
|
|
from . import (
|
|
|
|
blender,
|
|
|
|
texture_browser,
|
|
|
|
async_loop,
|
|
|
|
settings_sync,
|
|
|
|
blendfile,
|
|
|
|
home_project,
|
|
|
|
image_sharing,
|
|
|
|
attract,
|
|
|
|
flamenco,
|
|
|
|
project_specific,
|
|
|
|
)
|
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()
|
2017-05-03 12:12:58 +02:00
|
|
|
attract.register()
|
2016-07-15 14:27:42 +02:00
|
|
|
texture_browser.register()
|
2016-06-16 16:33:35 +02:00
|
|
|
settings_sync.register()
|
2016-07-06 15:20:50 +02:00
|
|
|
image_sharing.register()
|
2017-05-03 12:12:58 +02:00
|
|
|
blender.register()
|
2016-03-09 17:34:37 +01:00
|
|
|
|
2018-01-02 16:42:37 +01:00
|
|
|
project_specific.handle_project_update()
|
2017-03-17 15:08:09 +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
|
|
|
|
|
2021-02-16 11:21:06 +01:00
|
|
|
log.info("Monkey-patching requests version %s", requests.__version__)
|
2016-06-28 16:07:08 +02:00
|
|
|
from requests.packages.urllib3.response import HTTPResponse
|
2021-02-16 11:21:06 +01:00
|
|
|
|
2016-06-28 16:07:08 +02:00
|
|
|
HTTPResponse.chunked = False
|
|
|
|
HTTPResponse.chunk_left = None
|
|
|
|
|
|
|
|
|
2016-03-08 16:22:20 +01:00
|
|
|
def unregister():
|
2021-02-16 11:21:06 +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()
|