From 7880fb69682403442c96aa0eb03fdb2caeae55c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 20 Jul 2016 15:22:24 +0200 Subject: [PATCH] Added a group_hdri node type. This node type serves the same purpose for hdri as the group_texture serves for the texture nodes. --- .../modules/blender_cloud/texture_libs.py | 2 +- pillar/manage_extra/node_types/group_hdri.py | 22 +++++++++++++++++++ pillar/manage_extra/node_types/hdri.py | 4 +--- tests/test_bcloud_home_project.py | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 pillar/manage_extra/node_types/group_hdri.py diff --git a/pillar/application/modules/blender_cloud/texture_libs.py b/pillar/application/modules/blender_cloud/texture_libs.py index aa873ece..6bd302e4 100644 --- a/pillar/application/modules/blender_cloud/texture_libs.py +++ b/pillar/application/modules/blender_cloud/texture_libs.py @@ -101,7 +101,7 @@ def has_texture_node(proj, return_hdri=True): # See which types of nodes we support. node_types = ['group_texture'] if return_hdri: - node_types.append('hdri') + node_types.append('group_hdri') count = nodes_collection.count( {'node_type': {'$in': node_types}, diff --git a/pillar/manage_extra/node_types/group_hdri.py b/pillar/manage_extra/node_types/group_hdri.py new file mode 100644 index 00000000..b154db63 --- /dev/null +++ b/pillar/manage_extra/node_types/group_hdri.py @@ -0,0 +1,22 @@ +node_type_group_hdri = { + 'name': 'group_hdri', + 'description': 'Group for HDRi node type', + 'parent': ['group_hdri', 'project'], + 'dyn_schema': { + # Used for sorting within the context of a group + 'order': { + 'type': 'integer' + }, + 'status': { + 'type': 'string', + 'allowed': [ + 'published', + 'pending', + ], + } + }, + 'form_schema': { + 'status': {}, + 'order': {} + } +} diff --git a/pillar/manage_extra/node_types/hdri.py b/pillar/manage_extra/node_types/hdri.py index 1efa949f..20e3387e 100644 --- a/pillar/manage_extra/node_types/hdri.py +++ b/pillar/manage_extra/node_types/hdri.py @@ -5,9 +5,7 @@ node_type_hdri = { # bucket (https://cloud.google.com/storage/docs/cross-origin) 'name': 'hdri', 'description': 'HDR Image', - # This data type does not have parent limitations (can be child - # of any node). An empty parent declaration is required. - 'parent': ['group', ], + 'parent': ['group_hdri'], 'dyn_schema': { 'status': { 'type': 'string', diff --git a/tests/test_bcloud_home_project.py b/tests/test_bcloud_home_project.py index 1b282739..97aa2f75 100644 --- a/tests/test_bcloud_home_project.py +++ b/tests/test_bcloud_home_project.py @@ -442,7 +442,7 @@ class TextureLibraryTest(AbstractHomeProjectTest): self.create_node({'description': '', 'project': self.hdri_proj_id, - 'node_type': 'hdri', + 'node_type': 'group_hdri', 'user': user_id, 'properties': {'status': 'published', 'tags': [],