Add disableDepthOfField bool to RenderSettings
authorklucknav <klucknav@users.noreply.github.com>
Mon, 22 Jan 2024 22:37:08 +0000 (14:37 -0800)
committerpixar-oss <pixar-oss@users.noreply.github.com>
Mon, 22 Jan 2024 23:03:28 +0000 (15:03 -0800)
This is adding a 'disableDepthOfField' bool to the UsdRenderSettingsBase
Schema, as well as the HdRenderProductSchema. A follow up change will
add the ability for HdPrman to use this option.

(Internal change: 2312852)

24 files changed:
pxr/imaging/hd/dataSourceLegacyPrim.cpp
pxr/imaging/hd/renderProductSchema.cpp
pxr/imaging/hd/renderProductSchema.h
pxr/imaging/hd/renderSettings.cpp
pxr/imaging/hd/renderSettings.h
pxr/imaging/hd/sceneIndexAdapterSceneDelegate.cpp
pxr/imaging/hd/version.h
pxr/usd/usdRender/generatedSchema.usda
pxr/usd/usdRender/schema.usda
pxr/usd/usdRender/settingsBase.cpp
pxr/usd/usdRender/settingsBase.h
pxr/usd/usdRender/spec.cpp
pxr/usd/usdRender/spec.h
pxr/usd/usdRender/tokens.cpp
pxr/usd/usdRender/tokens.h
pxr/usd/usdRender/wrapSettingsBase.cpp
pxr/usd/usdRender/wrapTokens.cpp
pxr/usdImaging/usdImaging/renderSettingsAdapter.cpp
pxr/usdImaging/usdImaging/renderSettingsFlatteningSceneIndex.cpp
pxr/usdImaging/usdImaging/usdRenderProductSchema.cpp
pxr/usdImaging/usdImaging/usdRenderProductSchema.h
pxr/usdImaging/usdImaging/usdRenderSettingsSchema.cpp
pxr/usdImaging/usdImaging/usdRenderSettingsSchema.h
third_party/renderman-25/plugin/hdPrman/testenv/testHdPrman.cpp

index 3cf6b2e7ca47a3ef31422ffb1080e1df70f89f0a..a23eb73c3fe251c5c0bf6c820ac1a1e98e4c2dd9 100644 (file)
@@ -2275,6 +2275,9 @@ _ToVectorDS(const HdRenderProducts &hdProducts)
                 .SetDisableMotionBlur(
                     HdRetainedTypedSampledDataSource<bool>::New(
                         hdProduct.disableMotionBlur))
+                .SetDisableDepthOfField(
+                    HdRetainedTypedSampledDataSource<bool>::New(
+                        hdProduct.disableDepthOfField))
                 .SetNamespacedSettings(
                     _ToContainerDS(hdProduct.namespacedSettings))
                 .Build());
index eed5758aed31ba66ce53a1331e97b6011a57950a..bb532c4b46ede386a44fc9e3e32cf3380cc6522f 100644 (file)
@@ -49,9 +49,6 @@ TF_DEFINE_PUBLIC_TOKENS(HdRenderProductSchemaTokens,
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-
-
-
 HdPathDataSourceHandle
 HdRenderProductSchema::GetPath()
 {
@@ -129,6 +126,13 @@ HdRenderProductSchema::GetDisableMotionBlur()
         HdRenderProductSchemaTokens->disableMotionBlur);
 }
 
+HdBoolDataSourceHandle
+HdRenderProductSchema::GetDisableDepthOfField()
+{
+    return _GetTypedDataSource<HdBoolDataSource>(
+        HdRenderProductSchemaTokens->disableDepthOfField);
+}
+
 HdContainerDataSourceHandle
 HdRenderProductSchema::GetNamespacedSettings()
 {
@@ -150,13 +154,15 @@ HdRenderProductSchema::BuildRetained(
         const HdVec2fDataSourceHandle &apertureSize,
         const HdVec4fDataSourceHandle &dataWindowNDC,
         const HdBoolDataSourceHandle &disableMotionBlur,
+        const HdBoolDataSourceHandle &disableDepthOfField,
         const HdContainerDataSourceHandle &namespacedSettings
 )
 {
-    TfToken _names[12];
-    HdDataSourceBaseHandle _values[12];
+    TfToken _names[13];
+    HdDataSourceBaseHandle _values[13];
 
     size_t _count = 0;
+
     if (path) {
         _names[_count] = HdRenderProductSchemaTokens->path;
         _values[_count++] = path;
@@ -212,70 +218,18 @@ HdRenderProductSchema::BuildRetained(
         _values[_count++] = disableMotionBlur;
     }
 
+    if (disableDepthOfField) {
+        _names[_count] = HdRenderProductSchemaTokens->disableDepthOfField;
+        _values[_count++] = disableDepthOfField;
+    }
+
     if (namespacedSettings) {
         _names[_count] = HdRenderProductSchemaTokens->namespacedSettings;
         _values[_count++] = namespacedSettings;
     }
-
     return HdRetainedContainerDataSource::New(_count, _names, _values);
 }
 
-/*static*/
-HdRenderProductSchema
-HdRenderProductSchema::GetFromParent(
-        const HdContainerDataSourceHandle &fromParentContainer)
-{
-    return HdRenderProductSchema(
-        fromParentContainer
-        ? HdContainerDataSource::Cast(fromParentContainer->Get(
-                HdRenderProductSchemaTokens->renderProduct))
-        : nullptr);
-}
-
-/*static*/
-const TfToken &
-HdRenderProductSchema::GetSchemaToken()
-{
-    return HdRenderProductSchemaTokens->renderProduct;
-}
-
-/*static*/
-const HdDataSourceLocator &
-HdRenderProductSchema::GetDefaultLocator()
-{
-    static const HdDataSourceLocator locator(GetSchemaToken());
-    return locator;
-} 
-
-/* static */
-const HdDataSourceLocator &
-HdRenderProductSchema::GetResolutionLocator()
-{
-    static const HdDataSourceLocator locator =
-        GetDefaultLocator().Append(
-            HdRenderProductSchemaTokens->resolution);
-    return locator;
-}
-
-/* static */
-const HdDataSourceLocator &
-HdRenderProductSchema::GetRenderVarsLocator()
-{
-    static const HdDataSourceLocator locator =
-        GetDefaultLocator().Append(
-            HdRenderProductSchemaTokens->renderVars);
-    return locator;
-}
-
-/* static */
-const HdDataSourceLocator &
-HdRenderProductSchema::GetNamespacedSettingsLocator()
-{
-    static const HdDataSourceLocator locator =
-        GetDefaultLocator().Append(
-            HdRenderProductSchemaTokens->namespacedSettings);
-    return locator;
-}
 HdRenderProductSchema::Builder &
 HdRenderProductSchema::Builder::SetPath(
     const HdPathDataSourceHandle &path)
@@ -364,6 +318,14 @@ HdRenderProductSchema::Builder::SetDisableMotionBlur(
     return *this;
 }
 
+HdRenderProductSchema::Builder &
+HdRenderProductSchema::Builder::SetDisableDepthOfField(
+    const HdBoolDataSourceHandle &disableDepthOfField)
+{
+    _disableDepthOfField = disableDepthOfField;
+    return *this;
+}
+
 HdRenderProductSchema::Builder &
 HdRenderProductSchema::Builder::SetNamespacedSettings(
     const HdContainerDataSourceHandle &namespacedSettings)
@@ -387,9 +349,66 @@ HdRenderProductSchema::Builder::Build()
         _apertureSize,
         _dataWindowNDC,
         _disableMotionBlur,
+        _disableDepthOfField,
         _namespacedSettings
     );
 }
 
+/*static*/
+HdRenderProductSchema
+HdRenderProductSchema::GetFromParent(
+        const HdContainerDataSourceHandle &fromParentContainer)
+{
+    return HdRenderProductSchema(
+        fromParentContainer
+        ? HdContainerDataSource::Cast(fromParentContainer->Get(
+                HdRenderProductSchemaTokens->renderProduct))
+        : nullptr);
+}
+
+/*static*/
+const TfToken &
+HdRenderProductSchema::GetSchemaToken()
+{
+    return HdRenderProductSchemaTokens->renderProduct;
+}
+
+/*static*/
+const HdDataSourceLocator &
+HdRenderProductSchema::GetDefaultLocator()
+{
+    static const HdDataSourceLocator locator(GetSchemaToken());
+    return locator;
+}
+
+/* static */
+const HdDataSourceLocator &
+HdRenderProductSchema::GetResolutionLocator()
+{
+    static const HdDataSourceLocator locator =
+        GetDefaultLocator().Append(
+            HdRenderProductSchemaTokens->resolution);
+    return locator;
+}
+
+/* static */
+const HdDataSourceLocator &
+HdRenderProductSchema::GetRenderVarsLocator()
+{
+    static const HdDataSourceLocator locator =
+        GetDefaultLocator().Append(
+            HdRenderProductSchemaTokens->renderVars);
+    return locator;
+}
+
+/* static */
+const HdDataSourceLocator &
+HdRenderProductSchema::GetNamespacedSettingsLocator()
+{
+    static const HdDataSourceLocator locator =
+        GetDefaultLocator().Append(
+            HdRenderProductSchemaTokens->namespacedSettings);
+    return locator;
+} 
 
 PXR_NAMESPACE_CLOSE_SCOPE
\ No newline at end of file
index 330a9bf3a28003e3d2bd1b97b10232b5d4fd6f81..959f635597428a285645d378b8b27e5c7f138751 100644 (file)
@@ -35,6 +35,8 @@
 #ifndef PXR_IMAGING_HD_RENDER_PRODUCT_SCHEMA_H
 #define PXR_IMAGING_HD_RENDER_PRODUCT_SCHEMA_H
 
+/// \file
+
 #include "pxr/imaging/hd/api.h"
 #include "pxr/imaging/hd/vectorSchemaTypeDefs.h"
 
 
 PXR_NAMESPACE_OPEN_SCOPE
 
-//-----------------------------------------------------------------------------
-
 // --(BEGIN CUSTOM CODE: Declares)--
 // --(END CUSTOM CODE: Declares)--
 
-//-----------------------------------------------------------------------------
-
 #define HD_RENDER_PRODUCT_SCHEMA_TOKENS \
     (renderProduct) \
     (path) \
@@ -68,23 +66,40 @@ PXR_NAMESPACE_OPEN_SCOPE
     (apertureSize) \
     (dataWindowNDC) \
     (disableMotionBlur) \
+    (disableDepthOfField) \
     (namespacedSettings) \
 
 TF_DECLARE_PUBLIC_TOKENS(HdRenderProductSchemaTokens, HD_API,
     HD_RENDER_PRODUCT_SCHEMA_TOKENS);
 
 //-----------------------------------------------------------------------------
+
+
 class HdRenderProductSchema : public HdSchema
 {
 public:
+    /// \name Schema retrieval
+    /// @{
+
     HdRenderProductSchema(HdContainerDataSourceHandle container)
-    : HdSchema(container) {}
+      : HdSchema(container) {}
+
+    /// Retrieves a container data source with the schema's default name token
+    /// "renderProduct" from the parent container and constructs a
+    /// HdRenderProductSchema instance.
+    /// Because the requested container data source may not exist, the result
+    /// should be checked with IsDefined() or a bool comparison before use.
+    HD_API
+    static HdRenderProductSchema GetFromParent(
+        const HdContainerDataSourceHandle &fromParentContainer);
+
+    /// @}
 
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-    //ACCESSORS
-
+    /// \name Member accessor
+    /// @{
 
     HD_API
     HdPathDataSourceHandle GetPath();
@@ -120,10 +135,55 @@ public:
     HdBoolDataSourceHandle GetDisableMotionBlur();
 
     HD_API
-    HdContainerDataSourceHandle GetNamespacedSettings();
+    HdBoolDataSourceHandle GetDisableDepthOfField();
+
+    HD_API
+    HdContainerDataSourceHandle GetNamespacedSettings(); 
 
-    // RETRIEVING AND CONSTRUCTING
+    /// @}
+
+    /// \name Schema location
+    /// @{
+
+    /// Returns a token where the container representing this schema is found in
+    /// a container by default.
+    HD_API
+    static const TfToken &GetSchemaToken();
+
+    /// Returns an HdDataSourceLocator (relative to the prim-level data source)
+    /// where the container representing this schema is found by default.
+    HD_API
+    static const HdDataSourceLocator &GetDefaultLocator();
+
+    /// @}
+
+    /// \name Data source locators for members
+    ///
+    /// The following methods return an HdDataSourceLocator (relative to the
+    /// prim-level data source) where the data source for a member can be found.
+    ///
+    /// This is often useful for checking intersection against the
+    /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
+    /// @{
+
+    /// Prim-level relative data source locator to locate resolution.
+    HD_API
+    static const HdDataSourceLocator &GetResolutionLocator();
+
+    /// Prim-level relative data source locator to locate renderVars.
+    HD_API
+    static const HdDataSourceLocator &GetRenderVarsLocator();
 
+    /// Prim-level relative data source locator to locate namespacedSettings.
+    HD_API
+    static const HdDataSourceLocator &GetNamespacedSettingsLocator();
+    /// @} 
+
+    /// \name Schema construction
+    /// @{
+
+    /// \deprecated Use Builder instead.
+    ///
     /// Builds a container data source which includes the provided child data
     /// sources. Parameters with nullptr values are excluded. This is a
     /// low-level interface. For cases in which it's desired to define
@@ -143,6 +203,7 @@ public:
         const HdVec2fDataSourceHandle &apertureSize,
         const HdVec4fDataSourceHandle &dataWindowNDC,
         const HdBoolDataSourceHandle &disableMotionBlur,
+        const HdBoolDataSourceHandle &disableDepthOfField,
         const HdContainerDataSourceHandle &namespacedSettings
     );
 
@@ -189,6 +250,9 @@ public:
         Builder &SetDisableMotionBlur(
             const HdBoolDataSourceHandle &disableMotionBlur);
         HD_API
+        Builder &SetDisableDepthOfField(
+            const HdBoolDataSourceHandle &disableDepthOfField);
+        HD_API
         Builder &SetNamespacedSettings(
             const HdContainerDataSourceHandle &namespacedSettings);
 
@@ -208,50 +272,12 @@ public:
         HdVec2fDataSourceHandle _apertureSize;
         HdVec4fDataSourceHandle _dataWindowNDC;
         HdBoolDataSourceHandle _disableMotionBlur;
+        HdBoolDataSourceHandle _disableDepthOfField;
         HdContainerDataSourceHandle _namespacedSettings;
-    };
-
-    /// Retrieves a container data source with the schema's default name token
-    /// "renderProduct" from the parent container and constructs a
-    /// HdRenderProductSchema instance.
-    /// Because the requested container data source may not exist, the result
-    /// should be checked with IsDefined() or a bool comparison before use.
-    HD_API
-    static HdRenderProductSchema GetFromParent(
-        const HdContainerDataSourceHandle &fromParentContainer);
-
-    /// Returns a token where the container representing this schema is found in
-    /// a container by default.
-    HD_API
-    static const TfToken &GetSchemaToken();
-
-    /// Returns an HdDataSourceLocator (relative to the prim-level data source)
-    /// where the container representing this schema is found by default.
-    HD_API
-    static const HdDataSourceLocator &GetDefaultLocator();
-
-    // DATA SOURCE LOCATORS FOR MEMBERS
-    //
-    // The following methods return an HdDataSourceLocator (relative to the
-    // prim-level data source) where the data source for a member can be found.
-    //
-    // This is often useful for checking intersection against the
-    // HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
-
-
-    /// Prim-level relative data source locator to locate resolution.
-    HD_API
-    static const HdDataSourceLocator &GetResolutionLocator();
-
-    /// Prim-level relative data source locator to locate renderVars.
-    HD_API
-    static const HdDataSourceLocator &GetRenderVarsLocator();
-
-    /// Prim-level relative data source locator to locate namespacedSettings.
-    HD_API
-    static const HdDataSourceLocator &GetNamespacedSettingsLocator();
 
+    };
 
+    /// @}
 };
 
 PXR_NAMESPACE_CLOSE_SCOPE
index 87d197dd94e79f328d4ee5a819e02f52edeb4f48..262262781066270f55e1218a1e56be9aa0fc76cd 100644 (file)
@@ -63,6 +63,7 @@ void TfHashAppend(
             rp.apertureSize,
             rp.dataWindowNDC,
             rp.disableMotionBlur,
+            rp.disableDepthOfField,
             rp.namespacedSettings);
 }
 
@@ -255,6 +256,7 @@ bool operator==(const HdRenderSettings::RenderProduct& lhs,
         && lhs.apertureSize == rhs.apertureSize
         && lhs.dataWindowNDC == rhs.dataWindowNDC
         && lhs.disableMotionBlur == rhs.disableMotionBlur
+        && lhs.disableDepthOfField == rhs.disableDepthOfField
         && lhs.namespacedSettings == rhs.namespacedSettings;
 }
 
index 294fd5b28cf60980116fd7601d22bb647457d3a1..d0a06602db8b1deaa734a213a8293be78121183b 100644 (file)
@@ -133,6 +133,7 @@ public:
         /// Settings overrides
         //
         bool disableMotionBlur;
+        bool disableDepthOfField;
         VtDictionary namespacedSettings;
     };
 
index 2f2e1bbff092ffd6427bcd9f464a7a387a640030..28b84492ca0bb3120e8f464534a9bfe75c7c688c 100644 (file)
@@ -1375,6 +1375,9 @@ _ToRenderProduct(HdRenderProductSchema productSchema)
     if (auto h = productSchema.GetDisableMotionBlur()) {
         prod.disableMotionBlur = h->GetTypedValue(0);
     }
+    if (auto h = productSchema.GetDisableDepthOfField()) {
+        prod.disableDepthOfField = h->GetTypedValue(0);
+    }
     if (auto h = productSchema.GetNamespacedSettings()) {
         prod.namespacedSettings = _ToDictionary(h);
     }
index e2efc19b1297b5f49b8d260c7ccd676a881d5f07..ec2799a9972c77d7cfd2e338866dfea00bf448a2 100644 (file)
 //           HdMaterialNode::GetParameters, GetInputConnections
 //           return Hydra schemas instead of just container data sources.
 //           schemaTypeDefs.h replaces vectorSchemaTypeDefs.h.
+// 63 -> 64: Adding disableDepthOfField to HdRenderSettings::RenderProduct
+//
 
-#define HD_API_VERSION 63
+#define HD_API_VERSION 64
 
 // 1  ->  2: SimpleLighting -> FallbackLighting
 #define HD_SHADER_API 2
index a0e574e32e79f0cd2b5e1cbf1f5a616085244fcf..fbf3a671bcab9021dd0fdd9a6c90f1b20f848fdd 100644 (file)
@@ -72,6 +72,10 @@ class "RenderSettingsBase" (
         aspectRatioConformPolicy.
         """
     )
+    uniform bool disableDepthOfField = 0 (
+        doc = """Disable all depth of field by setting F-stop of the targeted
+        camera to infinity."""
+    )
     uniform bool disableMotionBlur = 0 (
         doc = """Disable all motion blur by setting the shutter interval
         of the targeted camera to [0,0] - that is, take only one sample,
@@ -164,6 +168,10 @@ class RenderSettings "RenderSettings" (
         aspectRatioConformPolicy.
         """
     )
+    uniform bool disableDepthOfField = 0 (
+        doc = """Disable all depth of field by setting F-stop of the targeted
+        camera to infinity."""
+    )
     uniform bool disableMotionBlur = 0 (
         doc = """Disable all motion blur by setting the shutter interval
         of the targeted camera to [0,0] - that is, take only one sample,
@@ -334,6 +342,10 @@ class RenderProduct "RenderProduct" (
         aspectRatioConformPolicy.
         """
     )
+    uniform bool disableDepthOfField = 0 (
+        doc = """Disable all depth of field by setting F-stop of the targeted
+        camera to infinity."""
+    )
     uniform bool disableMotionBlur = 0 (
         doc = """Disable all motion blur by setting the shutter interval
         of the targeted camera to [0,0] - that is, take only one sample,
index 90963d33d9e2e11353b40faed1a1ee001b91e149..37428cfb30de05a29cb63e4863d8ddfdaeccc8a6 100644 (file)
@@ -121,6 +121,10 @@ class "RenderSettingsBase" (
         of the targeted camera to [0,0] - that is, take only one sample,
         namely at the current time code."""
     )
+    uniform bool disableDepthOfField = false (
+        doc = """Disable all depth of field by setting F-stop of the targeted
+        camera to infinity."""
+    )
 }
  
 class RenderSettings "RenderSettings" (
index bec0d130dc57f7990bf1f86438c047a83ef9eb37..6ba677c0394d7980bea223e5ade9906c90ac16f6 100644 (file)
@@ -186,6 +186,23 @@ UsdRenderSettingsBase::CreateDisableMotionBlurAttr(VtValue const &defaultValue,
                        writeSparsely);
 }
 
+UsdAttribute
+UsdRenderSettingsBase::GetDisableDepthOfFieldAttr() const
+{
+    return GetPrim().GetAttribute(UsdRenderTokens->disableDepthOfField);
+}
+
+UsdAttribute
+UsdRenderSettingsBase::CreateDisableDepthOfFieldAttr(VtValue const &defaultValue, bool writeSparsely) const
+{
+    return UsdSchemaBase::_CreateAttr(UsdRenderTokens->disableDepthOfField,
+                       SdfValueTypeNames->Bool,
+                       /* custom = */ false,
+                       SdfVariabilityUniform,
+                       defaultValue,
+                       writeSparsely);
+}
+
 UsdRelationship
 UsdRenderSettingsBase::GetCameraRel() const
 {
@@ -222,6 +239,7 @@ UsdRenderSettingsBase::GetSchemaAttributeNames(bool includeInherited)
         UsdRenderTokens->dataWindowNDC,
         UsdRenderTokens->instantaneousShutter,
         UsdRenderTokens->disableMotionBlur,
+        UsdRenderTokens->disableDepthOfField,
     };
     static TfTokenVector allNames =
         _ConcatenateAttributeNames(
index 1ff6628bfcfb33fda34274ca909ca97359732736..82b40e2e7a1f10f9f73da6e4d9a8e239487ed77d 100644 (file)
@@ -329,6 +329,30 @@ public:
     USDRENDER_API
     UsdAttribute CreateDisableMotionBlurAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
 
+public:
+    // --------------------------------------------------------------------- //
+    // DISABLEDEPTHOFFIELD 
+    // --------------------------------------------------------------------- //
+    /// Disable all depth of field by setting F-stop of the targeted
+    /// camera to infinity.
+    ///
+    /// | ||
+    /// | -- | -- |
+    /// | Declaration | `uniform bool disableDepthOfField = 0` |
+    /// | C++ Type | bool |
+    /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
+    /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
+    USDRENDER_API
+    UsdAttribute GetDisableDepthOfFieldAttr() const;
+
+    /// See GetDisableDepthOfFieldAttr(), and also 
+    /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
+    /// If specified, author \p defaultValue as the attribute's default,
+    /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
+    /// the default for \p writeSparsely is \c false.
+    USDRENDER_API
+    UsdAttribute CreateDisableDepthOfFieldAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
+
 public:
     // --------------------------------------------------------------------- //
     // CAMERA 
index b0633eedebcd8bb120a5889a4df6194c439bc823..ced5de505ea5621c5ff6914d49a75b0424ccac84 100644 (file)
@@ -123,6 +123,9 @@ _ReadSettingsBase(UsdRenderSettingsBase const& rsBase,
             pd->disableMotionBlur = true;
         }
     }
+
+    _Get(rsBase.GetDisableDepthOfFieldAttr(), 
+        &pd->disableDepthOfField, getDefault);
 }
 
 // TODO: Consolidate with CameraUtilConformedWindow().  Resolve policy
index 05c46697042bc8103a1668c48800cb36b952ac2b..89758f2c5d021c58e78a0c450fac81777895f9d0 100644 (file)
@@ -64,6 +64,8 @@ struct UsdRenderSpec {
         SdfPath cameraPath;
         /// If set to true, disables motion blur.
         bool disableMotionBlur;
+        /// If set to true, disables depth of field.
+        bool disableDepthOfField;
         /// The pixel resolution of the product.
         GfVec2i resolution;
         /// The pixel aspect ratio as adjusted by aspectRatioConformPolicy.
index aaf5cc2e9182376468100cdcc0a7cac754f19e25..7a41b4b9b246f2fad07b0e630946785ac00bb10f 100644 (file)
@@ -39,6 +39,7 @@ UsdRenderTokensType::UsdRenderTokensType() :
     dataWindowNDC("dataWindowNDC", TfToken::Immortal),
     denoiseEnable("denoise:enable", TfToken::Immortal),
     denoisePass("denoise:pass", TfToken::Immortal),
+    disableDepthOfField("disableDepthOfField", TfToken::Immortal),
     disableMotionBlur("disableMotionBlur", TfToken::Immortal),
     expandAperture("expandAperture", TfToken::Immortal),
     fileName("fileName", TfToken::Immortal),
@@ -86,6 +87,7 @@ UsdRenderTokensType::UsdRenderTokensType() :
         dataWindowNDC,
         denoiseEnable,
         denoisePass,
+        disableDepthOfField,
         disableMotionBlur,
         expandAperture,
         fileName,
index ae68e185b457dbbbb128bdc5502502d368342ae6..0b59575707ca39f9bce7c697c39cf446de89e773 100644 (file)
@@ -114,6 +114,10 @@ struct UsdRenderTokensType {
     /// 
     /// UsdRenderPass
     const TfToken denoisePass;
+    /// \brief "disableDepthOfField"
+    /// 
+    /// UsdRenderSettingsBase
+    const TfToken disableDepthOfField;
     /// \brief "disableMotionBlur"
     /// 
     /// UsdRenderSettingsBase
index ded4aa5a0424e5b9e9a185bf3cc881f024563119..f1c1b93af7e9424b7325e3dba779e466b9143ebc 100644 (file)
@@ -90,6 +90,13 @@ _CreateDisableMotionBlurAttr(UsdRenderSettingsBase &self,
     return self.CreateDisableMotionBlurAttr(
         UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
 }
+        
+static UsdAttribute
+_CreateDisableDepthOfFieldAttr(UsdRenderSettingsBase &self,
+                                      object defaultVal, bool writeSparsely) {
+    return self.CreateDisableDepthOfFieldAttr(
+        UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
+}
 
 static std::string
 _Repr(const UsdRenderSettingsBase &self)
@@ -171,6 +178,13 @@ void wrapUsdRenderSettingsBase()
              &_CreateDisableMotionBlurAttr,
              (arg("defaultValue")=object(),
               arg("writeSparsely")=false))
+        
+        .def("GetDisableDepthOfFieldAttr",
+             &This::GetDisableDepthOfFieldAttr)
+        .def("CreateDisableDepthOfFieldAttr",
+             &_CreateDisableDepthOfFieldAttr,
+             (arg("defaultValue")=object(),
+              arg("writeSparsely")=false))
 
         
         .def("GetCameraRel",
index c365c8feb2ebedc522247fdc59eba670ebd93166..2cd4d730beb9a882274ade2d1a55192835934867 100644 (file)
@@ -77,6 +77,7 @@ void wrapUsdRenderTokens()
     _AddToken(cls, "dataWindowNDC", UsdRenderTokens->dataWindowNDC);
     _AddToken(cls, "denoiseEnable", UsdRenderTokens->denoiseEnable);
     _AddToken(cls, "denoisePass", UsdRenderTokens->denoisePass);
+    _AddToken(cls, "disableDepthOfField", UsdRenderTokens->disableDepthOfField);
     _AddToken(cls, "disableMotionBlur", UsdRenderTokens->disableMotionBlur);
     _AddToken(cls, "expandAperture", UsdRenderTokens->expandAperture);
     _AddToken(cls, "fileName", UsdRenderTokens->fileName);
index 1efe14461b22fa6c48ab20127af54bbe28caf1e5..6d7f1e7472fd6ab3ec320c0c37fffb73413dcc94 100644 (file)
@@ -304,6 +304,7 @@ _ToHdRenderProducts(UsdRenderSpec const &renderSpec)
         hdProduct.dataWindowNDC = product.dataWindowNDC;
 
         hdProduct.disableMotionBlur = product.disableMotionBlur;
+        hdProduct.disableDepthOfField = product.disableDepthOfField;
         hdProduct.namespacedSettings = product.namespacedSettings;
 
         hdProducts.push_back(std::move(hdProduct));
index 2b2c9ab04936f8d39af94ba621f033fab0355375..e0272b37851e18011c417a6b5c35749ec48ba201 100644 (file)
@@ -51,6 +51,7 @@ TF_DEFINE_PRIVATE_TOKENS(
     (renderSettings_depOn_usdRenderSettings_aspectRatioConformPolicy)
     (renderSettings_depOn_usdRenderSettings_dataWindowNDC)
     (renderSettings_depOn_usdRenderSettings_disableMotionBlur)
+    (renderSettings_depOn_usdRenderSettings_disableDepthOfField)
     (renderSettings_depOn_usdRenderSettings_camera)
     (__dependencies_depOn_usdRenderSettings_products)
 );
@@ -231,6 +232,11 @@ _GetRenderSettingsDependenciesDataSource(
             UsdImagingUsdRenderSettingsSchema::GetDisableMotionBlurLocator(),
             HdRenderSettingsSchema::GetRenderProductsLocator(),
         },
+        {
+            _tokens->renderSettings_depOn_usdRenderSettings_disableDepthOfField,
+            UsdImagingUsdRenderSettingsSchema::GetDisableDepthOfFieldLocator(),
+            HdRenderSettingsSchema::GetRenderProductsLocator(),
+        },
         {
             _tokens->renderSettings_depOn_usdRenderSettings_camera,
             UsdImagingUsdRenderSettingsSchema::GetCameraLocator(),
@@ -377,6 +383,8 @@ _ToHdRenderProductDS(
             _Resolve(p.GetDataWindowNDC(), s.GetDataWindowNDC()))
         .SetDisableMotionBlur(
             _Resolve(p.GetDisableMotionBlur(), s.GetDisableMotionBlur()))
+        .SetDisableDepthOfField(
+            _Resolve(p.GetDisableDepthOfField(), s.GetDisableDepthOfField()))
         .SetNamespacedSettings(p.GetNamespacedSettings())
         .Build();
 }
index a0e6ee2dc83b495874da220e0156d80ca5d72f7b..fa2bb91e3c60134a4cc5cd921e2b26d527807a04 100644 (file)
@@ -33,6 +33,7 @@
 /* ************************************************************************** */
 
 #include "pxr/usdImaging/usdImaging/usdRenderProductSchema.h"
+
 #include "pxr/imaging/hd/retainedDataSource.h"
 
 #include "pxr/base/trace/trace.h"
@@ -48,9 +49,6 @@ TF_DEFINE_PUBLIC_TOKENS(UsdImagingUsdRenderProductSchemaTokens,
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-
-
-
 HdVec2iDataSourceHandle
 UsdImagingUsdRenderProductSchema::GetResolution()
 {
@@ -86,6 +84,13 @@ UsdImagingUsdRenderProductSchema::GetDisableMotionBlur()
         UsdImagingUsdRenderProductSchemaTokens->disableMotionBlur);
 }
 
+HdBoolDataSourceHandle
+UsdImagingUsdRenderProductSchema::GetDisableDepthOfField()
+{
+    return _GetTypedDataSource<HdBoolDataSource>(
+        UsdImagingUsdRenderProductSchemaTokens->disableDepthOfField);
+}
+
 HdPathDataSourceHandle
 UsdImagingUsdRenderProductSchema::GetCamera()
 {
@@ -129,6 +134,7 @@ UsdImagingUsdRenderProductSchema::BuildRetained(
         const HdTokenDataSourceHandle &aspectRatioConformPolicy,
         const HdVec4fDataSourceHandle &dataWindowNDC,
         const HdBoolDataSourceHandle &disableMotionBlur,
+        const HdBoolDataSourceHandle &disableDepthOfField,
         const HdPathDataSourceHandle &camera,
         const HdTokenDataSourceHandle &productType,
         const HdTokenDataSourceHandle &productName,
@@ -136,10 +142,11 @@ UsdImagingUsdRenderProductSchema::BuildRetained(
         const HdContainerDataSourceHandle &namespacedSettings
 )
 {
-    TfToken _names[10];
-    HdDataSourceBaseHandle _values[10];
+    TfToken _names[11];
+    HdDataSourceBaseHandle _values[11];
 
     size_t _count = 0;
+
     if (resolution) {
         _names[_count] = UsdImagingUsdRenderProductSchemaTokens->resolution;
         _values[_count++] = resolution;
@@ -165,6 +172,11 @@ UsdImagingUsdRenderProductSchema::BuildRetained(
         _values[_count++] = disableMotionBlur;
     }
 
+    if (disableDepthOfField) {
+        _names[_count] = UsdImagingUsdRenderProductSchemaTokens->disableDepthOfField;
+        _values[_count++] = disableDepthOfField;
+    }
+
     if (camera) {
         _names[_count] = UsdImagingUsdRenderProductSchemaTokens->camera;
         _values[_count++] = camera;
@@ -189,46 +201,9 @@ UsdImagingUsdRenderProductSchema::BuildRetained(
         _names[_count] = UsdImagingUsdRenderProductSchemaTokens->namespacedSettings;
         _values[_count++] = namespacedSettings;
     }
-
     return HdRetainedContainerDataSource::New(_count, _names, _values);
 }
 
-/*static*/
-UsdImagingUsdRenderProductSchema
-UsdImagingUsdRenderProductSchema::GetFromParent(
-        const HdContainerDataSourceHandle &fromParentContainer)
-{
-    return UsdImagingUsdRenderProductSchema(
-        fromParentContainer
-        ? HdContainerDataSource::Cast(fromParentContainer->Get(
-                UsdImagingUsdRenderProductSchemaTokens->__usdRenderProduct))
-        : nullptr);
-}
-
-/*static*/
-const TfToken &
-UsdImagingUsdRenderProductSchema::GetSchemaToken()
-{
-    return UsdImagingUsdRenderProductSchemaTokens->__usdRenderProduct;
-}
-
-/*static*/
-const HdDataSourceLocator &
-UsdImagingUsdRenderProductSchema::GetDefaultLocator()
-{
-    static const HdDataSourceLocator locator(GetSchemaToken());
-    return locator;
-} 
-
-/* static */
-const HdDataSourceLocator &
-UsdImagingUsdRenderProductSchema::GetNamespacedSettingsLocator()
-{
-    static const HdDataSourceLocator locator =
-        GetDefaultLocator().Append(
-            UsdImagingUsdRenderProductSchemaTokens->namespacedSettings);
-    return locator;
-}
 UsdImagingUsdRenderProductSchema::Builder &
 UsdImagingUsdRenderProductSchema::Builder::SetResolution(
     const HdVec2iDataSourceHandle &resolution)
@@ -269,6 +244,14 @@ UsdImagingUsdRenderProductSchema::Builder::SetDisableMotionBlur(
     return *this;
 }
 
+UsdImagingUsdRenderProductSchema::Builder &
+UsdImagingUsdRenderProductSchema::Builder::SetDisableDepthOfField(
+    const HdBoolDataSourceHandle &disableDepthOfField)
+{
+    _disableDepthOfField = disableDepthOfField;
+    return *this;
+}
+
 UsdImagingUsdRenderProductSchema::Builder &
 UsdImagingUsdRenderProductSchema::Builder::SetCamera(
     const HdPathDataSourceHandle &camera)
@@ -318,6 +301,7 @@ UsdImagingUsdRenderProductSchema::Builder::Build()
         _aspectRatioConformPolicy,
         _dataWindowNDC,
         _disableMotionBlur,
+        _disableDepthOfField,
         _camera,
         _productType,
         _productName,
@@ -326,5 +310,41 @@ UsdImagingUsdRenderProductSchema::Builder::Build()
     );
 }
 
+/*static*/
+UsdImagingUsdRenderProductSchema
+UsdImagingUsdRenderProductSchema::GetFromParent(
+        const HdContainerDataSourceHandle &fromParentContainer)
+{
+    return UsdImagingUsdRenderProductSchema(
+        fromParentContainer
+        ? HdContainerDataSource::Cast(fromParentContainer->Get(
+                UsdImagingUsdRenderProductSchemaTokens->__usdRenderProduct))
+        : nullptr);
+}
+
+/*static*/
+const TfToken &
+UsdImagingUsdRenderProductSchema::GetSchemaToken()
+{
+    return UsdImagingUsdRenderProductSchemaTokens->__usdRenderProduct;
+}
+
+/*static*/
+const HdDataSourceLocator &
+UsdImagingUsdRenderProductSchema::GetDefaultLocator()
+{
+    static const HdDataSourceLocator locator(GetSchemaToken());
+    return locator;
+}
+
+/* static */
+const HdDataSourceLocator &
+UsdImagingUsdRenderProductSchema::GetNamespacedSettingsLocator()
+{
+    static const HdDataSourceLocator locator =
+        GetDefaultLocator().Append(
+            UsdImagingUsdRenderProductSchemaTokens->namespacedSettings);
+    return locator;
+} 
 
 PXR_NAMESPACE_CLOSE_SCOPE
\ No newline at end of file
index a15d7bc74d84f9555ece934511b0c4569ea8f842..3afe001452f14a73efffa011779970116d9e4663 100644 (file)
 #ifndef PXR_USD_IMAGING_USD_IMAGING_USD_RENDER_PRODUCT_SCHEMA_H
 #define PXR_USD_IMAGING_USD_IMAGING_USD_RENDER_PRODUCT_SCHEMA_H
 
+/// \file
+
 #include "pxr/usdImaging/usdImaging/api.h"
 
-#include "pxr/imaging/hd/schema.h" 
+#include "pxr/imaging/hd/schema.h"
 
 // --(BEGIN CUSTOM CODE: Includes)--
 // --(END CUSTOM CODE: Includes)--
 
 PXR_NAMESPACE_OPEN_SCOPE
 
-//-----------------------------------------------------------------------------
-
 // --(BEGIN CUSTOM CODE: Declares)--
 // --(END CUSTOM CODE: Declares)--
 
-//-----------------------------------------------------------------------------
-
 #define USD_IMAGING_USD_RENDER_PRODUCT_SCHEMA_TOKENS \
     (__usdRenderProduct) \
     (resolution) \
@@ -58,6 +56,7 @@ PXR_NAMESPACE_OPEN_SCOPE
     (aspectRatioConformPolicy) \
     (dataWindowNDC) \
     (disableMotionBlur) \
+    (disableDepthOfField) \
     (camera) \
     (productType) \
     (productName) \
@@ -68,17 +67,33 @@ TF_DECLARE_PUBLIC_TOKENS(UsdImagingUsdRenderProductSchemaTokens, USDIMAGING_API,
     USD_IMAGING_USD_RENDER_PRODUCT_SCHEMA_TOKENS);
 
 //-----------------------------------------------------------------------------
+
+
 class UsdImagingUsdRenderProductSchema : public HdSchema
 {
 public:
+    /// \name Schema retrieval
+    /// @{
+
     UsdImagingUsdRenderProductSchema(HdContainerDataSourceHandle container)
-    : HdSchema(container) {}
+      : HdSchema(container) {}
+
+    /// Retrieves a container data source with the schema's default name token
+    /// "__usdRenderProduct" from the parent container and constructs a
+    /// UsdImagingUsdRenderProductSchema instance.
+    /// Because the requested container data source may not exist, the result
+    /// should be checked with IsDefined() or a bool comparison before use.
+    USDIMAGING_API
+    static UsdImagingUsdRenderProductSchema GetFromParent(
+        const HdContainerDataSourceHandle &fromParentContainer);
+
+    /// @}
 
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-    //ACCESSORS
-
+    /// \name Member accessor
+    /// @{
 
     USDIMAGING_API
     HdVec2iDataSourceHandle GetResolution();
@@ -95,6 +110,9 @@ public:
     USDIMAGING_API
     HdBoolDataSourceHandle GetDisableMotionBlur();
 
+    USDIMAGING_API
+    HdBoolDataSourceHandle GetDisableDepthOfField();
+
     USDIMAGING_API
     HdPathDataSourceHandle GetCamera();
 
@@ -108,10 +126,44 @@ public:
     HdPathArrayDataSourceHandle GetOrderedVars();
 
     USDIMAGING_API
-    HdContainerDataSourceHandle GetNamespacedSettings();
+    HdContainerDataSourceHandle GetNamespacedSettings(); 
+
+    /// @}
+
+    /// \name Schema location
+    /// @{
+
+    /// Returns a token where the container representing this schema is found in
+    /// a container by default.
+    USDIMAGING_API
+    static const TfToken &GetSchemaToken();
+
+    /// Returns an HdDataSourceLocator (relative to the prim-level data source)
+    /// where the container representing this schema is found by default.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetDefaultLocator();
+
+    /// @}
 
-    // RETRIEVING AND CONSTRUCTING
+    /// \name Data source locators for members
+    ///
+    /// The following methods return an HdDataSourceLocator (relative to the
+    /// prim-level data source) where the data source for a member can be found.
+    ///
+    /// This is often useful for checking intersection against the
+    /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
+    /// @{
 
+    /// Prim-level relative data source locator to locate namespacedSettings.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetNamespacedSettingsLocator();
+    /// @} 
+
+    /// \name Schema construction
+    /// @{
+
+    /// \deprecated Use Builder instead.
+    ///
     /// Builds a container data source which includes the provided child data
     /// sources. Parameters with nullptr values are excluded. This is a
     /// low-level interface. For cases in which it's desired to define
@@ -125,6 +177,7 @@ public:
         const HdTokenDataSourceHandle &aspectRatioConformPolicy,
         const HdVec4fDataSourceHandle &dataWindowNDC,
         const HdBoolDataSourceHandle &disableMotionBlur,
+        const HdBoolDataSourceHandle &disableDepthOfField,
         const HdPathDataSourceHandle &camera,
         const HdTokenDataSourceHandle &productType,
         const HdTokenDataSourceHandle &productName,
@@ -157,6 +210,9 @@ public:
         Builder &SetDisableMotionBlur(
             const HdBoolDataSourceHandle &disableMotionBlur);
         USDIMAGING_API
+        Builder &SetDisableDepthOfField(
+            const HdBoolDataSourceHandle &disableDepthOfField);
+        USDIMAGING_API
         Builder &SetCamera(
             const HdPathDataSourceHandle &camera);
         USDIMAGING_API
@@ -182,46 +238,16 @@ public:
         HdTokenDataSourceHandle _aspectRatioConformPolicy;
         HdVec4fDataSourceHandle _dataWindowNDC;
         HdBoolDataSourceHandle _disableMotionBlur;
+        HdBoolDataSourceHandle _disableDepthOfField;
         HdPathDataSourceHandle _camera;
         HdTokenDataSourceHandle _productType;
         HdTokenDataSourceHandle _productName;
         HdPathArrayDataSourceHandle _orderedVars;
         HdContainerDataSourceHandle _namespacedSettings;
-    };
-
-    /// Retrieves a container data source with the schema's default name token
-    /// "__usdRenderProduct" from the parent container and constructs a
-    /// UsdImagingUsdRenderProductSchema instance.
-    /// Because the requested container data source may not exist, the result
-    /// should be checked with IsDefined() or a bool comparison before use.
-    USDIMAGING_API
-    static UsdImagingUsdRenderProductSchema GetFromParent(
-        const HdContainerDataSourceHandle &fromParentContainer);
-
-    /// Returns a token where the container representing this schema is found in
-    /// a container by default.
-    USDIMAGING_API
-    static const TfToken &GetSchemaToken();
-
-    /// Returns an HdDataSourceLocator (relative to the prim-level data source)
-    /// where the container representing this schema is found by default.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetDefaultLocator();
-
-    // DATA SOURCE LOCATORS FOR MEMBERS
-    //
-    // The following methods return an HdDataSourceLocator (relative to the
-    // prim-level data source) where the data source for a member can be found.
-    //
-    // This is often useful for checking intersection against the
-    // HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
-
-
-    /// Prim-level relative data source locator to locate namespacedSettings.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetNamespacedSettingsLocator();
 
+    };
 
+    /// @}
 };
 
 PXR_NAMESPACE_CLOSE_SCOPE
index dc074735ef56a60a9b781545b3fcf7629efc898f..d15df83d73755b42c103e03a0e88677b89033be7 100644 (file)
@@ -33,6 +33,7 @@
 /* ************************************************************************** */
 
 #include "pxr/usdImaging/usdImaging/usdRenderSettingsSchema.h"
+
 #include "pxr/imaging/hd/retainedDataSource.h"
 
 #include "pxr/base/trace/trace.h"
@@ -48,9 +49,6 @@ TF_DEFINE_PUBLIC_TOKENS(UsdImagingUsdRenderSettingsSchemaTokens,
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-
-
-
 HdVec2iDataSourceHandle
 UsdImagingUsdRenderSettingsSchema::GetResolution()
 {
@@ -86,6 +84,13 @@ UsdImagingUsdRenderSettingsSchema::GetDisableMotionBlur()
         UsdImagingUsdRenderSettingsSchemaTokens->disableMotionBlur);
 }
 
+HdBoolDataSourceHandle
+UsdImagingUsdRenderSettingsSchema::GetDisableDepthOfField()
+{
+    return _GetTypedDataSource<HdBoolDataSource>(
+        UsdImagingUsdRenderSettingsSchemaTokens->disableDepthOfField);
+}
+
 HdPathDataSourceHandle
 UsdImagingUsdRenderSettingsSchema::GetCamera()
 {
@@ -136,6 +141,7 @@ UsdImagingUsdRenderSettingsSchema::BuildRetained(
         const HdTokenDataSourceHandle &aspectRatioConformPolicy,
         const HdVec4fDataSourceHandle &dataWindowNDC,
         const HdBoolDataSourceHandle &disableMotionBlur,
+        const HdBoolDataSourceHandle &disableDepthOfField,
         const HdPathDataSourceHandle &camera,
         const HdTokenArrayDataSourceHandle &includedPurposes,
         const HdTokenArrayDataSourceHandle &materialBindingPurposes,
@@ -144,10 +150,11 @@ UsdImagingUsdRenderSettingsSchema::BuildRetained(
         const HdContainerDataSourceHandle &namespacedSettings
 )
 {
-    TfToken _names[11];
-    HdDataSourceBaseHandle _values[11];
+    TfToken _names[12];
+    HdDataSourceBaseHandle _values[12];
 
     size_t _count = 0;
+
     if (resolution) {
         _names[_count] = UsdImagingUsdRenderSettingsSchemaTokens->resolution;
         _values[_count++] = resolution;
@@ -173,6 +180,11 @@ UsdImagingUsdRenderSettingsSchema::BuildRetained(
         _values[_count++] = disableMotionBlur;
     }
 
+    if (disableDepthOfField) {
+        _names[_count] = UsdImagingUsdRenderSettingsSchemaTokens->disableDepthOfField;
+        _values[_count++] = disableDepthOfField;
+    }
+
     if (camera) {
         _names[_count] = UsdImagingUsdRenderSettingsSchemaTokens->camera;
         _values[_count++] = camera;
@@ -202,10 +214,124 @@ UsdImagingUsdRenderSettingsSchema::BuildRetained(
         _names[_count] = UsdImagingUsdRenderSettingsSchemaTokens->namespacedSettings;
         _values[_count++] = namespacedSettings;
     }
-
     return HdRetainedContainerDataSource::New(_count, _names, _values);
 }
 
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetResolution(
+    const HdVec2iDataSourceHandle &resolution)
+{
+    _resolution = resolution;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetPixelAspectRatio(
+    const HdFloatDataSourceHandle &pixelAspectRatio)
+{
+    _pixelAspectRatio = pixelAspectRatio;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetAspectRatioConformPolicy(
+    const HdTokenDataSourceHandle &aspectRatioConformPolicy)
+{
+    _aspectRatioConformPolicy = aspectRatioConformPolicy;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetDataWindowNDC(
+    const HdVec4fDataSourceHandle &dataWindowNDC)
+{
+    _dataWindowNDC = dataWindowNDC;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetDisableMotionBlur(
+    const HdBoolDataSourceHandle &disableMotionBlur)
+{
+    _disableMotionBlur = disableMotionBlur;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetDisableDepthOfField(
+    const HdBoolDataSourceHandle &disableDepthOfField)
+{
+    _disableDepthOfField = disableDepthOfField;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetCamera(
+    const HdPathDataSourceHandle &camera)
+{
+    _camera = camera;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetIncludedPurposes(
+    const HdTokenArrayDataSourceHandle &includedPurposes)
+{
+    _includedPurposes = includedPurposes;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetMaterialBindingPurposes(
+    const HdTokenArrayDataSourceHandle &materialBindingPurposes)
+{
+    _materialBindingPurposes = materialBindingPurposes;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetRenderingColorSpace(
+    const HdTokenDataSourceHandle &renderingColorSpace)
+{
+    _renderingColorSpace = renderingColorSpace;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetProducts(
+    const HdPathArrayDataSourceHandle &products)
+{
+    _products = products;
+    return *this;
+}
+
+UsdImagingUsdRenderSettingsSchema::Builder &
+UsdImagingUsdRenderSettingsSchema::Builder::SetNamespacedSettings(
+    const HdContainerDataSourceHandle &namespacedSettings)
+{
+    _namespacedSettings = namespacedSettings;
+    return *this;
+}
+
+HdContainerDataSourceHandle
+UsdImagingUsdRenderSettingsSchema::Builder::Build()
+{
+    return UsdImagingUsdRenderSettingsSchema::BuildRetained(
+        _resolution,
+        _pixelAspectRatio,
+        _aspectRatioConformPolicy,
+        _dataWindowNDC,
+        _disableMotionBlur,
+        _disableDepthOfField,
+        _camera,
+        _includedPurposes,
+        _materialBindingPurposes,
+        _renderingColorSpace,
+        _products,
+        _namespacedSettings
+    );
+}
+
 /*static*/
 UsdImagingUsdRenderSettingsSchema
 UsdImagingUsdRenderSettingsSchema::GetFromParent(
@@ -231,7 +357,7 @@ UsdImagingUsdRenderSettingsSchema::GetDefaultLocator()
 {
     static const HdDataSourceLocator locator(GetSchemaToken());
     return locator;
-} 
+}
 
 /* static */
 const HdDataSourceLocator &
@@ -283,6 +409,16 @@ UsdImagingUsdRenderSettingsSchema::GetDisableMotionBlurLocator()
     return locator;
 }
 
+/* static */
+const HdDataSourceLocator &
+UsdImagingUsdRenderSettingsSchema::GetDisableDepthOfFieldLocator()
+{
+    static const HdDataSourceLocator locator =
+        GetDefaultLocator().Append(
+            UsdImagingUsdRenderSettingsSchemaTokens->disableDepthOfField);
+    return locator;
+}
+
 /* static */
 const HdDataSourceLocator &
 UsdImagingUsdRenderSettingsSchema::GetCameraLocator()
@@ -341,112 +477,6 @@ UsdImagingUsdRenderSettingsSchema::GetNamespacedSettingsLocator()
         GetDefaultLocator().Append(
             UsdImagingUsdRenderSettingsSchemaTokens->namespacedSettings);
     return locator;
-}
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetResolution(
-    const HdVec2iDataSourceHandle &resolution)
-{
-    _resolution = resolution;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetPixelAspectRatio(
-    const HdFloatDataSourceHandle &pixelAspectRatio)
-{
-    _pixelAspectRatio = pixelAspectRatio;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetAspectRatioConformPolicy(
-    const HdTokenDataSourceHandle &aspectRatioConformPolicy)
-{
-    _aspectRatioConformPolicy = aspectRatioConformPolicy;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetDataWindowNDC(
-    const HdVec4fDataSourceHandle &dataWindowNDC)
-{
-    _dataWindowNDC = dataWindowNDC;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetDisableMotionBlur(
-    const HdBoolDataSourceHandle &disableMotionBlur)
-{
-    _disableMotionBlur = disableMotionBlur;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetCamera(
-    const HdPathDataSourceHandle &camera)
-{
-    _camera = camera;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetIncludedPurposes(
-    const HdTokenArrayDataSourceHandle &includedPurposes)
-{
-    _includedPurposes = includedPurposes;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetMaterialBindingPurposes(
-    const HdTokenArrayDataSourceHandle &materialBindingPurposes)
-{
-    _materialBindingPurposes = materialBindingPurposes;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetRenderingColorSpace(
-    const HdTokenDataSourceHandle &renderingColorSpace)
-{
-    _renderingColorSpace = renderingColorSpace;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetProducts(
-    const HdPathArrayDataSourceHandle &products)
-{
-    _products = products;
-    return *this;
-}
-
-UsdImagingUsdRenderSettingsSchema::Builder &
-UsdImagingUsdRenderSettingsSchema::Builder::SetNamespacedSettings(
-    const HdContainerDataSourceHandle &namespacedSettings)
-{
-    _namespacedSettings = namespacedSettings;
-    return *this;
-}
-
-HdContainerDataSourceHandle
-UsdImagingUsdRenderSettingsSchema::Builder::Build()
-{
-    return UsdImagingUsdRenderSettingsSchema::BuildRetained(
-        _resolution,
-        _pixelAspectRatio,
-        _aspectRatioConformPolicy,
-        _dataWindowNDC,
-        _disableMotionBlur,
-        _camera,
-        _includedPurposes,
-        _materialBindingPurposes,
-        _renderingColorSpace,
-        _products,
-        _namespacedSettings
-    );
-}
-
+} 
 
 PXR_NAMESPACE_CLOSE_SCOPE
\ No newline at end of file
index 58c4ba8dd80f454d40844bde0119ecca2456b540..46bd8243aed32fa9e7a42cf43effb816ec99f91a 100644 (file)
 #ifndef PXR_USD_IMAGING_USD_IMAGING_USD_RENDER_SETTINGS_SCHEMA_H
 #define PXR_USD_IMAGING_USD_IMAGING_USD_RENDER_SETTINGS_SCHEMA_H
 
+/// \file
+
 #include "pxr/usdImaging/usdImaging/api.h"
 
-#include "pxr/imaging/hd/schema.h" 
+#include "pxr/imaging/hd/schema.h"
 
 // --(BEGIN CUSTOM CODE: Includes)--
 // --(END CUSTOM CODE: Includes)--
 
 PXR_NAMESPACE_OPEN_SCOPE
 
-//-----------------------------------------------------------------------------
-
 // --(BEGIN CUSTOM CODE: Declares)--
 // --(END CUSTOM CODE: Declares)--
 
-//-----------------------------------------------------------------------------
-
 #define USD_IMAGING_USD_RENDER_SETTINGS_SCHEMA_TOKENS \
     (__usdRenderSettings) \
     (resolution) \
@@ -58,6 +56,7 @@ PXR_NAMESPACE_OPEN_SCOPE
     (aspectRatioConformPolicy) \
     (dataWindowNDC) \
     (disableMotionBlur) \
+    (disableDepthOfField) \
     (camera) \
     (includedPurposes) \
     (materialBindingPurposes) \
@@ -69,17 +68,33 @@ TF_DECLARE_PUBLIC_TOKENS(UsdImagingUsdRenderSettingsSchemaTokens, USDIMAGING_API
     USD_IMAGING_USD_RENDER_SETTINGS_SCHEMA_TOKENS);
 
 //-----------------------------------------------------------------------------
+
+
 class UsdImagingUsdRenderSettingsSchema : public HdSchema
 {
 public:
+    /// \name Schema retrieval
+    /// @{
+
     UsdImagingUsdRenderSettingsSchema(HdContainerDataSourceHandle container)
-    : HdSchema(container) {}
+      : HdSchema(container) {}
+
+    /// Retrieves a container data source with the schema's default name token
+    /// "__usdRenderSettings" from the parent container and constructs a
+    /// UsdImagingUsdRenderSettingsSchema instance.
+    /// Because the requested container data source may not exist, the result
+    /// should be checked with IsDefined() or a bool comparison before use.
+    USDIMAGING_API
+    static UsdImagingUsdRenderSettingsSchema GetFromParent(
+        const HdContainerDataSourceHandle &fromParentContainer);
+
+    /// @}
 
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-    //ACCESSORS
-
+    /// \name Member accessor
+    /// @{
 
     USDIMAGING_API
     HdVec2iDataSourceHandle GetResolution();
@@ -96,6 +111,9 @@ public:
     USDIMAGING_API
     HdBoolDataSourceHandle GetDisableMotionBlur();
 
+    USDIMAGING_API
+    HdBoolDataSourceHandle GetDisableDepthOfField();
+
     USDIMAGING_API
     HdPathDataSourceHandle GetCamera();
 
@@ -112,10 +130,88 @@ public:
     HdPathArrayDataSourceHandle GetProducts();
 
     USDIMAGING_API
-    HdContainerDataSourceHandle GetNamespacedSettings();
+    HdContainerDataSourceHandle GetNamespacedSettings(); 
+
+    /// @}
+
+    /// \name Schema location
+    /// @{
+
+    /// Returns a token where the container representing this schema is found in
+    /// a container by default.
+    USDIMAGING_API
+    static const TfToken &GetSchemaToken();
 
-    // RETRIEVING AND CONSTRUCTING
+    /// Returns an HdDataSourceLocator (relative to the prim-level data source)
+    /// where the container representing this schema is found by default.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetDefaultLocator();
+
+    /// @}
+
+    /// \name Data source locators for members
+    ///
+    /// The following methods return an HdDataSourceLocator (relative to the
+    /// prim-level data source) where the data source for a member can be found.
+    ///
+    /// This is often useful for checking intersection against the
+    /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
+    /// @{
+
+    /// Prim-level relative data source locator to locate resolution.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetResolutionLocator();
 
+    /// Prim-level relative data source locator to locate pixelAspectRatio.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetPixelAspectRatioLocator();
+
+    /// Prim-level relative data source locator to locate aspectRatioConformPolicy.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetAspectRatioConformPolicyLocator();
+
+    /// Prim-level relative data source locator to locate dataWindowNDC.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetDataWindowNDCLocator();
+
+    /// Prim-level relative data source locator to locate disableMotionBlur.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetDisableMotionBlurLocator();
+
+    /// Prim-level relative data source locator to locate disableDepthOfField.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetDisableDepthOfFieldLocator();
+
+    /// Prim-level relative data source locator to locate camera.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetCameraLocator();
+
+    /// Prim-level relative data source locator to locate includedPurposes.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetIncludedPurposesLocator();
+
+    /// Prim-level relative data source locator to locate materialBindingPurposes.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetMaterialBindingPurposesLocator();
+
+    /// Prim-level relative data source locator to locate renderingColorSpace.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetRenderingColorSpaceLocator();
+
+    /// Prim-level relative data source locator to locate products.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetProductsLocator();
+
+    /// Prim-level relative data source locator to locate namespacedSettings.
+    USDIMAGING_API
+    static const HdDataSourceLocator &GetNamespacedSettingsLocator();
+    /// @} 
+
+    /// \name Schema construction
+    /// @{
+
+    /// \deprecated Use Builder instead.
+    ///
     /// Builds a container data source which includes the provided child data
     /// sources. Parameters with nullptr values are excluded. This is a
     /// low-level interface. For cases in which it's desired to define
@@ -129,6 +225,7 @@ public:
         const HdTokenDataSourceHandle &aspectRatioConformPolicy,
         const HdVec4fDataSourceHandle &dataWindowNDC,
         const HdBoolDataSourceHandle &disableMotionBlur,
+        const HdBoolDataSourceHandle &disableDepthOfField,
         const HdPathDataSourceHandle &camera,
         const HdTokenArrayDataSourceHandle &includedPurposes,
         const HdTokenArrayDataSourceHandle &materialBindingPurposes,
@@ -162,6 +259,9 @@ public:
         Builder &SetDisableMotionBlur(
             const HdBoolDataSourceHandle &disableMotionBlur);
         USDIMAGING_API
+        Builder &SetDisableDepthOfField(
+            const HdBoolDataSourceHandle &disableDepthOfField);
+        USDIMAGING_API
         Builder &SetCamera(
             const HdPathDataSourceHandle &camera);
         USDIMAGING_API
@@ -190,87 +290,17 @@ public:
         HdTokenDataSourceHandle _aspectRatioConformPolicy;
         HdVec4fDataSourceHandle _dataWindowNDC;
         HdBoolDataSourceHandle _disableMotionBlur;
+        HdBoolDataSourceHandle _disableDepthOfField;
         HdPathDataSourceHandle _camera;
         HdTokenArrayDataSourceHandle _includedPurposes;
         HdTokenArrayDataSourceHandle _materialBindingPurposes;
         HdTokenDataSourceHandle _renderingColorSpace;
         HdPathArrayDataSourceHandle _products;
         HdContainerDataSourceHandle _namespacedSettings;
-    };
-
-    /// Retrieves a container data source with the schema's default name token
-    /// "__usdRenderSettings" from the parent container and constructs a
-    /// UsdImagingUsdRenderSettingsSchema instance.
-    /// Because the requested container data source may not exist, the result
-    /// should be checked with IsDefined() or a bool comparison before use.
-    USDIMAGING_API
-    static UsdImagingUsdRenderSettingsSchema GetFromParent(
-        const HdContainerDataSourceHandle &fromParentContainer);
-
-    /// Returns a token where the container representing this schema is found in
-    /// a container by default.
-    USDIMAGING_API
-    static const TfToken &GetSchemaToken();
-
-    /// Returns an HdDataSourceLocator (relative to the prim-level data source)
-    /// where the container representing this schema is found by default.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetDefaultLocator();
-
-    // DATA SOURCE LOCATORS FOR MEMBERS
-    //
-    // The following methods return an HdDataSourceLocator (relative to the
-    // prim-level data source) where the data source for a member can be found.
-    //
-    // This is often useful for checking intersection against the
-    // HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
-
-
-    /// Prim-level relative data source locator to locate resolution.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetResolutionLocator();
-
-    /// Prim-level relative data source locator to locate pixelAspectRatio.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetPixelAspectRatioLocator();
-
-    /// Prim-level relative data source locator to locate aspectRatioConformPolicy.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetAspectRatioConformPolicyLocator();
-
-    /// Prim-level relative data source locator to locate dataWindowNDC.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetDataWindowNDCLocator();
-
-    /// Prim-level relative data source locator to locate disableMotionBlur.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetDisableMotionBlurLocator();
-
-    /// Prim-level relative data source locator to locate camera.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetCameraLocator();
-
-    /// Prim-level relative data source locator to locate includedPurposes.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetIncludedPurposesLocator();
-
-    /// Prim-level relative data source locator to locate materialBindingPurposes.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetMaterialBindingPurposesLocator();
-
-    /// Prim-level relative data source locator to locate renderingColorSpace.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetRenderingColorSpaceLocator();
-
-    /// Prim-level relative data source locator to locate products.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetProductsLocator();
-
-    /// Prim-level relative data source locator to locate namespacedSettings.
-    USDIMAGING_API
-    static const HdDataSourceLocator &GetNamespacedSettingsLocator();
 
+    };
 
+    /// @}
 };
 
 PXR_NAMESPACE_CLOSE_SCOPE
index 4c7fbcb798d2979efcd528aa4754bc46f90c1cd7..741d3896525c9ff9e2b7cc38386221af036968cd 100644 (file)
@@ -355,6 +355,7 @@ PopulateFallbackRenderSpec(
                 TfToken(outputFilename),                // name
                 SdfPath(),                              // camera path
                 false,                                  // disableMotionBlur
+                false,                                  // disableDepthOfField
                 s_fallbackResolution,                   // resolution
                 1.0f,                                   // PixelAspectRatio
                 s_fallbackConformPolicy,                // aspectRatioConformPolicy