Skip to content

Commit

Permalink
Matching to Houdini build 18.5.36.
Browse files Browse the repository at this point in the history
  • Loading branch information
SideFX authored and Prisms User committed Nov 21, 2019
1 parent 8e36eba commit 0b1a893
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
24 changes: 20 additions & 4 deletions src/houdini/lib/H_USD/HUSD/HUSD_Imaging.C
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <UT/UT_ErrorManager.h>
#include <UT/UT_StopWatch.h>
#include <UT/UT_SysClone.h>
#include <UT/UT_StackTrace.h>

#include <pxr/base/gf/bbox3d.h>
#include <pxr/base/gf/range3d.h>
Expand Down Expand Up @@ -181,6 +180,11 @@ public:
return false;
}

void SetSamplingCamera(const SdfPath &camera)
{
_delegate->SetCameraForSampling(camera);
}

void SetRenderOutputSettings(TfToken const &name,
HdAovDescriptor const& desc)
{
Expand Down Expand Up @@ -222,7 +226,7 @@ public:
_delegate->SetSceneMaterialsEnabled(params.enableSceneMaterials);

VtValue selectionValue(_selTracker);
_engine.SetTaskContextData(HdxTokens->selectionState, mySelection);
_engine.SetTaskContextData(HdxTokens->selectionState, selectionValue);

// This chunk of code comes from HdEngine::Execute, which is called
// from _Execute. The _Execute call was moved to a separate
Expand Down Expand Up @@ -418,6 +422,7 @@ HUSD_Imaging::HUSD_Imaging()
mySettingsChanged = true;
myIsPaused = false;
myValidRenderSettings = false;
myCameraSamplingOnly = false;
myFrame = -1e30;
myScene = nullptr;
myCompositor = nullptr;
Expand Down Expand Up @@ -1088,9 +1093,20 @@ HUSD_Imaging::updateRenderData(const UT_Matrix4D &view_matrix,

if(myCameraPath.isstring())
{
myPrivate->myImagingEngine->
SetCameraPath(SdfPath(myCameraPath.toStdString()));
if(!myCameraSamplingOnly)
{
//UTdebugPrint("Set camera", myCameraPath);
myPrivate->myImagingEngine->
SetCameraPath(SdfPath(myCameraPath.toStdString()));
}
else
{
//UTdebugPrint("Set sampling camera only", myCameraPath);
myPrivate->myImagingEngine->
SetSamplingCamera(SdfPath(myCameraPath.toStdString()));
}
}
//else UTdebugPrint("No cam");

if(update_deferred && myScene)
updateDeferredPrims();
Expand Down
10 changes: 9 additions & 1 deletion src/houdini/lib/H_USD/HUSD/HUSD_Imaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,20 @@ class HUSD_API HUSD_Imaging : public UT_NonCopyable
bool update_deferred);

// Set the camera being viewed through (can be null for no camera);
void setCameraPath(const UT_StringRef &path)
void setCameraPath(const UT_StringRef &path,
bool sampling_only = false)
{
if(path != myCameraPath)
{
myCameraPath = path;
mySettingsChanged = true;
}
// use camera for sampling parms, not frustum.
if(sampling_only != myCameraSamplingOnly)
{
myCameraSamplingOnly = sampling_only;
mySettingsChanged = true;
}
}

void setAOVCompositor(HUSD_Compositor *comp)
Expand Down Expand Up @@ -191,6 +198,7 @@ class HUSD_API HUSD_Imaging : public UT_NonCopyable
myConverged : 1,
mySettingsChanged : 1,
myIsPaused : 1,
myCameraSamplingOnly : 1,
myValidRenderSettings : 1;
HUSD_Scene *myScene;
UT_StringHolder myRendererName;
Expand Down
26 changes: 26 additions & 0 deletions src/houdini/lib/H_USD/HUSD/HUSD_Info.C
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,32 @@ HUSD_Info::getAncestorOfKind(const UT_StringRef &primpath,
return kindpath;
}

UT_StringHolder
HUSD_Info::getAncestorInstanceRoot(const UT_StringRef &primpath) const
{
UT_StringHolder instancerootpath;

if (myAnyLock && myAnyLock->constData() &&
myAnyLock->constData()->isStageValid())
{
SdfPath sdfpath(HUSDgetSdfPath(primpath));
auto prim = myAnyLock->constData()->stage()->GetPrimAtPath(sdfpath);

while (prim)
{
if (!prim.IsInstanceProxy())
{
instancerootpath = prim.GetPath().GetString();
break;
}
else
prim = prim.GetParent();
}
}

return instancerootpath;
}

static inline UsdPrim
husdGetPrimAtPath(HUSD_AutoAnyLock *lock, const UT_StringRef &primpath)
{
Expand Down
2 changes: 2 additions & 0 deletions src/houdini/lib/H_USD/HUSD/HUSD_Info.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class HUSD_API HUSD_Info

UT_StringHolder getAncestorOfKind(const UT_StringRef &primpath,
const UT_StringRef &kind) const;
UT_StringHolder getAncestorInstanceRoot(
const UT_StringRef &primpath) const;

// Attributes
enum class QueryAspect
Expand Down

0 comments on commit 0b1a893

Please sign in to comment.