-
Notifications
You must be signed in to change notification settings - Fork 207
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
GafferDelight : Import IECoreDelight on Windows #5082
Conversation
798e7cd
to
b3215a4
Compare
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.
Thanks for getting to the bottom of this one so quickly Eric. In addition to the inline comments, we also need to update Changes.md so that the release notes for 1.2.0.0a3 will mention the fix.
python/GafferDelight/__init__.py
Outdated
# GafferDelight does not need any symbols from IECoreDelight, so MSVC tries | ||
# to be helpful and not load IECoreDelight.dll. Skipping that means that | ||
# 3Delight is never registered as a renderer, so we import / register it manually. | ||
|
||
import os | ||
|
||
ieCoreDelight = None | ||
|
||
if os.name == "nt" and ieCoreDelight is None : | ||
|
||
import ctypes | ||
|
||
try : | ||
ieCoreDelight = ctypes.CDLL( "IECoreDelight.dll" ) | ||
except : | ||
raise ImportError |
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.
In #5040, you mentioned that the IECoreDelight
module had this same problem, so I think perhaps it would be best to put the fix in IECoreDelight/__init__.py
instead? I presume that would be necessary to get the IECoreDelightTest module passing. Then we could just __import__( IECoreDelight )
at the top of this file, so the same fix works for GafferDelight
.
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.
Yes, that's definitely a better solution. Fixed in e95e2f3
python/GafferDelight/__init__.py
Outdated
|
||
import os | ||
|
||
ieCoreDelight = None |
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 variable seems to be unused (other than to be assigned again at L54) - do we really need it?
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 also use it to on L49 to check that we haven't already imported IECoreDelight.dll
. I think that was left over from a debugging effort though. I don't think there's much harm in asking for an already loaded library to be loaded.
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.
Is it possible for it to be set True
between L47 and L49 though?
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.
Ahhhhhh, right. Don't mind me. 🗿 Fixed in e95e2f3
The IECoreDelight module does not need any symbols from IECoreDelight, so MSVC tries to be helpful and not load IECoreDelight.dll. Skipping that means that 3Delight is never registered as a renderer, so we import / register it manually.
b3215a4
to
e95e2f3
Compare
I have the two comments fixed up, ready for another review as long as CI succeeds. |
GafferDelight does not need any symbols from IECoreDelight, so MSVC tries to be helpful and not load IECoreDelight.dll. Skipping that means that 3Delight is never registered as a renderer, so we import / register it manually.
This was causing errors loading the UI because GafferDelight was not throwing an exception when it was expected to. It also caused Gaffer to crash when trying to render with 3delight.
Fixes #5081
Checklist