-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support to export texture sets as single output per texture map #25
base: develop
Are you sure you want to change the base?
Support to export texture sets as single output per texture map #25
Conversation
I made this draft as it hits stones during the testing in my side. |
# Function to remove textureSet from filepath | ||
def remove_texture_set_token(filepath, texture_set): | ||
return filepath.replace(texture_set, '') |
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.
Why do we need this? Do we care about the texture set name at all?
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.
We need to have new filename for the single output :).
# Store the instance in the original instance as a member | ||
instance.append(image_instance) | ||
|
||
def create_image_instance_by_map_filtering(self, instance, outputs, |
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.
Why does this need a completely isolated function? Seems like a LOT of duplicated code? Why can't de-duplicate and only change what is actually different?
What makes this so massively different?
) | ||
|
||
|
||
def convert_texture_maps_for_udim_export(staging_dir, image_outputs, has_udim=False): |
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 function name is confusing - it doesn't 'convert' anything. It just gets the sequence filepaths. Please add a docstring, return type and improve function name,
oiio_cmd = oiio_tool_args + source_maps + [ | ||
"--over", "-o", | ||
dest_map | ||
] |
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.
If I read the oiiotool
documentation right the --over
flag will only ever overlay the TWO top images, not ALL input images? As such this may only overlay TWO images at most even if source maps may be 5 texture sets?
dest_map | ||
] | ||
|
||
subprocess_args = " ".join(oiio_cmd) |
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.
We should not be joining this ourselves and pass the joined command to run_subprocess
but instead pass it the list of arguments.
subprocess_args = " ".join(oiio_cmd) | ||
|
||
env = os.environ.copy() | ||
env.pop("OCIO", None) | ||
log.info(" ".join(subprocess_args)) | ||
try: | ||
run_subprocess(subprocess_args, env=env) | ||
except Exception: | ||
log.error("Texture maketx conversion failed", exc_info=True) | ||
raise |
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.
We should not be joining this ourselves and pass the joined command to run_subprocess but instead pass it the list of arguments.
subprocess_args = " ".join(oiio_cmd) | |
env = os.environ.copy() | |
env.pop("OCIO", None) | |
log.info(" ".join(subprocess_args)) | |
try: | |
run_subprocess(subprocess_args, env=env) | |
except Exception: | |
log.error("Texture maketx conversion failed", exc_info=True) | |
raise | |
env = os.environ.copy() | |
env.pop("OCIO", None) | |
log.info(" ".join(oiio_cmd)) | |
try: | |
run_subprocess(oiio_cmd, env=env) | |
except Exception as exc: | |
raise RuntimError("Flattening texture stack to single output image failed") from exc |
Also, please add a todo as to WHY we need to remove OCIO
var? What does it break if it remains specified?
if "exportTextureSetsAsOneOutput" not in instance.data["creator_attributes"]: | ||
self.log.debug( | ||
"Skipping to export texture sets as single texture output.." | ||
) | ||
return |
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.
if "exportTextureSetsAsOneOutput" not in instance.data["creator_attributes"]: | |
self.log.debug( | |
"Skipping to export texture sets as single texture output.." | |
) | |
return | |
if not instance.data.get("creator_attributes", {}).get( | |
"exportTextureSetsAsOneOutput", False): | |
self.log.debug( | |
"Skipping to export texture sets as single texture output.." | |
) | |
return |
for representation in list(representations): | ||
dest_files = representation["files"] | ||
is_sequence = isinstance(dest_files, (list, tuple)) | ||
if not is_sequence: | ||
dest_image_outputs = [dest_image_outputs] | ||
if "udim" in representation: | ||
has_udim = True |
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 think this is somehow assuming that there is only ever one representation? Or? This feels like it's prone to confusion since we're getting values from all representations, but end up processing only specific images from what happens to be the 'last representation' in the iterations?
Please report the errors you get :) |
No errors, and nothing runs in my side, but the integrator does not transfer anything. |
Please share a publish JSON report - note that it skips the maketx if OCIO colorspace management is disabled but it should log a warning then. |
Ok so I have tested the workflow with multiple materials and so far no failure but as @moonyuet already mentioned no integration happens for something like:
here you can see the resulting publish instances ...and @BigRoy also enclosing the |
…ltiple-texture-sets-to-export-as-one-texture-output
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.
Publishing finnished without any error but only workfile
been integrated...
no image
products been integrated on AYON,
again enclosing JSON report for inspection
SP-publish-report-250106-17-53.json.txt
…ltiple-texture-sets-to-export-as-one-texture-output
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.
Again publishing produces just workfile
product...nothing else
and enclosing full JSON report:
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.
Changelog Description
This PR is to add support to export texture sets as single output per texture map.
Resolve #20
Additional review information
We need to discuss what the best way to merge the maps with alpha
Testing notes:
Export Texture Sets as Texture Output