-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:LuxCoreRender/BlendLuxCore
- Loading branch information
Showing
6 changed files
with
180 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ##### 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 ##### | ||
# | ||
# This code is based on the Blenderkit Addon | ||
# Homepage: https://www.blenderkit.com/ | ||
# Sourcecode: https://github.com/blender/blender-addons/tree/master/blenderkit | ||
# | ||
# ##### | ||
|
||
import bpy | ||
from os.path import basename, dirname, join, isfile, splitext | ||
|
||
from bpy.types import Operator | ||
from ...utils.lol import utils as utils | ||
|
||
|
||
class LOLUpdateTOC(Operator): | ||
bl_idname = 'scene.luxcore_ol_update_toc' | ||
bl_label = 'LuxCore Online Library Update Table of Contents from Server' | ||
bl_options = {'REGISTER', 'UNDO', 'INTERNAL'} | ||
|
||
@classmethod | ||
def description(cls, context, properties): | ||
return "Update table of contents from server" | ||
|
||
def execute(self, context): | ||
import urllib.request | ||
import json | ||
|
||
name = basename(dirname(dirname(dirname(__file__)))) | ||
user_preferences = context.preferences.addons[name].preferences | ||
|
||
filepath = join(user_preferences.global_dir, 'assets_model_patreon.json') | ||
with urllib.request.urlopen(utils.LOL_HOST_URL + "/assets_model_patreon.json", timeout=60) as request: | ||
assets = json.load(request) | ||
|
||
with open(filepath, 'w') as file: | ||
file.write(json.dumps(assets, indent=2)) | ||
|
||
filepath = join(user_preferences.global_dir, 'assets_model.json') | ||
with urllib.request.urlopen(utils.LOL_HOST_URL + "/assets_model.json", timeout=60) as request: | ||
assets = json.load(request) | ||
|
||
with open(filepath, 'w') as file: | ||
file.write(json.dumps(assets, indent=2)) | ||
|
||
filepath = join(user_preferences.global_dir, 'assets_material.json') | ||
with urllib.request.urlopen(utils.LOL_HOST_URL + "/assets_material.json", timeout=60) as request: | ||
assets = json.load(request) | ||
|
||
with open(filepath, 'w') as file: | ||
file.write(json.dumps(assets, indent=2)) | ||
|
||
return {'FINISHED'} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters