Skip to content

Commit

Permalink
Updates based on feedback from Pixar:
Browse files Browse the repository at this point in the history
 * Remove unnecessary includes, update copyright years.
 * Re-ran genUsdSchema to pick up latest changes to schema files.
 * Added some helper functions to UsdVolVolume to make managing field
relationships easier.
 * Use this new API to help populate information in the volume adapter.
  • Loading branch information
marktucker committed Jul 19, 2018
1 parent 3bcd692 commit 98233d9
Show file tree
Hide file tree
Showing 35 changed files with 378 additions and 218 deletions.
6 changes: 1 addition & 5 deletions pxr/imaging/lib/hd/field.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2016 Pixar
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
Expand All @@ -22,10 +22,6 @@
// language governing permissions and limitations under the Apache License.
//
#include "pxr/imaging/hd/field.h"
#include "pxr/imaging/hd/perfLog.h"
#include "pxr/imaging/hd/sceneDelegate.h"

#include "pxr/base/gf/matrix4d.h"

PXR_NAMESPACE_OPEN_SCOPE

Expand Down
4 changes: 1 addition & 3 deletions pxr/imaging/lib/hd/field.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2016 Pixar
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
Expand Down Expand Up @@ -29,8 +29,6 @@
#include "pxr/imaging/hd/version.h"
#include "pxr/imaging/hd/bprim.h"

#include "pxr/base/tf/staticTokens.h"

#include <boost/shared_ptr.hpp>

#include <vector>
Expand Down
7 changes: 1 addition & 6 deletions pxr/imaging/lib/hd/volume.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2016 Pixar
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
Expand All @@ -22,11 +22,6 @@
// language governing permissions and limitations under the Apache License.
//
#include "pxr/imaging/hd/volume.h"
#include "pxr/imaging/hd/perfLog.h"
#include "pxr/imaging/hd/sceneDelegate.h"
#include "pxr/imaging/hd/rprimCollection.h"

#include "pxr/base/gf/matrix4d.h"

PXR_NAMESPACE_OPEN_SCOPE

Expand Down
4 changes: 1 addition & 3 deletions pxr/imaging/lib/hd/volume.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2016 Pixar
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
Expand Down Expand Up @@ -29,8 +29,6 @@
#include "pxr/imaging/hd/version.h"
#include "pxr/imaging/hd/rprim.h"

#include "pxr/base/tf/staticTokens.h"

#include <boost/shared_ptr.hpp>

#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/lib/usdVol/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2016 Pixar
# Copyright 2018 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
Expand Down
7 changes: 6 additions & 1 deletion pxr/usd/lib/usdVol/field3DAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "./field3DAsset.h"
#include "pxr/usd/usdVol/field3DAsset.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"

Expand Down Expand Up @@ -74,6 +74,11 @@ UsdVolField3DAsset::Define(
stage->DefinePrim(path, usdPrimTypeName));
}

/* virtual */
UsdSchemaType UsdVolField3DAsset::_GetSchemaType() const {
return UsdVolField3DAsset::schemaType;
}

/* static */
const TfType &
UsdVolField3DAsset::_GetStaticTfType()
Expand Down
35 changes: 19 additions & 16 deletions pxr/usd/lib/usdVol/field3DAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
/// \file usdVol/field3DAsset.h

#include "pxr/pxr.h"
#include "./api.h"
#include "./fieldAsset.h"
#include "pxr/usd/usdVol/api.h"
#include "pxr/usd/usdVol/fieldAsset.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include "./tokens.h"
#include "pxr/usd/usdVol/tokens.h"

#include "pxr/base/vt/value.h"

Expand All @@ -52,7 +52,8 @@ class SdfAssetPath;

/// \class UsdVolField3DAsset
///
/// Field3D field primitive.
/// Field3D field primitive. The FieldAsset filePath attribute must
/// specify a file in the Field3D format on disk.
///
/// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
/// that are text/tokens, the actual token is published and defined in \ref UsdVolTokens.
Expand All @@ -62,16 +63,10 @@ class SdfAssetPath;
class UsdVolField3DAsset : public UsdVolFieldAsset
{
public:
/// Compile-time constant indicating whether or not this class corresponds
/// to a concrete instantiable prim type in scene description. If this is
/// true, GetStaticPrimDefinition() will return a valid prim definition with
/// a non-empty typeName.
static const bool IsConcrete = true;

/// Compile-time constant indicating whether or not this class inherits from
/// UsdTyped. Types which inherit from UsdTyped can impart a typename on a
/// UsdPrim.
static const bool IsTyped = true;
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaType
static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped;

/// Construct a UsdVolField3DAsset on UsdPrim \p prim .
/// Equivalent to UsdVolField3DAsset::Get(prim.GetStage(), prim.GetPath())
Expand Down Expand Up @@ -140,6 +135,13 @@ class UsdVolField3DAsset : public UsdVolFieldAsset
static UsdVolField3DAsset
Define(const UsdStagePtr &stage, const SdfPath &path);

protected:
/// Returns the type of schema this class belongs to.
///
/// \sa UsdSchemaType
USDVOL_API
virtual UsdSchemaType _GetSchemaType() const;

private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
Expand Down Expand Up @@ -178,8 +180,9 @@ class UsdVolField3DAsset : public UsdVolFieldAsset
// --------------------------------------------------------------------- //
// FIELDINDEX
// --------------------------------------------------------------------- //
/// Numeric index to disambiguate between multiple fields stored
/// in the same Field3D file.
/// A Field3D file can contain multiple fields with the same
/// name. This attribute is an index used to disambiguate
/// between these multiple fields with the same name.
///
/// \n C++ Type: int
/// \n Usd Type: SdfValueTypeNames->Int
Expand Down
7 changes: 6 additions & 1 deletion pxr/usd/lib/usdVol/fieldAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "./fieldAsset.h"
#include "pxr/usd/usdVol/fieldAsset.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"

Expand Down Expand Up @@ -55,6 +55,11 @@ UsdVolFieldAsset::Get(const UsdStagePtr &stage, const SdfPath &path)
}


/* virtual */
UsdSchemaType UsdVolFieldAsset::_GetSchemaType() const {
return UsdVolFieldAsset::schemaType;
}

/* static */
const TfType &
UsdVolFieldAsset::_GetStaticTfType()
Expand Down
32 changes: 19 additions & 13 deletions pxr/usd/lib/usdVol/fieldAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
/// \file usdVol/fieldAsset.h

#include "pxr/pxr.h"
#include "./api.h"
#include "./fieldBase.h"
#include "pxr/usd/usdVol/api.h"
#include "pxr/usd/usdVol/fieldBase.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include "./tokens.h"
#include "pxr/usd/usdVol/tokens.h"

#include "pxr/base/vt/value.h"

Expand All @@ -57,16 +57,10 @@ class SdfAssetPath;
class UsdVolFieldAsset : public UsdVolFieldBase
{
public:
/// Compile-time constant indicating whether or not this class corresponds
/// to a concrete instantiable prim type in scene description. If this is
/// true, GetStaticPrimDefinition() will return a valid prim definition with
/// a non-empty typeName.
static const bool IsConcrete = false;

/// Compile-time constant indicating whether or not this class inherits from
/// UsdTyped. Types which inherit from UsdTyped can impart a typename on a
/// UsdPrim.
static const bool IsTyped = true;
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaType
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped;

/// Construct a UsdVolFieldAsset on UsdPrim \p prim .
/// Equivalent to UsdVolFieldAsset::Get(prim.GetStage(), prim.GetPath())
Expand Down Expand Up @@ -110,6 +104,13 @@ class UsdVolFieldAsset : public UsdVolFieldBase
Get(const UsdStagePtr &stage, const SdfPath &path);


protected:
/// Returns the type of schema this class belongs to.
///
/// \sa UsdSchemaType
USDVOL_API
virtual UsdSchemaType _GetSchemaType() const;

private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
Expand All @@ -127,6 +128,11 @@ class UsdVolFieldAsset : public UsdVolFieldBase
// FILEPATH
// --------------------------------------------------------------------- //
/// An asset path attribute that points to a file on disk.
/// For each supported file format, a separate FieldAsset
/// subclass is required. Any further information required to
/// extract the field from the file (such as a name or index to
/// choose a single field from a file that can store multiple
/// fields) will be defined on the FieldAsset subclass.
///
/// \n C++ Type: SdfAssetPath
/// \n Usd Type: SdfValueTypeNames->Asset
Expand Down
7 changes: 6 additions & 1 deletion pxr/usd/lib/usdVol/fieldBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "./fieldBase.h"
#include "pxr/usd/usdVol/fieldBase.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"

Expand Down Expand Up @@ -55,6 +55,11 @@ UsdVolFieldBase::Get(const UsdStagePtr &stage, const SdfPath &path)
}


/* virtual */
UsdSchemaType UsdVolFieldBase::_GetSchemaType() const {
return UsdVolFieldBase::schemaType;
}

/* static */
const TfType &
UsdVolFieldBase::_GetStaticTfType()
Expand Down
23 changes: 12 additions & 11 deletions pxr/usd/lib/usdVol/fieldBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/// \file usdVol/fieldBase.h

#include "pxr/pxr.h"
#include "./api.h"
#include "pxr/usd/usdVol/api.h"
#include "pxr/usd/usdGeom/boundable.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
Expand Down Expand Up @@ -56,16 +56,10 @@ class SdfAssetPath;
class UsdVolFieldBase : public UsdGeomBoundable
{
public:
/// Compile-time constant indicating whether or not this class corresponds
/// to a concrete instantiable prim type in scene description. If this is
/// true, GetStaticPrimDefinition() will return a valid prim definition with
/// a non-empty typeName.
static const bool IsConcrete = false;

/// Compile-time constant indicating whether or not this class inherits from
/// UsdTyped. Types which inherit from UsdTyped can impart a typename on a
/// UsdPrim.
static const bool IsTyped = true;
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaType
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped;

/// Construct a UsdVolFieldBase on UsdPrim \p prim .
/// Equivalent to UsdVolFieldBase::Get(prim.GetStage(), prim.GetPath())
Expand Down Expand Up @@ -109,6 +103,13 @@ class UsdVolFieldBase : public UsdGeomBoundable
Get(const UsdStagePtr &stage, const SdfPath &path);


protected:
/// Returns the type of schema this class belongs to.
///
/// \sa UsdSchemaType
USDVOL_API
virtual UsdSchemaType _GetSchemaType() const;

private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
Expand Down

0 comments on commit 98233d9

Please sign in to comment.