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

[BUG] py_oiio::attribute_typed() doesn't handle tuples #2275

Closed
apetrynet opened this issue Jul 1, 2019 · 5 comments
Closed

[BUG] py_oiio::attribute_typed() doesn't handle tuples #2275

apetrynet opened this issue Jul 1, 2019 · 5 comments

Comments

@apetrynet
Copy link
Contributor

Describe the bug
For a while now I've been unsuccessful in adding TimeCode to EXR's through python. In my quest to achieve this I've been digging around in the code and discovered what might be the reason. It seems that attribute_typed() only supports int, floats and strings. In other words, when passing a tuple which is required for "non-standard" attributes there's nothing to handle them.

Here are a couple of links to my findings: (Please note that I might be barking up the wrong tree here, but seems a bit off)

When passing a tuple to attribute_typed()...
...nothing catches the tuple and handles it

To Reproduce
Steps to reproduce the behavior:

  1. Create an ImageBuf
  2. Add TimeCode
  3. Write image to EXR

Expected behavior
Get an image with the TimeCode passed

Evidence

import OpenImageIO as oiio

attrname = 'smpte:TimeCode'

# Create a buffer form image with a valid TimeCode
source_buf = oiio.ImageBuf('./checker_with_tc.exr')
tc_in = source_buf.spec().getattribute(attrname)
print type(tc_in), tc_in  # <type 'tuple'> (16777216L, 0L)

# Create a new buffer and apply the TimeCode from source image
buf = oiio.ImageBuf(oiio.ImageSpec(1600, 900, 3, oiio.HALF))
buf.specmod().attribute(attrname, oiio.TypeTimeCode, tc_in)
buf.write('./oiio_tc_write.exr')

# Did the TimeCode stick?
print buf.spec().getattribute(attrname)  # None

Platform information:

  • OIIO branch/version: Release 2.0.7
  • OS: CentOS 7
  • C++ compiler: gcc 4.8.5
  • Any non-default build flags when you build OIIO:

IF YOU ALREADY HAVE A CODE FIX: There is no need to file a separate issue,
please just go straight to making a pull request.

@lgritz
Copy link
Collaborator

lgritz commented Jul 2, 2019

I'll take a look, thanks for the alert. (And thanks for the repro script -- this makes it so very much easier for me to get started tracking something like this down.)

@apetrynet
Copy link
Contributor Author

Thanks! Hope it's not a wild goose chase.

@lgritz
Copy link
Collaborator

lgritz commented Jul 2, 2019

Legit bug. Fix proposed as #2279.

@apetrynet
Copy link
Contributor Author

Sweet! Thanks!

@apetrynet
Copy link
Contributor Author

Your fix works like a charm!
Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants