forked from pyblish/pyblish-hiero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ae7b2e
commit 8af56e2
Showing
6 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.pyc | ||
._* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# pyblish-hiero | ||
Pyblish for Hiero | ||
|
||
This page will walk you through integrating Pyblish with Foundry Hiero. | ||
|
||
### Prerequisities | ||
|
||
Make sure you have installed Pyblish before continuing. | ||
|
||
- See [Installing Pyblish](https://github.com/pyblish/pyblish/wiki/Installation) | ||
|
||
### Introduction | ||
|
||
The integration comes in the form of a menu-item called *"Publish"*, located directly under `File`. | ||
|
||
Once clicked, it will display a Pyblish graphical user interface. | ||
|
||
### Installation | ||
|
||
Ensure Pyblish for Hiero is on your `PYTHONPATH` and run this within Hiero. | ||
|
||
```python | ||
import pyblish_hiero | ||
pyblish_hiero.setup() | ||
``` | ||
|
||
You can then show the Pyblish graphical user interface by calling `show()`. | ||
|
||
```python | ||
pyblish_hiero.show() | ||
``` | ||
|
||
### Persistence | ||
|
||
It is recommended that you allow Pyblish to load upon launching Hiero. | ||
For this to work, add the `pyblish_hiero/hiero_plugin_path` directory to your `HIERO_PLUGIN_PATH` | ||
|
||
(2) You can find your `pythonpath` directory here: | ||
|
||
```bash | ||
pyblish-hiero/pyblish_hiero/hiero_plugin_path | ||
``` | ||
|
||
As you will find, this directory contains sub-directories leading to two python files; `pyblish_startup.py` and `active_project_tracker.py`. | ||
|
||
**pyblish_startup.py** | ||
|
||
This sets up Pyblish similar to `pyblish_hiero.setup()` | ||
|
||
**active_project_tracker** | ||
|
||
This ensures that you can access the active project outside of Hiero, via `hiero.activeProject`. This is also injected into the context, so you can easily access the active project with `context.data('activeProject')` |
28 changes: 28 additions & 0 deletions
28
pyblish_hiero/hiero_plugin_path/Python/Startup/active_project_tracker.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Puts the active project into 'hiero.activeProject' | ||
""" | ||
|
||
import os | ||
|
||
import hiero | ||
|
||
def selectionChanged(event): | ||
selection = event.sender.selection() | ||
binSelection = selection | ||
if len(binSelection)>0 and hasattr(binSelection[0],'project'): | ||
hiero.activeProject = binSelection[0].project() | ||
|
||
hiero.core.events.registerInterest('kSelectionChanged', selectionChanged) | ||
|
||
def projectCreated(event): | ||
hiero.activeProject = event.sender | ||
|
||
hiero.core.events.registerInterest('kAfterNewProjectCreated', projectCreated) | ||
|
||
def projectLoad(event): | ||
basename = os.path.basename(event.sender.path()) | ||
print event.sender.path() | ||
if basename != 'HieroPresets.hrox': | ||
hiero.activeProject = event.sender | ||
|
||
hiero.core.events.registerInterest('kAfterProjectLoad', projectLoad) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pyblish.api | ||
|
||
import hiero | ||
|
||
|
||
@pyblish.api.log | ||
This comment has been minimized.
Sorry, something went wrong.
mottosso
|
||
class CollectActiveProject(pyblish.api.Collector): | ||
"""Inject the active project into context""" | ||
|
||
version = (0, 1, 0) | ||
order = pyblish.api.Collector.order - 0.1 | ||
|
||
def process(self, context): | ||
|
||
context.set_data('activeProject', value=hiero.activeProject) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Don't forget about linting, there should be two newlines here.