Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit f87819e
Author: Jérôme LORRAIN <[email protected]>
Date:   Mon Dec 20 16:25:01 2021 +0100

    add_published_workfiles_option

commit 40ed1de
Merge: 373217b 512bf2e
Author: pypebot <[email protected]>
Date:   Wed Dec 15 04:41:41 2021 +0100

    [Automated] Merged main into develop

commit 512bf2e
Author: OpenPype <[email protected]>
Date:   Wed Dec 15 03:41:30 2021 +0000

    [Automated] Bump version

commit 39bddac
Merge: ea03444 373217b
Author: pypebot <[email protected]>
Date:   Wed Dec 15 04:35:02 2021 +0100

    [Automated] Merged develop into main

commit 373217b
Merge: 897fa65 00b1430
Author: Jakub Trllo <[email protected]>
Date:   Tue Dec 14 18:03:57 2021 +0100

    Merge pull request ynput#2404 from pypeclub/feature/OP-1165_Sync-to-avalon-does-not-check-existence-of-entity-type

    Ftrack: Check existence of object type on recreation

commit 897fa65
Merge: d69d8f3 c4106bf
Author: Jakub Trllo <[email protected]>
Date:   Tue Dec 14 18:03:46 2021 +0100

    Merge pull request ynput#2399 from pypeclub/bugfix/placeholder_palette_change_fix

    Fix: Placeholder Input color set fix

commit d69d8f3
Merge: a4be22c 0b6e2f3
Author: Jakub Trllo <[email protected]>
Date:   Tue Dec 14 18:03:37 2021 +0100

    Merge pull request ynput#2377 from pypeclub/feature/OP-2092_Blender-30-OP-is-not-integrated

    Blender 3: Support auto install for new blender version

commit a4be22c
Merge: b8fadc6 68b9939
Author: Jakub Trllo <[email protected]>
Date:   Tue Dec 14 17:34:22 2021 +0100

    Merge pull request ynput#2382 from pypeclub/feature/OP-2001_Settings-Copypaste-project-settings-to-another-project

    Enhancement: Settings: Use project settings values from another project

commit 68b9939
Author: iLLiCiTiT <[email protected]>
Date:   Tue Dec 14 15:35:39 2021 +0100

    modified message

commit b8fadc6
Merge: 1b6c551 2c66a1e
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:31:58 2021 +0100

    Merge pull request ynput#2387 from pypeclub/feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE

    Add validator to check correct version of extension for PS and AE

commit 2c66a1e
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:31:03 2021 +0100

    OP-2053 - fix PS after merge

commit 450dbf3
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:29:42 2021 +0100

    OP-2053 - fix PS after merge

commit 0cd9502
Merge: 1cbcdba b97d79d
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:27:14 2021 +0100

    Merge remote-tracking branch 'origin/feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE' into feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE

commit 1cbcdba
Merge: 621118c ca7a92b
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:26:15 2021 +0100

    OP-2053 - merge develop

commit 1b6c551
Merge: ca7a92b a6a7348
Author: Jakub Trllo <[email protected]>
Date:   Tue Dec 14 15:23:43 2021 +0100

    Merge pull request ynput#2403 from pypeclub/bugfix/OP-1780_set_global_environments-fails-with-addons

    General: Fix access to environments from default settings

commit b97d79d
Merge: 61bf279 ca7a92b
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:19:53 2021 +0100

    Merge branch 'develop' into feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE

commit ca7a92b
Merge: ad51cd8 b57a09b
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:17:36 2021 +0100

    Merge pull request ynput#2270 from pypeclub/feature/OP-2019_Create-test-publish-class-for-AE

    Create test publish class for After Effects

commit b57a09b
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:16:48 2021 +0100

    OP-2019 - revert unwanted commit

commit c0bacd5
Merge: 2e753e1 ad51cd8
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 15:13:34 2021 +0100

    OP-2019 - merge develop

commit ad51cd8
Merge: feefe11 9318965
Author: Ondřej Samohel <[email protected]>
Date:   Tue Dec 14 13:57:24 2021 +0100

    Merge pull request ynput#2356 from Ellipsanime/maya-ImagePlaneLoader-load-blueprint

    Maya: Add is_static_image_plane and is_in_all_views option in imagePlaneLoader

commit feefe11
Merge: d74ba7f 09bbeba
Author: Ondřej Samohel <[email protected]>
Date:   Tue Dec 14 13:52:07 2021 +0100

    Merge pull request ynput#2375 from Ellipsanime/maya-add-render-image-path-to-settings

    Maya add render image path to settings

commit d74ba7f
Merge: bfbd8bd c78d4d8
Author: Ondřej Samohel <[email protected]>
Date:   Tue Dec 14 13:49:57 2021 +0100

    Merge pull request ynput#2394 from Ellipsanime/CollectLook-fix-getattr

    [Fix][MAYA] Handle message type attribute within CollectLook

commit bfbd8bd
Merge: 3b9db7d ebbd43b
Author: Ondřej Samohel <[email protected]>
Date:   Tue Dec 14 13:46:50 2021 +0100

    Merge pull request ynput#2384 from pypeclub/enhancement/centos7-add-xcb-to-pyside2

    Centos 7 dependency compatibility

commit ebbd43b
Author: Ondřej Samohel <[email protected]>
Date:   Tue Dec 14 13:46:34 2021 +0100

    Update Dockerfile.centos7

    Co-authored-by: Jakub Trllo <[email protected]>

commit 00b1430
Author: iLLiCiTiT <[email protected]>
Date:   Tue Dec 14 11:48:55 2021 +0100

    check existence of entity type on recreation and use Folder if not found

commit 0ff12fd
Author: iLLiCiTiT <[email protected]>
Date:   Tue Dec 14 11:48:23 2021 +0100

    cache object types

commit 61bf279
Merge: 621118c 3b9db7d
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 11:28:30 2021 +0100

    Merge branch 'develop' into feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE

commit 621118c
Merge: b2644d3 02717fa
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 11:25:16 2021 +0100

    Merge remote-tracking branch 'origin/feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE' into feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE

commit b2644d3
Merge: aa232b4 8739dd9
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 11:23:44 2021 +0100

    Merge remote-tracking branch 'origin/feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE' into feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE

commit aa232b4
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 11:13:02 2021 +0100

    OP-2053 - fix counts in db_asserts

commit 02717fa
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 11:15:51 2021 +0100

    Update error msg format

    Co-authored-by: Jakub Trllo <[email protected]>

commit 8739dd9
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 11:13:02 2021 +0100

    OP-2053 - fix counts in db_asserts

commit a6a7348
Author: iLLiCiTiT <[email protected]>
Date:   Tue Dec 14 11:12:06 2021 +0100

    fix access to default settings in get_general_environments

commit 148bb47
Author: Petr Kalis <[email protected]>
Date:   Tue Dec 14 10:54:10 2021 +0100

    OP-2053 - allow injection of AVALON_DB env var as a db

commit 0b6e2f3
Author: iLLiCiTiT <[email protected]>
Date:   Mon Dec 6 12:24:02 2021 +0100

    modified version regex for installation of PySide2 into blender

commit c4106bf
Author: iLLiCiTiT <[email protected]>
Date:   Mon Dec 13 14:01:28 2021 +0100

    set placeholder font color on initialization instead of after show

commit c78d4d8
Author: Jérôme LORRAIN <[email protected]>
Date:   Mon Dec 13 10:45:30 2021 +0100

    Handle message type attribute

commit 09bbeba
Author: Jérôme LORRAIN <[email protected]>
Date:   Fri Dec 10 15:14:03 2021 +0100

    Add settings to repair

commit a80ed0d
Author: Petr Kalis <[email protected]>
Date:   Thu Dec 9 14:25:24 2021 +0100

    OP-2053 - Hound

commit 2673b58
Author: Petr Kalis <[email protected]>
Date:   Thu Dec 9 14:01:28 2021 +0100

    OP-2053 - added possibility to check installed extension version

commit 2a540cd
Merge: 5dc2fd0 2e753e1
Author: Petr Kalis <[email protected]>
Date:   Thu Dec 9 13:34:34 2021 +0100

    Merge branch 'feature/OP-2019_Create-test-publish-class-for-AE' into feature/OP-2053_Add-validator-to-check-correct-version-of-extension-for-PS-and-AE

commit 5dc2fd0
Author: Petr Kalis <[email protected]>
Date:   Wed Dec 8 19:00:44 2021 +0100

    OP-2053 - bump down order of collector for current file

    It depends on valid extension

commit 97404ab
Author: Petr Kalis <[email protected]>
Date:   Wed Dec 8 19:00:12 2021 +0100

    OP-2053 - added check of installed extension for PS

commit 6ed4db4
Author: Ondrej Samohel <[email protected]>
Date:   Wed Dec 8 17:11:45 2021 +0100

    installand copy xcb libs to pyside2 inside openpype

commit 8e71919
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 13:25:22 2021 +0100

    skip action if does not have any projects which can be used as source for values

commit 8270f2f
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 13:07:57 2021 +0100

    catch exceptions happened during applying values from different project

commit c08b467
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 13:07:38 2021 +0100

    use defined constant for default project label

commit 2fdac86
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 13:00:07 2021 +0100

    initial version of applying settings from different project

commit e2f24fb
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 12:59:42 2021 +0100

    project category widget has ability to retrieve project names

commit 74b6da9
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 12:59:21 2021 +0100

    added method to return project names from project list

commit 347b8da
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 12:59:01 2021 +0100

    use working_state_context for current actions

commit b3d2d41
Author: iLLiCiTiT <[email protected]>
Date:   Wed Dec 8 12:58:37 2021 +0100

    added working state context to category widget

commit 7e04079
Author: Jérôme LORRAIN <[email protected]>
Date:   Mon Dec 6 14:07:01 2021 +0100

    Update error message

commit ca1516f
Author: Jérôme LORRAIN <[email protected]>
Date:   Mon Dec 6 10:45:22 2021 +0100

    Fix syntax

commit b3ec2fe
Author: Jérôme LORRAIN <[email protected]>
Date:   Mon Dec 6 10:28:56 2021 +0100

    Use the setting in CollectRender

commit 89490f4
Author: Jérôme LORRAIN <[email protected]>
Date:   Fri Dec 3 17:22:27 2021 +0100

    add maya default render folder path to settings

commit 2e753e1
Author: Petr Kalis <[email protected]>
Date:   Fri Dec 3 14:39:49 2021 +0100

    OP-2019 - fixes for db_asserts

commit 477d177
Author: Petr Kalis <[email protected]>
Date:   Fri Dec 3 11:42:22 2021 +0100

    OP-2019 - fixes for PS test class

commit f9a1445
Author: Petr Kalis <[email protected]>
Date:   Fri Dec 3 10:28:41 2021 +0100

    OP-2019 - revert to develop version

commit 07fdcc6
Author: Petr Kalis <[email protected]>
Date:   Thu Dec 2 19:07:46 2021 +0100

    OP-2019 - fixed wrong value

commit 9318965
Author: clement.hector <[email protected]>
Date:   Thu Dec 2 12:34:34 2021 +0100

    add fileName in imagePlane cmd

commit 3c7b622
Author: clement.hector <[email protected]>
Date:   Thu Dec 2 11:53:32 2021 +0100

    fix rotation after detach

commit 3d6bf6e
Author: clement.hector <[email protected]>
Date:   Wed Dec 1 18:56:38 2021 +0100

    change option by options

commit 64c4e5f
Author: clement.hector <[email protected]>
Date:   Wed Dec 1 16:42:18 2021 +0100

    Add static and allView option in imagePlaneLoader
  • Loading branch information
jlorrain authored and ClementHector committed Jan 6, 2022
1 parent 52a3637 commit 947f929
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 58 deletions.
173 changes: 118 additions & 55 deletions openpype/tools/workfiles/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from openpype.tools.utils.lib import (
qt_app_context
)
from openpype.api import get_project_settings
from openpype.lib.profiles_filtering import filter_profiles
from openpype.tools.utils import PlaceholderLineEdit
from openpype.tools.utils.assets_widget import SingleSelectAssetsWidget
from openpype.tools.utils.tasks_widget import TasksWidget
Expand Down Expand Up @@ -58,56 +60,8 @@ def __init__(self, parent, root, anatomy, template_key, session=None):
# Fallback to active session
session = api.Session

# Set work file data for template formatting
asset_name = session["AVALON_ASSET"]
task_name = session["AVALON_TASK"]
project_doc = io.find_one(
{"type": "project"},
{
"name": True,
"data.code": True,
"config.tasks": True,
}
)

asset_doc = io.find_one(
{
"type": "asset",
"name": asset_name
},
{
"data.tasks": True,
"data.parents": True
}
)

task_type = asset_doc["data"]["tasks"].get(task_name, {}).get("type")

project_task_types = project_doc["config"]["tasks"]
task_short = project_task_types.get(task_type, {}).get("short_name")

asset_parents = asset_doc["data"]["parents"]
parent_name = project_doc["name"]
if asset_parents:
parent_name = asset_parents[-1]

self.data = {
"project": {
"name": project_doc["name"],
"code": project_doc["data"].get("code")
},
"asset": asset_name,
"task": {
"name": task_name,
"type": task_type,
"short": task_short,
},
"parent": parent_name,
"version": 1,
"user": getpass.getuser(),
"comment": "",
"ext": None
}
self.data = _get_anatomy_data(session)
self.data['version'] = 1

# Store project anatomy
self.anatomy = anatomy
Expand Down Expand Up @@ -360,6 +314,7 @@ def __init__(self, parent=None):
self._asset_doc = None
self._task_name = None
self._task_type = None
self._published = False

# Pype's anatomy object for current project
self.anatomy = Anatomy(io.Session["AVALON_PROJECT"])
Expand All @@ -381,8 +336,8 @@ def __init__(self, parent=None):
files_view = FilesView(self)

# Create the Files model
extensions = set(self.host.file_extensions())
files_model = FilesModel(file_extensions=extensions)
self.extensions = set(self.host.file_extensions())
files_model = FilesModel(file_extensions=self.extensions)

# Create proxy model for files to be able sort and filter
proxy_model = QtCore.QSortFilterProxyModel()
Expand All @@ -405,10 +360,14 @@ def __init__(self, parent=None):
files_view.setColumnWidth(0, 330)

# Filtering input
filter_input = PlaceholderLineEdit(self)
filter_widget = QtWidgets.QWidget(self)
filter_input = PlaceholderLineEdit(self, filter_widget)
filter_input.setPlaceholderText("Filter files..")
filter_input.textChanged.connect(proxy_model.setFilterFixedString)

published_checkbox = QtWidgets.QCheckBox("Published", filter_widget)
published_checkbox.stateChanged.connect(self.on_published_pressed)

# Home Page
# Build buttons widget for files widget
btns_widget = QtWidgets.QWidget(self)
Expand All @@ -422,10 +381,15 @@ def __init__(self, parent=None):
btns_layout.addWidget(btn_browse)
btns_layout.addWidget(btn_save)

filter_layout = QtWidgets.QHBoxLayout(filter_widget)
filter_layout.setContentsMargins(0, 0, 0, 0)
filter_layout.addWidget(published_checkbox)
filter_layout.addWidget(filter_input)

# Build files widgets for home page
main_layout = QtWidgets.QVBoxLayout(self)
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.addWidget(filter_input)
main_layout.addWidget(filter_widget)
main_layout.addWidget(files_view)
main_layout.addWidget(btns_widget)

Expand Down Expand Up @@ -465,7 +429,11 @@ def set_asset_task(self, asset_id, task_name, task_type):
# This way we can browse it even before we enter it.
if self._asset_id and self._task_name and self._task_type:
session = self._get_session()
self.root = self.host.work_root(session)
if not self._published:
self.root = self.host.work_root(session)
else:
self.root = self._get_published_root(session)

self.files_model.set_root(self.root)

else:
Expand All @@ -487,6 +455,34 @@ def _get_asset_doc(self):
self._asset_doc = io.find_one({"_id": self._asset_id})
return self._asset_doc

def _get_published_root(self, session):

settings = get_project_settings(session["AVALON_PROJECT"])
template_name_profiles = settings.get('global') \
.get('publish') \
.get('IntegrateAssetNew') \
.get('template_name_profiles')
key_values = {
"families": "workfile",
"tasks": self._task_name,
"hosts": self.host,
"task_types": self._task_type
}
profile = filter_profiles(
template_name_profiles,
key_values
)
data = _get_anatomy_data(session)
data["ext"] = self.extensions
anatomy_filled = self.anatomy.format(data)
anatomy_filled.strict = False
folder = anatomy_filled[profile["template_name"]]['folder']

if "{version}" in folder:
folder = folder.replace("{version}", "*")

return folder

def _get_session(self):
"""Return a modified session for the current asset and task"""

Expand Down Expand Up @@ -621,6 +617,19 @@ def _get_selected_filepath(self):

return index.data(self.files_model.FilePathRole)

def on_published_pressed(self, state):
if state == 0:
self._published = False
self.files_model.published = False
self.btn_save.show()
self.btn_browse.show()
elif state == 2:
self._published = True
self.files_model.published = True
self.btn_save.hide()
self.btn_browse.hide()
self.set_asset_task(self._asset_id, self._task_name, self._task_type)

def on_open_pressed(self):
path = self._get_selected_filepath()
if not path:
Expand Down Expand Up @@ -1125,6 +1134,60 @@ def validate_host_requirements(host):
return True


def _get_anatomy_data(session):
# Set work file data for template formatting
asset_name = session["AVALON_ASSET"]
task_name = session["AVALON_TASK"]
project_doc = io.find_one(
{"type": "project"},
{
"name": True,
"data.code": True,
"config.tasks": True,
}
)

asset_doc = io.find_one(
{
"type": "asset",
"name": asset_name
},
{
"data.tasks": True,
"data.parents": True
}
)

task_type = asset_doc["data"]["tasks"].get(task_name, {}).get("type")

project_task_types = project_doc["config"]["tasks"]
task_short = project_task_types.get(task_type, {}).get("short_name")

asset_parents = asset_doc["data"]["parents"]
parent_name = project_doc["name"]
if asset_parents:
parent_name = asset_parents[-1]
hierarchy = "/".join(asset_parents)

return {
"project": {
"name": project_doc["name"],
"code": project_doc["data"].get("code")
},
"asset": asset_name,
"task": {
"name": task_name,
"type": task_type,
"short": task_short,
},
"parent": parent_name,
"user": getpass.getuser(),
"comment": "",
"ext": None,
"hierarchy": hierarchy
}


def show(root=None, debug=False, parent=None, use_context=True, save=True):
"""Show Work Files GUI"""
# todo: remove `root` argument to show()
Expand Down
10 changes: 7 additions & 3 deletions openpype/tools/workfiles/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import glob
import logging

from Qt import QtCore, QtGui
Expand All @@ -18,6 +19,7 @@ class FilesModel(TreeModel):
DateModifiedRole = QtCore.Qt.UserRole + 3
FilePathRole = QtCore.Qt.UserRole + 4
IsEnabled = QtCore.Qt.UserRole + 5
published = False

def __init__(self, file_extensions, parent=None):
super(FilesModel, self).__init__(parent=parent)
Expand Down Expand Up @@ -55,7 +57,7 @@ def refresh(self):
self.endResetModel()
return

if not os.path.exists(root):
if not self.published and not os.path.exists(root):
# Add Work Area does not exist placeholder
log.debug("Work Area does not exist: %s", root)
message = "Work Area does not exist. Use Save As to create it."
Expand All @@ -72,8 +74,10 @@ def refresh(self):

extensions = self._file_extensions

for filename in os.listdir(root):
path = os.path.join(root, filename)
root = os.path.join(root, "*")
for path in glob.glob(root):
print(path)
filename = os.path.basename(path)
if os.path.isdir(path):
continue

Expand Down

0 comments on commit 947f929

Please sign in to comment.