Skip to content
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

Maya: Camera focal length visible in review - OP-3278 #4531

Merged
merged 21 commits into from
Mar 29, 2023

Conversation

tokejepsen
Copy link
Member

@tokejepsen tokejepsen commented Feb 26, 2023

Brief description

Camera focal length visible in review.

Description

Support camera focal length in review; static and dynamic.

Resolves #3220

Testing Notes

  1. Change one of the project_settings/global/publish/ExtractBurnin/profiles/0/burnins fields to use {focalLength:.2f} or {focalLength:.0f} or {focalLength}.
  2. Create a camera in Maya with animated focal length.
  3. Create a review and publish.
  4. Validate focal length is present on the burnins on the review.

@tokejepsen tokejepsen added host: Maya type: feature Larger, user affecting changes and completely new things labels Feb 26, 2023
@tokejepsen tokejepsen self-assigned this Feb 26, 2023
@ynbot
Copy link
Contributor

ynbot commented Feb 26, 2023

@BigRoy
Copy link
Collaborator

BigRoy commented Mar 3, 2023

How does this code actually work to retrieve the dynamic focal length? :) Where does it end up collecting the values per frame?

@tokejepsen
Copy link
Member Author

How does this code actually work to retrieve the dynamic focal length? :) Where does it end up collecting the values per frame?

It doesn't🙂 This is still a draft PR so should be disregarded for reviewing.

@tokejepsen tokejepsen marked this pull request as ready for review March 22, 2023 16:44
LiborBatek
LiborBatek previously approved these changes Mar 28, 2023
Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All works as expected. When focal length animated it correctly shows and updates in burins.

image

image

openpype/lib/execute.py Outdated Show resolved Hide resolved
@tokejepsen
Copy link
Member Author

@LiborBatek guessing you are happy with this PR? If so could you approve?

@BigRoy @moonyuet you happy with this?

@tokejepsen tokejepsen assigned moonyuet and unassigned LiborBatek Mar 29, 2023
@BigRoy
Copy link
Collaborator

BigRoy commented Mar 29, 2023

So this PR works perfectly for me in ✅ Maya 2023 but I'm having the issues in ⚠️ Maya 2020 reported by @gabormarinov on discord here which are unrelated to this PR.

I animated focal length in sync with my frame range to ensure it was exactly sync per frame in the resulting burnin - all was good on that front! 👍


Regarding debugging the Maya 2020 issue:

This is what is shown in the Pyblish UI as error message: Cannot apply options Invalid flag ''

afbeelding

These are options being passed to capture.capture:

Using preset:
{
    "camera": "|camera1|cameraShape1", 
    "camera_options": {
        "depthOfField": false, 
        "displayFieldChart": false, 
        "displayFilmGate": false, 
        "displayFilmOrigin": false, 
        "displayFilmPivot": false, 
        "displayGateMask": false, 
        "displayResolution": false, 
        "displaySafeAction": false, 
        "displaySafeTitle": false, 
        "overscan": 1.0
    }, 
    "compression": "jpg", 
    "display_options": {
        "background": [
            0.49019607843137253, 
            0.49019607843137253, 
            0.49019607843137253
        ], 
        "backgroundBottom": [
            0.49019607843137253, 
            0.49019607843137253, 
            0.49019607843137253
        ], 
        "backgroundTop": [
            0.49019607843137253, 
            0.49019607843137253, 
            0.49019607843137253
        ], 
        "displayGradient": true
    }, 
    "end_frame": 1011.0, 
    "filename": "c:\\users\\roy\\appdata\\local\\temp\\pyblish_tmp_xpx6s9\\reviewMain", 
    "format": "image", 
    "height": 1080, 
    "off_screen": true, 
    "overwrite": true, 
    "quality": 95, 
    "sound": null, 
    "start_frame": 991.0, 
    "viewer": false, 
    "viewport2_options": {
        "enableTextureMaxRes": true, 
        "hwFogAlpha": 0, 
        "hwFogColorB": 1.0, 
        "hwFogColorG": 1.0, 
        "hwFogColorR": 1.0, 
        "hwFogDensity": 0.0, 
        "hwFogEnd": 100, 
        "hwFogFalloff": 0, 
        "hwFogStart": 0, 
        "lineAAEnable": true, 
        "motionBlurEnable": false, 
        "motionBlurSampleCount": 8, 
        "motionBlurShutterOpenFraction": 0.2, 
        "multiSampleCount": 8, 
        "multiSampleEnable": true, 
        "renderDepthOfField": true, 
        "ssaoAmount": 1, 
        "ssaoEnable": false, 
        "ssaoFilterRadius": 16, 
        "ssaoRadius": 16, 
        "ssaoSamples": 16, 
        "textureMaxResMode": 1, 
        "textureMaxResolution": 1024
    }, 
    "viewport_options": {
        "backfaceCulling": false, 
        "cameras": false, 
        "clipGhosts": false, 
        "controlVertices": false, 
        "deformers": false, 
        "dimensions": false, 
        "displayLights": "default", 
        "displayTextures": true, 
        "dynamicConstraints": false, 
        "dynamics": false, 
        "fluids": false, 
        "fogging": false, 
        "follicles": false, 
        "gpuCacheDisplayFilter": false, 
        "greasePencils": false, 
        "grid": false, 
        "hairSystems": true, 
        "handles": false, 
        "headsUpDisplay": false, 
        "hulls": false, 
        "ikHandles": false, 
        "imagePlane": true, 
        "jointXray": false, 
        "joints": false, 
        "lights": false, 
        "locators": false, 
        "manipulators": false, 
        "motionTrails": false, 
        "nCloths": false, 
        "nParticles": false, 
        "nRigids": false, 
        "nurbsCurves": false, 
        "nurbsSurfaces": false, 
        "particleInstancers": false, 
        "pivots": false, 
        "planes": false, 
        "pluginShapes": false, 
        "polymeshes": true, 
        "rendererName": "vp2Renderer", 
        "shadows": true, 
        "strokes": false, 
        "subdivSurfaces": false, 
        "textures": false, 
        "twoSidedLighting": true, 
        "useDefaultMaterial": false, 
        "wireframeOnShaded": false, 
        "xray": false
    }, 
    "width": 1920
}

And it appears to error on the viewport options with the modelEditor command on line 748 of capture.py. But when running this in Maya 2020:

import capture

viewport_options = {
    "backfaceCulling": False, 
    "cameras": False, 
    "clipGhosts": False, 
    "controlVertices": False, 
    "deformers": False, 
    "dimensions": False, 
    "displayLights": "default", 
    "displayTextures": True, 
    "dynamicConstraints": False, 
    "dynamics": False, 
    "fluids": False, 
    "fogging": False, 
    "follicles": False, 
    "gpuCacheDisplayFilter": False, 
    "greasePencils": False, 
    "grid": False, 
    "hairSystems": True, 
    "handles": False, 
    "headsUpDisplay": False, 
    "hulls": False, 
    "ikHandles": False, 
    "imagePlane": True, 
    "jointXray": False, 
    "joints": False, 
    "lights": False, 
    "locators": False, 
    "manipulators": False, 
    "motionTrails": False, 
    "nCloths": False, 
    "nParticles": False, 
    "nRigids": False, 
    "nurbsCurves": False, 
    "nurbsSurfaces": False, 
    "particleInstancers": False, 
    "pivots": False, 
    "planes": False, 
    "pluginShapes": False, 
    "polymeshes": True, 
    "rendererName": "vp2Renderer", 
    "shadows": True, 
    "strokes": False, 
    "subdivSurfaces": False, 
    "textures": False, 
    "twoSidedLighting": True, 
    "useDefaultMaterial": False, 
    "wireframeOnShaded": False, 
    "xray": False

}

with capture._applied_viewport_options(viewport_options, "modelPanel1"):
    pass

I get no errors. Which seems weird since it should trigger the same logic.

This does trigger the error however:

import capture
import json

data = r"""
{
    "camera": "|camera1|cameraShape1", 
    "camera_options": {
        "depthOfField": false, 
        "displayFieldChart": false, 
        "displayFilmGate": false, 
        "displayFilmOrigin": false, 
        "displayFilmPivot": false, 
        "displayGateMask": false, 
        "displayResolution": false, 
        "displaySafeAction": false, 
        "displaySafeTitle": false, 
        "overscan": 1.0
    }, 
    "compression": "jpg", 
    "display_options": {
        "background": [
            0.49019607843137253, 
            0.49019607843137253, 
            0.49019607843137253
        ], 
        "backgroundBottom": [
            0.49019607843137253, 
            0.49019607843137253, 
            0.49019607843137253
        ], 
        "backgroundTop": [
            0.49019607843137253, 
            0.49019607843137253, 
            0.49019607843137253
        ], 
        "displayGradient": true
    }, 
    "end_frame": 1011.0, 
    "filename": "c:\\users\\roy\\appdata\\local\\temp\\pyblish_tmp_xpx6s9\\reviewMain", 
    "format": "image", 
    "height": 1080, 
    "off_screen": true, 
    "overwrite": true, 
    "quality": 95, 
    "sound": null, 
    "start_frame": 991.0, 
    "viewer": false, 
    "viewport2_options": {
        "enableTextureMaxRes": true, 
        "hwFogAlpha": 0, 
        "hwFogColorB": 1.0, 
        "hwFogColorG": 1.0, 
        "hwFogColorR": 1.0, 
        "hwFogDensity": 0.0, 
        "hwFogEnd": 100, 
        "hwFogFalloff": 0, 
        "hwFogStart": 0, 
        "lineAAEnable": true, 
        "motionBlurEnable": false, 
        "motionBlurSampleCount": 8, 
        "motionBlurShutterOpenFraction": 0.2, 
        "multiSampleCount": 8, 
        "multiSampleEnable": true, 
        "renderDepthOfField": true, 
        "ssaoAmount": 1, 
        "ssaoEnable": false, 
        "ssaoFilterRadius": 16, 
        "ssaoRadius": 16, 
        "ssaoSamples": 16, 
        "textureMaxResMode": 1, 
        "textureMaxResolution": 1024
    }, 
    "viewport_options": {
        "backfaceCulling": false, 
        "cameras": false, 
        "clipGhosts": false, 
        "controlVertices": false, 
        "deformers": false, 
        "dimensions": false, 
        "displayLights": "default", 
        "displayTextures": true, 
        "dynamicConstraints": false, 
        "dynamics": false, 
        "fluids": false, 
        "fogging": false, 
        "follicles": false, 
        "gpuCacheDisplayFilter": false, 
        "greasePencils": false, 
        "grid": false, 
        "hairSystems": true, 
        "handles": false, 
        "headsUpDisplay": false, 
        "hulls": false, 
        "ikHandles": false, 
        "imagePlane": true, 
        "jointXray": false, 
        "joints": false, 
        "lights": false, 
        "locators": false, 
        "manipulators": false, 
        "motionTrails": false, 
        "nCloths": false, 
        "nParticles": false, 
        "nRigids": false, 
        "nurbsCurves": false, 
        "nurbsSurfaces": false, 
        "particleInstancers": false, 
        "pivots": false, 
        "planes": false, 
        "pluginShapes": false, 
        "polymeshes": true, 
        "rendererName": "vp2Renderer", 
        "shadows": true, 
        "strokes": false, 
        "subdivSurfaces": false, 
        "textures": false, 
        "twoSidedLighting": true, 
        "useDefaultMaterial": false, 
        "wireframeOnShaded": false, 
        "xray": false
    }, 
    "width": 1920
}
"""

preset = json.loads(data)
capture.capture(**preset)

Which errors with:

# ERROR - Cannot apply options Invalid flag ''
# Error: pyblish.ExtractPlayblast : Cannot apply options Invalid flag '' # 

This also shows a different bug, with capture.py that it actually overrides its default logger too as soon as you ever pass any log argument to capture.capture due it storing it in a global. That's why it's also showing the pyblish.ExtractPlayblast prefix in my log

@tokejepsen
Copy link
Member Author

Maya 2020 reported by @gabormarinov on discord here which are unrelated to this PR.

@BigRoy we'll need to tackle this in a separate PR or issue.
If you are otherwise happy with this PR, could you approve?

Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works in my side too. can you please merge the latest develop to this branch?

@mkolar mkolar merged commit b17ff80 into ynput:develop Mar 29, 2023
@ynbot ynbot added this to the next-patch milestone Mar 29, 2023
@tokejepsen tokejepsen deleted the feature/OP-3278_camera-focal-length branch March 29, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: Maya type: feature Larger, user affecting changes and completely new things
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Maya: Camera focal length visible in review
6 participants