-
Notifications
You must be signed in to change notification settings - Fork 5
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
HYDRA-1275 Prepare code and unit test for usd 24.11 #206
Conversation
@@ -107,23 +107,6 @@ find_library(USD_LIBRARY | |||
|
|||
get_filename_component(USD_LIBRARY_DIR ${USD_LIBRARY} DIRECTORY) | |||
|
|||
# Get the boost version from the one built with USD |
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 is not used at all, we don't use Boost and it was removed in usd 24.11+
@@ -53,6 +54,14 @@ class TestIsolateSelect(mtohUtils.MayaHydraBaseTestCase): | |||
|
|||
_requiredPlugins = ['mayaHydraCppTests', 'mayaHydraFlowViewportAPILocator'] | |||
|
|||
imageVersion = None | |||
|
|||
@classmethod |
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.
For the unit tests, there are basically 2 possible workarounds to keep the same images as much as possible.
- modifyDefaultLightIntensityIfUsdGreaterOrEqualTo_24_11() / resetDefaultLightIntensityIfUsdGreaterOrEqualTo_24_11() to modify/reset the default light intensity which fixes most of the problematic tests.
- When 1. doesn't work I need to do another baseline image and I am using the imageVersion from assertsnapshot where the new version of the image is in a given folder whose name is imageVersion (when it's not 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.
For 1. : Could we change the modify/reset methods to be more generic/modifiable over time than them being fixed to a single version, since I presume these things could change again? i.e. have something like setDefaultLightIntensityByUsdVersion and resetDefaultLightIntensity, in which we could handle all the different USD versions
For 2. : Could we move the imageVersion class attribute and setup to the MayaHydraBaseTestCase in mtohUtils.py? That way the usd version would always be set automatically, can be used as needed and the code will not have to be copy-pasted in each test
@@ -232,7 +237,13 @@ VtValue MayaHydraLightAdapter::GetLightParamValue(const TfToken& paramName) | |||
const auto color = light.color(); | |||
return VtValue(GfVec3f(color.r, color.g, color.b)); | |||
} else if (paramName == HdLightTokens->intensity) { | |||
return VtValue(light.intensity()); | |||
float intensity = light.intensity(); |
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.
Minor : auto is used in the surrounding code, could use it here as well for consistency
test/testUtils/mtohUtils.py
Outdated
def modifyDefaultLightIntensityIfUsdGreaterOrEqualTo_24_11(self): | ||
#For Usd 24.11+ set the default light intensity to PI instead of 1.0 to counter balance the changes in usd 24.11 | ||
#This can be called after the original setUp function which sets the default light to 1 | ||
if Usd.GetVersion() >= (0, 24, 11): | ||
if maya.mel.eval("optionVar -exists defaultLightIntensity"): | ||
maya.mel.eval("optionVar -fv defaultLightIntensity 3.1415") | ||
if cmds.attributeQuery('defaultLightIntensity', node='hardwareRenderingGlobals', exists=True): | ||
cmds.setAttr('hardwareRenderingGlobals.defaultLightIntensity', 3.1415) | ||
|
||
def resetDefaultLightIntensityIfUsdGreaterOrEqualTo_24_11(self): | ||
#For Usd 24.11+ reset the default light intensity to 1 instead of PI to counter balance the changes in usd 24.11 | ||
if Usd.GetVersion() >= (0, 24, 11): | ||
if maya.mel.eval("optionVar -exists defaultLightIntensity"): | ||
maya.mel.eval("optionVar -fv defaultLightIntensity 1.0") | ||
if cmds.attributeQuery('defaultLightIntensity', node='hardwareRenderingGlobals', exists=True): | ||
cmds.setAttr('hardwareRenderingGlobals.defaultLightIntensity', 1.0) | ||
|
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.
These are pretty much copy-paste, so I'd suggest extracting out a common method to set the default light intensity
@@ -53,6 +54,14 @@ class TestIsolateSelect(mtohUtils.MayaHydraBaseTestCase): | |||
|
|||
_requiredPlugins = ['mayaHydraCppTests', 'mayaHydraFlowViewportAPILocator'] | |||
|
|||
imageVersion = None | |||
|
|||
@classmethod |
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.
For 1. : Could we change the modify/reset methods to be more generic/modifiable over time than them being fixed to a single version, since I presume these things could change again? i.e. have something like setDefaultLightIntensityByUsdVersion and resetDefaultLightIntensity, in which we could handle all the different USD versions
For 2. : Could we move the imageVersion class attribute and setup to the MayaHydraBaseTestCase in mtohUtils.py? That way the usd version would always be set automatically, can be used as needed and the code will not have to be copy-pasted in each test
if cls._usdVersion >= (0, 24, 11): | ||
cls.imageVersion = 'usd_2411+' |
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.
What I had in mind was actually to move the imageVersion attribute itself to MayaHydraBaseTestCase
, but I can see how not all tests might want to use that as their image version(s)
No description provided.