Hydra schema generation: making generated code doxygen friendly.
authorunhyperbolic <unhyperbolic@users.noreply.github.com>
Tue, 19 Dec 2023 23:52:59 +0000 (15:52 -0800)
committerpixar-oss <pixar-oss@users.noreply.github.com>
Tue, 19 Dec 2023 23:52:59 +0000 (15:52 -0800)
(Internal change: 2309493)

pxr/imaging/hd/cameraSchema.cpp
pxr/imaging/hd/cameraSchema.h

index f9f4ae516215afb7e0822886692017d27e5d42e8..85e01ee923d33b0b658d8525c2145f1983e86faf 100644 (file)
@@ -33,6 +33,7 @@
 /* ************************************************************************** */
 
 #include "pxr/imaging/hd/cameraSchema.h"
+
 #include "pxr/imaging/hd/retainedDataSource.h"
 
 #include "pxr/base/trace/trace.h"
@@ -48,9 +49,6 @@ TF_DEFINE_PUBLIC_TOKENS(HdCameraSchemaTokens,
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-
-
-
 HdTokenDataSourceHandle
 HdCameraSchema::GetProjection()
 {
@@ -196,6 +194,7 @@ HdCameraSchema::BuildRetained(
     HdDataSourceBaseHandle _values[17];
 
     size_t _count = 0;
+
     if (projection) {
         _names[_count] = HdCameraSchemaTokens->projection;
         _values[_count++] = projection;
@@ -280,77 +279,9 @@ HdCameraSchema::BuildRetained(
         _names[_count] = HdCameraSchemaTokens->lensDistortion;
         _values[_count++] = lensDistortion;
     }
-
     return HdRetainedContainerDataSource::New(_count, _names, _values);
 }
 
-/*static*/
-HdCameraSchema
-HdCameraSchema::GetFromParent(
-        const HdContainerDataSourceHandle &fromParentContainer)
-{
-    return HdCameraSchema(
-        fromParentContainer
-        ? HdContainerDataSource::Cast(fromParentContainer->Get(
-                HdCameraSchemaTokens->camera))
-        : nullptr);
-}
-
-/*static*/
-const TfToken &
-HdCameraSchema::GetSchemaToken()
-{
-    return HdCameraSchemaTokens->camera;
-}
-
-/*static*/
-const HdDataSourceLocator &
-HdCameraSchema::GetDefaultLocator()
-{
-    static const HdDataSourceLocator locator(GetSchemaToken());
-    return locator;
-} 
-
-/* static */
-const HdDataSourceLocator &
-HdCameraSchema::GetShutterOpenLocator()
-{
-    static const HdDataSourceLocator locator =
-        GetDefaultLocator().Append(
-            HdCameraSchemaTokens->shutterOpen);
-    return locator;
-}
-
-/* static */
-const HdDataSourceLocator &
-HdCameraSchema::GetShutterCloseLocator()
-{
-    static const HdDataSourceLocator locator =
-        GetDefaultLocator().Append(
-            HdCameraSchemaTokens->shutterClose);
-    return locator;
-}
-
-/*static*/
-HdTokenDataSourceHandle
-HdCameraSchema::BuildProjectionDataSource(
-    const TfToken &projection)
-{
-
-    if (projection == HdCameraSchemaTokens->perspective) {
-        static const HdRetainedTypedSampledDataSource<TfToken>::Handle ds =
-            HdRetainedTypedSampledDataSource<TfToken>::New(projection);
-        return ds;
-    }
-    if (projection == HdCameraSchemaTokens->orthographic) {
-        static const HdRetainedTypedSampledDataSource<TfToken>::Handle ds =
-            HdRetainedTypedSampledDataSource<TfToken>::New(projection);
-        return ds;
-    }
-    // fallback for unknown token
-    return HdRetainedTypedSampledDataSource<TfToken>::New(projection);
-}
-
 HdCameraSchema::Builder &
 HdCameraSchema::Builder::SetProjection(
     const HdTokenDataSourceHandle &projection)
@@ -511,5 +442,71 @@ HdCameraSchema::Builder::Build()
     );
 }
 
+/*static*/
+HdCameraSchema
+HdCameraSchema::GetFromParent(
+        const HdContainerDataSourceHandle &fromParentContainer)
+{
+    return HdCameraSchema(
+        fromParentContainer
+        ? HdContainerDataSource::Cast(fromParentContainer->Get(
+                HdCameraSchemaTokens->camera))
+        : nullptr);
+}
+
+/*static*/
+const TfToken &
+HdCameraSchema::GetSchemaToken()
+{
+    return HdCameraSchemaTokens->camera;
+}
+
+/*static*/
+const HdDataSourceLocator &
+HdCameraSchema::GetDefaultLocator()
+{
+    static const HdDataSourceLocator locator(GetSchemaToken());
+    return locator;
+}
+
+/* static */
+const HdDataSourceLocator &
+HdCameraSchema::GetShutterOpenLocator()
+{
+    static const HdDataSourceLocator locator =
+        GetDefaultLocator().Append(
+            HdCameraSchemaTokens->shutterOpen);
+    return locator;
+}
+
+/* static */
+const HdDataSourceLocator &
+HdCameraSchema::GetShutterCloseLocator()
+{
+    static const HdDataSourceLocator locator =
+        GetDefaultLocator().Append(
+            HdCameraSchemaTokens->shutterClose);
+    return locator;
+}
+
+/*static*/
+HdTokenDataSourceHandle
+HdCameraSchema::BuildProjectionDataSource(
+    const TfToken &projection)
+{
+
+    if (projection == HdCameraSchemaTokens->perspective) {
+        static const HdRetainedTypedSampledDataSource<TfToken>::Handle ds =
+            HdRetainedTypedSampledDataSource<TfToken>::New(projection);
+        return ds;
+    }
+    if (projection == HdCameraSchemaTokens->orthographic) {
+        static const HdRetainedTypedSampledDataSource<TfToken>::Handle ds =
+            HdRetainedTypedSampledDataSource<TfToken>::New(projection);
+        return ds;
+    }
+    // fallback for unknown token
+    return HdRetainedTypedSampledDataSource<TfToken>::New(projection);
+} 
 
 PXR_NAMESPACE_CLOSE_SCOPE
\ No newline at end of file
index c92d14d2e601ae0345848c2fc0635eec67bd67a6..1e10b44cc4e9edb1f6da5638d8e3ef320b9ad30a 100644 (file)
 #ifndef PXR_IMAGING_HD_CAMERA_SCHEMA_H
 #define PXR_IMAGING_HD_CAMERA_SCHEMA_H
 
-#include "pxr/imaging/hd/api.h"
+/// \file
 
+#include "pxr/imaging/hd/api.h"
 #include "pxr/imaging/hd/splitDiopterSchema.h"
 #include "pxr/imaging/hd/lensDistortionSchema.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 HD_CAMERA_SCHEMA_TOKENS \
     (camera) \
     (projection) \
@@ -79,17 +77,33 @@ TF_DECLARE_PUBLIC_TOKENS(HdCameraSchemaTokens, HD_API,
     HD_CAMERA_SCHEMA_TOKENS);
 
 //-----------------------------------------------------------------------------
+
+
 class HdCameraSchema : public HdSchema
 {
 public:
+    /// \name Schema retrieval
+    /// @{
+
     HdCameraSchema(HdContainerDataSourceHandle container)
-    : HdSchema(container) {}
+      : HdSchema(container) {}
+
+    /// Retrieves a container data source with the schema's default name token
+    /// "camera" from the parent container and constructs a
+    /// HdCameraSchema 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 HdCameraSchema GetFromParent(
+        const HdContainerDataSourceHandle &fromParentContainer);
+
+    /// @}
 
 // --(BEGIN CUSTOM CODE: Schema Methods)--
 // --(END CUSTOM CODE: Schema Methods)--
 
-    //ACCESSORS
-
+    /// \name Member accessor
+    /// @{
 
     HD_API
     HdTokenDataSourceHandle GetProjection();
@@ -140,9 +154,45 @@ public:
     HdSplitDiopterSchema GetSplitDiopter();
 
     HD_API
-    HdLensDistortionSchema GetLensDistortion();
+    HdLensDistortionSchema GetLensDistortion(); 
+
+    /// @}
+
+    /// \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();
+
+    /// @}
 
-    // 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 shutterOpen.
+    HD_API
+    static const HdDataSourceLocator &GetShutterOpenLocator();
+
+    /// Prim-level relative data source locator to locate shutterClose.
+    HD_API
+    static const HdDataSourceLocator &GetShutterCloseLocator();
+    /// @} 
+
+    /// \name Schema construction
+    /// @{
 
     /// Builds a container data source which includes the provided child data
     /// sources. Parameters with nullptr values are excluded. This is a
@@ -254,54 +304,20 @@ public:
         HdFloatDataSourceHandle _dofAspect;
         HdContainerDataSourceHandle _splitDiopter;
         HdContainerDataSourceHandle _lensDistortion;
-    };
-
-    /// Retrieves a container data source with the schema's default name token
-    /// "camera" from the parent container and constructs a
-    /// HdCameraSchema 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 HdCameraSchema 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 shutterOpen.
-    HD_API
-    static const HdDataSourceLocator &GetShutterOpenLocator();
-
-    /// Prim-level relative data source locator to locate shutterClose.
-    HD_API
-    static const HdDataSourceLocator &GetShutterCloseLocator();
 
+    };
 
     /// Returns token data source for use as projection value.
-    /// Values of...
+    ///
+    /// The following values will be stored statically and reused for future
+    /// calls:
     /// - HdCameraSchemaTokens->perspective
     /// - HdCameraSchemaTokens->orthographic
-    ///     ...will be stored statically and reused for future calls.
     HD_API
     static HdTokenDataSourceHandle BuildProjectionDataSource(
         const TfToken &projection);
 
+    /// @}
 };
 
 PXR_NAMESPACE_CLOSE_SCOPE