Use /bcloud/texture-library end point to fetch texture library projects.

This commit is contained in:
Sybren A. Stüvel 2016-05-18 12:50:51 +02:00
parent 5c7343f8c9
commit ba4c951d32
2 changed files with 8 additions and 7 deletions

View File

@ -96,8 +96,8 @@ class MenuItem:
self.label_text = label_text self.label_text = label_text
self._thumb_path = '' self._thumb_path = ''
self.icon = None self.icon = None
self._is_folder = node['node_type'] == 'group_texture' or \ self._is_folder = (node['node_type'] == 'group_texture' or
isinstance(node, SpecialFolderNode) isinstance(node, SpecialFolderNode))
self.thumb_path = thumb_path self.thumb_path = thumb_path
@ -310,6 +310,7 @@ class BlenderCloudBrowser(bpy.types.Operator):
# This can happen when the thumbnail information isn't loaded yet. # This can happen when the thumbnail information isn't loaded yet.
# Just ignore the click for now. # Just ignore the click for now.
# TODO: think of a way to handle this properly. # TODO: think of a way to handle this properly.
self.log.debug('Selected item %r has no file_desc', selected)
return {'RUNNING_MODAL'} return {'RUNNING_MODAL'}
self.handle_item_selection(context, selected) self.handle_item_selection(context, selected)
@ -496,7 +497,9 @@ class BlenderCloudBrowser(bpy.types.Operator):
elif project_uuid: elif project_uuid:
# Query for top-level nodes. # Query for top-level nodes.
self.log.debug('Getting subnodes for project node %r', project_uuid) self.log.debug('Getting subnodes for project node %r', project_uuid)
children = await pillar.get_nodes(project_uuid, '') children = await pillar.get_nodes(project_uuid=project_uuid,
parent_node_uuid='',
node_type='group_textures')
else: else:
# Query for projects # Query for projects
self.log.warning("Not node UUID and no project UUID, I can't do anything!") self.log.warning("Not node UUID and no project UUID, I can't do anything!")

View File

@ -275,10 +275,8 @@ async def get_texture_projects() -> list:
"""Returns project dicts that contain textures.""" """Returns project dicts that contain textures."""
try: try:
children = await pillar_call(pillarsdk.Project.all, { children = await pillar_call(pillarsdk.Project.all_from_endpoint,
'where': {'node_types.name': 'texture'}, '/bcloud/texture-libraries')
'sort': 'name',
})
except pillarsdk.ResourceNotFound as ex: except pillarsdk.ResourceNotFound as ex:
log.warning('Unable to find texture projects: %s', ex) log.warning('Unable to find texture projects: %s', ex)
raise PillarError('Unable to find texture projects: %s' % ex) raise PillarError('Unable to find texture projects: %s' % ex)