Files
multi-user/multi_user/io_bpy/bl_node_group.py

46 lines
1.6 KiB
Python
Raw Normal View History

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
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"
bl_class = bpy.types.NodeTree
2020-11-11 14:09:57 +01:00
bl_check_common = False
bl_icon = 'NODETREE'
bl_reload_parent = False
2020-11-11 14:09:57 +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"])
def load(data: dict, datablock: object):
load_node_tree(data, target)
2020-11-11 14:09:57 +01:00
def dump(datablock: object) -> dict:
return dump_node_tree(instance)
2020-11-11 14:09:57 +01:00
@staticmethod
def resolve_deps(datablock: object) -> [object]:
return get_node_tree_dependencies(datablock)