From 38f21ba535b5a31f066c53742e00242469e14eb9 Mon Sep 17 00:00:00 2001 From: Stacey Oue Date: Thu, 1 Oct 2020 09:58:02 -0400 Subject: [PATCH 1/4] Update to sync with tk-framework-widget PR #15 (#23) * Update SceneBrowserWidget to use the Worker's notifier to listen for completed and failed signals. * Update info.yml to require tk-framework-widget v1.x.x to include necessary update to Worker class. * Update test.yml with latest tk-framework-widget version. --- info.yml | 2 +- python/tk_multi_breakdown/scene_browser.py | 4 ++-- tests/fixtures/config/env/test.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/info.yml b/info.yml index 7057f56..be58d2d 100644 --- a/info.yml +++ b/info.yml @@ -48,5 +48,5 @@ supported_engines: # the frameworks required to run this app frameworks: - - {"name": "tk-framework-widget", "version": "v0.2.x"} + - {"name": "tk-framework-widget", "version": "v1.x.x"} - {"name": "tk-framework-shotgunutils", "version": "v5.x.x", "minimum_version": "v5.2.1"} diff --git a/python/tk_multi_breakdown/scene_browser.py b/python/tk_multi_breakdown/scene_browser.py index 8042837..950751c 100644 --- a/python/tk_multi_breakdown/scene_browser.py +++ b/python/tk_multi_breakdown/scene_browser.py @@ -48,10 +48,10 @@ def set_app(self, app): browser_widget.BrowserWidget.set_app(self, app) # For some reason connecting the worker signal directly to the child items' slots causes a # segmentation fault when there are many items. But re-emitting a local signal works fine - self._worker.work_completed.connect( + self._worker.notifier.work_completed.connect( lambda uid, data: self._item_work_completed.emit(uid, data) ) - self._worker.work_failure.connect( + self._worker.notifier.work_failure.connect( lambda uid, msg: self._item_work_failed.emit(uid, msg) ) diff --git a/tests/fixtures/config/env/test.yml b/tests/fixtures/config/env/test.yml index 710b8bf..ec110b9 100644 --- a/tests/fixtures/config/env/test.yml +++ b/tests/fixtures/config/env/test.yml @@ -10,7 +10,7 @@ engines: frameworks: - tk-framework-widget_v0.2.x: + tk-framework-widget_v1.x.x: location: {type: dev, path: '$SHOTGUN_REPOS_ROOT/tk-framework-widget' } tk-framework-shotgunutils_v5.x.x: location: {type: dev, path: '$SHOTGUN_REPOS_ROOT/tk-framework-shotgunutils' } From d0ed2f69212ccaacfd7ef3ee55c20cd32fc998b0 Mon Sep 17 00:00:00 2001 From: Philip Scadding Date: Wed, 9 Dec 2020 13:48:22 +0000 Subject: [PATCH 2/4] SG-20497 Fixes a bug with finding multiple instances of the same reference. (#24) * Fixes a bug with finding multiple instances of the same reference. When you have multiple instances of a reference in your scene, Maya adds a {x} to the end of the given file path where x is a number. This fix now asks for the path with out the copy number. * Switched maya command calls to using bools rather than ints for true. * Updated the test readme to explain how the tests now run with pytest. * Updated the tests to check that duplicate items with the same path get collected, although this change wouldn't have helped catch this bug. --- hooks/tk-maya_scene_operations.py | 8 ++-- tests/README.md | 11 +---- .../fixtures/config/hooks/scene_operations.py | 15 +++---- tests/test_breakdown.py | 41 +++++++++++-------- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/hooks/tk-maya_scene_operations.py b/hooks/tk-maya_scene_operations.py index 020b730..f45a8ca 100644 --- a/hooks/tk-maya_scene_operations.py +++ b/hooks/tk-maya_scene_operations.py @@ -44,12 +44,14 @@ def scan_scene(self): refs = [] # first let's look at maya references - for ref in cmds.file(q=1, reference=1): - node_name = cmds.referenceQuery(ref, referenceNode=1) + for ref in cmds.file(q=True, reference=True): + node_name = cmds.referenceQuery(ref, referenceNode=True) # get the path and make it platform dependent # (maya uses C:/style/paths) - maya_path = ref.replace("/", os.path.sep) + maya_path = cmds.referenceQuery( + ref, filename=True, withoutCopyNumber=True + ).replace("/", os.path.sep) refs.append({"node": node_name, "type": "reference", "path": maya_path}) # now look at file texture nodes diff --git a/tests/README.md b/tests/README.md index 80a7ac0..63eac4c 100644 --- a/tests/README.md +++ b/tests/README.md @@ -16,17 +16,10 @@ Users ``` ## Running the tests -Navigate to the `tests` folder in the tk-core repo, and execute the test runner. Point it -at the location of this app: +Navigate to the `tk-multi-breakdown` folder/repo, and execute pytest. -``` -cd /path/to/tk-core/tests -./run_tests.sh --test-root=/path/to/tk-multi-breakdown/tests -``` - -alternatively, to run it directly: ``` cd /path/to/tk-multi-breakdown -/path/to/tk-core/tests/run_tests.sh --test-root=./tests +pytest ``` diff --git a/tests/fixtures/config/hooks/scene_operations.py b/tests/fixtures/config/hooks/scene_operations.py index 3d33eea..ca8b9f9 100644 --- a/tests/fixtures/config/hooks/scene_operations.py +++ b/tests/fixtures/config/hooks/scene_operations.py @@ -44,13 +44,14 @@ def scan_scene(self): nodes.append( {"node": "outside_template_system", "type": "TestNode", "path": "/foo/bar"} ) - nodes.append( - { - "node": "maya_publish", - "type": "TestNode", - "path": os.environ["TEST_PATH_1"], - } - ) + for env_var in ["TEST_PATH_1", "TEST_PATH_1_DUPE"]: + nodes.append( + { + "node": "maya_publish", + "type": "TestNode", + "path": os.environ[env_var], + } + ) return nodes diff --git a/tests/test_breakdown.py b/tests/test_breakdown.py index 7ef0721..46506e4 100644 --- a/tests/test_breakdown.py +++ b/tests/test_breakdown.py @@ -145,6 +145,8 @@ def setUp(self): # this will be read by our hook so push # it out into env vars... os.environ["TEST_PATH_1"] = self.test_path_1 + # Add the same path twice ensure that it collects both + os.environ["TEST_PATH_1_DUPE"] = self.test_path_1 os.environ["TEST_PATH_2"] = self.test_path_2 def test_analyze_scene(self): @@ -152,25 +154,28 @@ def test_analyze_scene(self): Tests the analyze_scene method """ scene_data = self.app.analyze_scene() - self.assertEqual(len(scene_data), 1) - item = scene_data[0] - self.assertEqual( - item["fields"], - { - "Shot": "shot_code", - "name": "foo", - "Sequence": "seq_code", - "Step": "step_short_name", - "version": 3, - "maya_extension": "ma", - "eye": "%V", - }, - ) - self.assertEqual(item["node_name"], "maya_publish") - self.assertEqual(item["node_type"], "TestNode") - self.assertEqual(item["template"], self.tk.templates["maya_shot_publish"]) - self.assertEqual(item["sg_data"], None) + # There should be two identical items collected, + # because we provided two identical paths in the setup. + self.assertEqual(len(scene_data), 2) + + for item in scene_data: + self.assertEqual( + item["fields"], + { + "Shot": "shot_code", + "name": "foo", + "Sequence": "seq_code", + "Step": "step_short_name", + "version": 3, + "maya_extension": "ma", + "eye": "%V", + }, + ) + self.assertEqual(item["node_name"], "maya_publish") + self.assertEqual(item["node_type"], "TestNode") + self.assertEqual(item["template"], self.tk.templates["maya_shot_publish"]) + self.assertEqual(item["sg_data"], None) def test_compute_highest_version(self): """ From 566c5711e6ea8bd31bfc73f4d33328de4bf29dc7 Mon Sep 17 00:00:00 2001 From: Sergio Zamudio <43821765+zamu5@users.noreply.github.com> Date: Fri, 23 Apr 2021 17:52:20 -0500 Subject: [PATCH 3/4] SG-21701 Replace instances of Shotgun strings in .py files with "SG" (#25) --- hooks/tk-mari_scene_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/tk-mari_scene_operations.py b/hooks/tk-mari_scene_operations.py index 709805b..cb59994 100644 --- a/hooks/tk-mari_scene_operations.py +++ b/hooks/tk-mari_scene_operations.py @@ -122,7 +122,7 @@ def _update_geometry_items(self, items): sg_publish_data = found_publishes.get(publish_path) if not sg_publish_data: raise TankError( - "Failed to find Shotgun publish record for '%s'" % publish_path + "Failed to find SG publish record for '%s'" % publish_path ) # find geo in project: From ab9f67304ea0151e44b8fd11a36e9109bac22a75 Mon Sep 17 00:00:00 2001 From: Sergio Zamudio <43821765+zamu5@users.noreply.github.com> Date: Tue, 8 Jun 2021 08:49:01 -0500 Subject: [PATCH 4/4] sg-22648-shotgrid replace shotgun instances (#26) * sg-22648-shotgrid replace shotgun instances * sg-22648-shotgrid Update shotgunsoftware url Co-authored-by: Sergio Zamudio --- README.md | 4 ++-- hooks/tk-mari_scene_operations.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 51ce6ad..69f48f0 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ [![Linting](https://img.shields.io/badge/PEP8%20by-Hound%20CI-a873d1.svg)](https://houndci.com) ## Documentation -This repository is a part of the Shotgun Pipeline Toolkit. +This repository is a part of the ShotGrid Pipeline Toolkit. - For more information about this app and for release notes, *see the wiki section*. - For general information and documentation, click here: https://support.shotgunsoftware.com/entries/95441257 -- For information about Shotgun in general, click here: http://www.shotgunsoftware.com/toolkit +- For information about ShotGrid in general, click here: https://help.autodesk.com/view/SGSUB/ENU/ ## Using this app in your Setup All the apps that are part of our standard app suite are pushed to our App Store. diff --git a/hooks/tk-mari_scene_operations.py b/hooks/tk-mari_scene_operations.py index cb59994..9f53adb 100644 --- a/hooks/tk-mari_scene_operations.py +++ b/hooks/tk-mari_scene_operations.py @@ -111,7 +111,7 @@ def _update_geometry_items(self, items): self.parent.sgtk, all_paths, fields=fields ) except TankError as e: - raise TankError("Failed to query publishes from Shotgun: %s" % e) + raise TankError("Failed to query publishes from ShotGrid: %s" % e) # now we have all the info we need to update geometry: for item in items: