Texture browser: Don't use file name as menu item label.

Just using the node name is clearer, as it only depends on the node, and
no longer on the linked files themselves. This also makes it easier to
get compatible with HDRi nodes (as those files won't be named
"{name}-{maptype}".
This commit is contained in:
Sybren A. Stüvel 2016-07-20 16:02:56 +02:00
parent 70a0aba10a
commit b04f9adb40

View File

@ -135,7 +135,7 @@ class MenuItem:
def node_uuid(self) -> str: def node_uuid(self) -> str:
return self.node['_id'] return self.node['_id']
def update(self, node, file_desc, thumb_path: str, label_text): def update(self, node, file_desc, thumb_path: str, label_text=None):
# We can get updated information about our Node, but a MenuItem should # We can get updated information about our Node, but a MenuItem should
# always represent one node, and it shouldn't be shared between nodes. # always represent one node, and it shouldn't be shared between nodes.
if self.node_uuid != node['_id']: if self.node_uuid != node['_id']:
@ -144,7 +144,9 @@ class MenuItem:
self.node = node self.node = node
self.file_desc = file_desc # pillarsdk.File object, or None if a 'folder' node. self.file_desc = file_desc # pillarsdk.File object, or None if a 'folder' node.
self.thumb_path = thumb_path self.thumb_path = thumb_path
self.label_text = label_text
if label_text is not None:
self.label_text = label_text
@property @property
def is_folder(self) -> bool: def is_folder(self) -> bool:
@ -471,7 +473,7 @@ class BlenderCloudBrowser(pillar.PillarOperatorMixin,
self.add_menu_item(node, None, 'SPINNER', texture_node['name']) self.add_menu_item(node, None, 'SPINNER', texture_node['name'])
def thumbnail_loaded(node, file_desc, thumb_path): def thumbnail_loaded(node, file_desc, thumb_path):
self.update_menu_item(node, file_desc, thumb_path, file_desc['filename']) self.update_menu_item(node, file_desc, thumb_path)
project_uuid = self.current_path.project_uuid project_uuid = self.current_path.project_uuid
node_uuid = self.current_path.node_uuid node_uuid = self.current_path.node_uuid