-
Notifications
You must be signed in to change notification settings - Fork 129
Maya looks: support for native Redshift texture format #2971
Changes from 2 commits
3770eb6
72b4522
e65a1ea
2406f78
be840d3
d4b8d47
abc299e
640415a
0bcf353
7bbf381
078775e
6ac5cd4
c43ec04
c36552e
92c1ac7
74f2c78
7b1346e
ae8ecfe
3c3be40
0bebd06
0100ea5
2102e4f
406ac82
710ed3a
68caaa7
a74e8c2
29b69bc
e78314c
00d877e
2933e40
b054175
fd3125d
41e7ac7
35be816
cfb9093
eb99944
77c15e0
8f8845e
e5fdd9e
ab14895
c471bbe
5f4d06b
9098822
9b0cc4d
c35f1cf
099dfba
8995dcd
787c797
3cd7fd5
ac0b931
0179c63
d28c7e1
9ec42cb
cc62035
09bbb30
ad8177c
7413ca6
590538e
035281f
18435fa
3728ce0
c9c2635
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import tempfile | ||
import contextlib | ||
import subprocess | ||
from openpype.lib.vendor_bin_utils import find_executable | ||
from collections import OrderedDict | ||
|
||
from maya import cmds # noqa | ||
|
@@ -42,6 +43,58 @@ def find_paths_by_hash(texture_hash): | |
return io.distinct(key, {"type": "version"}) | ||
|
||
|
||
def rstex(source, *args): | ||
"""Make `.rstexbin` using `redshiftTextureProcessor` | ||
with some default settings. | ||
|
||
This function requires the `REDSHIFT_COREDATAPATH` | ||
to be in `PATH`. | ||
|
||
Args: | ||
source (str): Path to source file. | ||
*args: Additional arguments for `redshiftTextureProcessor`. | ||
|
||
Returns: | ||
str: Output of `redshiftTextureProcessor` command. | ||
|
||
""" | ||
if "REDSHIFT_COREDATAPATH" not in os.environ: | ||
raise RuntimeError("Must have Redshift available.") | ||
|
||
redshift_bin_path = os.path.join( | ||
os.environ["REDSHIFT_COREDATAPATH"], | ||
"bin", | ||
"redshiftTextureProcessor" | ||
) | ||
|
||
texture_processor_path = find_executable(redshift_bin_path) | ||
|
||
cmd = [ | ||
texture_processor_path, | ||
escape_space(source), | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. He's right There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Damn it skipped a line, fixed now. Thank you! |
||
] | ||
|
||
cmd.extend(args) | ||
|
||
cmd = " ".join(cmd) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Few notes that are connected to each other:
At this stage are these notes just recommendation because I don't know how it will be used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! This is helpful, makes me think whether we should consider refactoring the Will hop on to something else in the meantime. I appreciate your time! |
||
|
||
CREATE_NO_WINDOW = 0x08000000 | ||
kwargs = dict(args=cmd, stderr=subprocess.STDOUT) | ||
|
||
if sys.platform == "win32": | ||
kwargs["creationflags"] = CREATE_NO_WINDOW | ||
try: | ||
out = subprocess.check_output(**kwargs) | ||
except subprocess.CalledProcessError as exc: | ||
print(exc) | ||
import traceback | ||
|
||
traceback.print_exc() | ||
raise | ||
return out | ||
|
||
|
||
def maketx(source, destination, *args): | ||
"""Make `.tx` using `maketx` with some default settings. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I think we should validate this environment during validation, only when is needed if it's possible to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see! Thank you, I'll take a look about moving that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's something I don't know. Maybe it's not needed or impossible to validate before this plugin, can't tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more complex as this is set only if studio is using and has configured Redshift. So I think the logic should be - add option
make redshift texture
on the same place as we have with make tx (look instance) and then probably have validator that will run on look family and will validate this env var.