-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HYDRA-289 : Fix for USD light intensity too strong (avoid creating Hy…
…dra adapters for UFE items created by maya-usd) (#451) * HYDRA-289 Add checks to prevent creating adapters for UFE items created by maya-usd * HYDRA-289 Add extra check to prevent creating light adapters for USD's UFE lights in PreFrame light query step * HYDRA-289 Whitespace changes * HYDRA-289 Whitespace changes * HYDRA-289 : Move mayaUsd plugin check for tests into usdUtils * HYDRA-289 : Move check from usdUtils to mtohUtils * HYDRA-289 : Revert usdUtils changes * HYDRA-289 : Add test for ensuring skipping UFE items from maya-usd * HYDRA-289 Move comments describing UFE to where IsUfeItemFromMayaUsd is declared
- Loading branch information
1 parent
c1f2bfe
commit 947de4b
Showing
8 changed files
with
196 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/lib/mayaUsd/render/mayaToHydra/cpp/testMayaUsdUfeItems.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
#include "testUtils.h" | ||
|
||
#include <mayaHydraLib/mayaUtils.h> | ||
#include <mayaHydraLib/utils.h> | ||
|
||
#include <pxr/imaging/hd/tokens.h> | ||
|
||
#include <maya/MViewport2Renderer.h> | ||
|
||
#include <gtest/gtest.h> | ||
|
||
PXR_NAMESPACE_USING_DIRECTIVE | ||
|
||
using namespace MAYAHYDRA_NS; | ||
|
||
TEST(MayaUsdUfeItems, skipUsdUfeItems) | ||
{ | ||
// Setup inspector for the first scene index | ||
const SceneIndicesVector& sceneIndices = GetTerminalSceneIndices(); | ||
ASSERT_GT(sceneIndices.size(), static_cast<size_t>(0)); | ||
SceneIndexInspector inspector(sceneIndices.front()); | ||
|
||
// Check if there are UFE prims that contain data | ||
FindPrimPredicate findCubePrimPredicate | ||
= [](const HdSceneIndexBasePtr& sceneIndex, const SdfPath& primPath) -> bool { | ||
std::string primPathString = primPath.GetAsString(); | ||
bool isUfeItem = primPathString.find("ufe", 0) < std::string::npos; | ||
HdSceneIndexPrim prim = sceneIndex->GetPrim(primPath); | ||
bool containsData = HdContainerDataSource::Cast(prim.dataSource) != nullptr; | ||
return isUfeItem && containsData; | ||
}; | ||
PrimEntriesVector foundPrims = inspector.FindPrims(findCubePrimPredicate, 1); | ||
EXPECT_EQ(foundPrims.size(), static_cast<size_t>(0)); | ||
} |
44 changes: 44 additions & 0 deletions
44
test/lib/mayaUsd/render/mayaToHydra/cpp/testMayaUsdUfeItems.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import maya.cmds as cmds | ||
|
||
import fixturesUtils | ||
import mtohUtils | ||
import unittest | ||
|
||
from testUtils import PluginLoaded | ||
|
||
class TestMayaUsdUfeItems(mtohUtils.MayaHydraBaseTestCase): | ||
# MayaHydraBaseTestCase.setUpClass requirement. | ||
_file = __file__ | ||
|
||
def setupUsdStage(self): | ||
import mayaUsd | ||
import usdUtils | ||
import ufe | ||
|
||
self.setHdStormRenderer() | ||
|
||
proxyShapeUfePathString, proxyShapeUfePath, proxyShapeUfeItem = usdUtils.createSimpleStage() | ||
stage = mayaUsd.lib.GetPrim(proxyShapeUfePathString).GetStage() | ||
|
||
# Create a light prim | ||
rectLightName = "myRectLight" | ||
rectLightPrim = stage.DefinePrim('/' + rectLightName, 'RectLight') | ||
rectLightUfePathString = proxyShapeUfePathString + ',/' + rectLightName | ||
rectLightUfePath = ufe.PathString.path(rectLightUfePathString) | ||
rectLightUfeItem = ufe.Hierarchy.createItem(rectLightUfePath) | ||
|
||
# Create a geometry prim | ||
sphereName = "mySphere" | ||
sphere = cmds.polySphere(name=sphereName) | ||
mayaUsd.lib.PrimUpdaterManager.duplicate(cmds.ls(sphere, long=True)[0], proxyShapeUfePathString) | ||
|
||
cmds.refresh() | ||
|
||
@unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") | ||
def test_SkipMayaUsdUfeItems(self): | ||
self.setupUsdStage() | ||
with PluginLoaded('mayaHydraCppTests'): | ||
cmds.mayaHydraCppTest(f="MayaUsdUfeItems.skipUsdUfeItems") | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |