Add a helper function to check if an extension is supported by file transform#1962
Conversation
Signed-off-by: Mei Chu <meimchu@gmail.com>
Signed-off-by: Mei Chu <meimchu@gmail.com>
Signed-off-by: Mei Chu <meimchu@gmail.com>
Signed-off-by: Mei Chu <meimchu@gmail.com>
|
For the python side, I have a question about the python binding as I am not very familiar with pybind11 yet. I was testing with the following in .def("IsFormatExtensionSupported", &FileTransform::IsFormatExtensionSupported, "extension"
DOC(FileTransform, IsFormatExtensionSupported));However, I get a this error when trying to build about wrong argument counts. Any help and pointer about this is greatly appreciated. error: static assertion failed due to requirement 'expected_num_args<pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg, const char *>(sizeof...(Args), argument_loader<const char *>::args_pos >= 0, argument_loader<const char *>::has_kwargs)': The number of argument annotations does not match the number of function arguments |
There was a problem hiding this comment.
Thanks Mei, this looks great!
For the Python binding, please try this:
.def_static("IsFormatExtensionSupported", &FileTransform::IsFormatExtensionSupported, "extension"_a,
DOC(FileTransform, IsFormatExtensionSupported))
(And add a semi-colon if it's the last one.)
Regarding the white space clean-up, let's bring this up at the TSC meeting to see if people object to that.
Signed-off-by: Mei Chu <meimchu@gmail.com>
…ensitive. Signed-off-by: Mei Chu <meimchu@gmail.com>
Signed-off-by: Mei Chu <meimchu@gmail.com>
Signed-off-by: Mei Chu <meimchu@gmail.com>
remia
left a comment
There was a problem hiding this comment.
Thank you @meimchu, for the white space changes, it needs to be in separated commit(s) and those listed in a .git-blame-ignore-revs at the root of OpenColorIO folder like described here. I started looking at clang-format last week, so I might make a PR for that later as well, that would only cover the C++ files though.
|
|
||
| bool FormatRegistry::isFormatExtensionSupported(const char * extension) const | ||
| { | ||
| // Early return false with an input of just the dot. |
There was a problem hiding this comment.
Suggest to also protect against invalid pointer:
if (!extension || !*extension)
{
return false;
}
There was a problem hiding this comment.
I have added those conditions for early return.
There was a problem hiding this comment.
I have also reverted all the whitespaces removed as part of my initial commits.
Signed-off-by: Mei Chu <meimchu@gmail.com>
…on-is-supported-by-FileTransform
resolves #1938 issue. Please let me know if this is what Doug is looking for!
My plan:
(Hope my auto whitespace cleanup is ok. I recognize it can make the git history slightly more dirty.)