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

[python][bug] Dynamic Property bug with DYNAMIC_PROPERTY_GRADING_PRIMARY #1654

Closed
MrLixm opened this issue May 31, 2022 · 1 comment
Closed
Labels
To Close temp label to help triage closable issues for review

Comments

@MrLixm
Copy link

MrLixm commented May 31, 2022

Hello,

Executing the following snippet :

import PyOpenColorIO as ocio

# ! REPLACE CONFIG_PATH !
config = ocio.Config().CreateFromFile(CONFIG_PATH)

gp = ocio.GradingPrimary(ocio.GRADING_LIN)
gp.clampBlack = 0.5
trsfm = ocio.GradingPrimaryTransform(
    gp,
    ocio.GRADING_LIN,
    dynamic=True,
)
proc = config.getProcessor(trsfm)
print("proc created.")

shader_desc = ocio.GpuShaderDesc.CreateShaderDesc(language=ocio.GPU_LANGUAGE_GLSL_4_0)
ocio_gpu_proc = proc.getDefaultGPUProcessor()
ocio_gpu_proc.extractGpuShaderInfo(shader_desc)

dyn_prop_type = ocio.DYNAMIC_PROPERTY_GRADING_PRIMARY
if shader_desc.hasDynamicProperty(dyn_prop_type):
    dyn_prop: ocio.DynamicProperty = shader_desc.getDynamicProperty(dyn_prop_type)
    dyn_prop.setDouble(2.66)
    print("DynamicProperty updated.")

print("Success")

Raises :

line 25, in <module>
    dyn_prop.setDouble(2.66)
PyOpenColorIO.Exception: Dynamic property value is not a double.

And I think it's not expected ?
Perhaps there is a missing float/double conversion is the cpp API ?
EDIT: Issue is on my side, check next comment.

CONTEXT:

Windows 10
PyOpenColorIO 2.1.1

Cheers.
Liam.

@MrLixm
Copy link
Author

MrLixm commented May 31, 2022

Hmm or perhaps the error is on my side haha, opened the issue too quick this time my bad !

I think I'm supposed to do :

    ...
    dyn_prop.setGradingPrimary(gp)
    ...

Which seems more logical.

I was just confused by the error which doesn't explicitly tell me that I did something wrong.
Maybe getting an error message like you can't use setDouble on property of type GRADING_PRIMARY more explicit, but it's a very minor feature-request.

If you don't think any further discussion is needed, feel free to close this issue.

@carolalynn carolalynn added the To Close temp label to help triage closable issues for review label Feb 14, 2024
@MrLixm MrLixm closed this as completed Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
To Close temp label to help triage closable issues for review
Projects
None yet
Development

No branches or pull requests

2 participants