2020-11-11 14:09:57 +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 3 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, see <https://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
|
|
|
|
import bpy
|
|
|
|
import mathutils
|
|
|
|
|
|
|
|
from .dump_anything import Dumper, Loader, np_dump_collection, np_load_collection
|
|
|
|
from .bl_datablock import BlDatablock
|
2021-02-26 10:38:50 +01:00
|
|
|
from .bl_material import (dump_node_tree,
|
|
|
|
load_node_tree,
|
2020-11-11 14:09:57 +01:00
|
|
|
get_node_tree_dependencies)
|
|
|
|
|
|
|
|
class BlNodeGroup(BlDatablock):
|
|
|
|
bl_id = "node_groups"
|
2021-02-26 10:38:50 +01:00
|
|
|
bl_class = bpy.types.NodeTree
|
2020-11-11 14:09:57 +01:00
|
|
|
bl_check_common = False
|
|
|
|
bl_icon = 'NODETREE'
|
2020-12-09 14:49:26 +01:00
|
|
|
bl_reload_parent = False
|
2020-11-11 14:09:57 +01:00
|
|
|
|
2021-03-26 12:30:15 +01:00
|
|
|
def construct(data: dict) -> object:
|
2020-11-11 14:09:57 +01:00
|
|
|
return bpy.data.node_groups.new(data["name"], data["type"])
|
|
|
|
|
2021-03-26 12:30:15 +01:00
|
|
|
def load(data: dict, datablock: object):
|
2021-02-26 10:38:50 +01:00
|
|
|
load_node_tree(data, target)
|
2020-11-11 14:09:57 +01:00
|
|
|
|
2021-03-26 12:30:15 +01:00
|
|
|
def dump(datablock: object) -> dict:
|
2021-02-26 10:38:50 +01:00
|
|
|
return dump_node_tree(instance)
|
2020-11-11 14:09:57 +01:00
|
|
|
|
2021-03-25 14:55:53 +01:00
|
|
|
@staticmethod
|
2021-03-26 12:30:15 +01:00
|
|
|
def resolve_deps(datablock: object) -> [object]:
|
2021-03-25 14:55:53 +01:00
|
|
|
return get_node_tree_dependencies(datablock)
|