diff --git a/pype/tools/standalonepublish/app.py b/pype/tools/standalonepublish/app.py index f39f553828..0e8bfaacc1 100644 --- a/pype/tools/standalonepublish/app.py +++ b/pype/tools/standalonepublish/app.py @@ -148,7 +148,8 @@ class Window(QtWidgets.QDialog): data = {} data.update(self.widget_assets.collect_data()) data.update(self.widget_family.collect_data()) - + data.update(self.widget_components.collect_data()) + return data def show(parent=None, debug=False, context=None): diff --git a/pype/tools/standalonepublish/widgets/widget_asset.py b/pype/tools/standalonepublish/widgets/widget_asset.py index 82b3700dea..366fb88dfa 100644 --- a/pype/tools/standalonepublish/widgets/widget_asset.py +++ b/pype/tools/standalonepublish/widgets/widget_asset.py @@ -179,12 +179,24 @@ class AssetWidget(QtWidgets.QWidget): return self.parent_widget.db def collect_data(self): + project = self.db.find_one({'type': 'project'}) + asset = self.db.find_one({'_id': self.get_active_asset()}) data = { - 'project': self.combo_projects.currentText(), - 'asset': get_active_asset + 'project': project, + 'asset': asset, + 'parents': self.get_parents(asset) } return data + def get_parents(self, entity): + output = [] + if entity.get('data', {}).get('visualParent', None) is None: + return output + parent = self.db.find_one({'_id': entity['data']['visualParent']}) + output.append(parent) + output.extend(self.get_parents(parent)) + return output + def _set_projects(self): projects = list() for project in self.db.projects(): diff --git a/pype/tools/standalonepublish/widgets/widget_component_item.py b/pype/tools/standalonepublish/widgets/widget_component_item.py index f7221952af..9551f4cae6 100644 --- a/pype/tools/standalonepublish/widgets/widget_component_item.py +++ b/pype/tools/standalonepublish/widgets/widget_component_item.py @@ -230,3 +230,13 @@ class ComponentItem(QtWidgets.QFrame): def change_preview(self, hover=True): self.preview.change_checked(hover) + + def collect_data(self): + data = { + 'ext': self.in_data['ext'], + 'representation': self.input_repre.text(), + 'files': self.in_data['files'], + 'thumbnail': self.is_thumbnail(), + 'preview': self.is_preview() + } + return data diff --git a/pype/tools/standalonepublish/widgets/widget_components.py b/pype/tools/standalonepublish/widgets/widget_components.py index 9d9f2aeb22..b17f8d5ebc 100644 --- a/pype/tools/standalonepublish/widgets/widget_components.py +++ b/pype/tools/standalonepublish/widgets/widget_components.py @@ -45,6 +45,9 @@ class ComponentsWidget(QtWidgets.QWidget): def process_mime_data(self, mime_data): self.drop_frame.process_ent_mime(mime_data) + def collect_data(self): + return self.drop_frame.collect_data() + def _browse(self): options = [ QtWidgets.QFileDialog.DontResolveSymlinks, diff --git a/pype/tools/standalonepublish/widgets/widget_drop_frame.py b/pype/tools/standalonepublish/widgets/widget_drop_frame.py index e13a7c476c..9b0d49b744 100644 --- a/pype/tools/standalonepublish/widgets/widget_drop_frame.py +++ b/pype/tools/standalonepublish/widgets/widget_drop_frame.py @@ -313,3 +313,9 @@ class DropDataFrame(QtWidgets.QFrame): if found is False: self._add_item(data) + + def collect_data(self): + data = {'components' : []} + for item in self.items: + data['components'].append(item.collect_data()) + return data