Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pxr/usd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(DIRS
usdVol
usdMedia
usdShade
usdLightField
usdLux
usdProc
usdRender
Expand Down
25 changes: 25 additions & 0 deletions pxr/usd/usdLightField/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set(PXR_PREFIX pxr/usd)
set(PXR_PACKAGE usdLightField)

pxr_library(usdLightField
INCLUDE_SCHEMA_FILES

LIBRARIES
tf
sdf
vt
gf
pcp
usd
usdGeom
arch

CPPFILES
# List non-schema cpp files

PUBLIC_HEADERS
api.h

PYMODULE_FILES
__init__.py
)
10 changes: 10 additions & 0 deletions pxr/usd/usdLightField/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright 2024 Pixar
#
# Licensed under the terms set forth in the LICENSE.txt file available at
# https://openusd.org/license.
#

from pxr import Tf
Tf.PreparePythonModule()
del Tf
30 changes: 30 additions & 0 deletions pxr/usd/usdLightField/api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Copyright 2017 Pixar
//
// Licensed under the terms set forth in the LICENSE.txt file available at
// https://openusd.org/license.
//
#ifndef USDLIGHTFIELD_API_H
#define USDLIGHTFIELD_API_H

#include "pxr/base/arch/export.h"

#if defined(PXR_STATIC)
# define USDLIGHTFIELD_API
# define USDLIGHTFIELD_API_TEMPLATE_CLASS(...)
# define USDLIGHTFIELD_API_TEMPLATE_STRUCT(...)
# define USDLIGHTFIELD_LOCAL
#else
# if defined(USDLIGHTFIELD_EXPORTS)
# define USDLIGHTFIELD_API ARCH_EXPORT
# define USDLIGHTFIELD_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
# define USDLIGHTFIELD_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
# else
# define USDLIGHTFIELD_API ARCH_IMPORT
# define USDLIGHTFIELD_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
# define USDLIGHTFIELD_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
# endif
# define USDLIGHTFIELD_LOCAL ARCH_HIDDEN
#endif

#endif
111 changes: 111 additions & 0 deletions pxr/usd/usdLightField/gaussianFalloffFunctionAPI.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//
// Copyright 2016 Pixar
//
// Licensed under the terms set forth in the LICENSE.txt file available at
// https://openusd.org/license.
//
#include "pxr/usd/usdLightField/gaussianFalloffFunctionAPI.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"

#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"

PXR_NAMESPACE_OPEN_SCOPE

// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<UsdLightFieldGaussianFalloffFunctionAPI,
TfType::Bases< UsdAPISchemaBase > >();

}

/* virtual */
UsdLightFieldGaussianFalloffFunctionAPI::~UsdLightFieldGaussianFalloffFunctionAPI()
{
}

/* static */
UsdLightFieldGaussianFalloffFunctionAPI
UsdLightFieldGaussianFalloffFunctionAPI::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return UsdLightFieldGaussianFalloffFunctionAPI();
}
return UsdLightFieldGaussianFalloffFunctionAPI(stage->GetPrimAtPath(path));
}


/* virtual */
UsdSchemaKind UsdLightFieldGaussianFalloffFunctionAPI::_GetSchemaKind() const
{
return UsdLightFieldGaussianFalloffFunctionAPI::schemaKind;
}

/* static */
bool
UsdLightFieldGaussianFalloffFunctionAPI::CanApply(
const UsdPrim &prim, std::string *whyNot)
{
return prim.CanApplyAPI<UsdLightFieldGaussianFalloffFunctionAPI>(whyNot);
}

/* static */
UsdLightFieldGaussianFalloffFunctionAPI
UsdLightFieldGaussianFalloffFunctionAPI::Apply(const UsdPrim &prim)
{
if (prim.ApplyAPI<UsdLightFieldGaussianFalloffFunctionAPI>()) {
return UsdLightFieldGaussianFalloffFunctionAPI(prim);
}
return UsdLightFieldGaussianFalloffFunctionAPI();
}

/* static */
const TfType &
UsdLightFieldGaussianFalloffFunctionAPI::_GetStaticTfType()
{
static TfType tfType = TfType::Find<UsdLightFieldGaussianFalloffFunctionAPI>();
return tfType;
}

/* static */
bool
UsdLightFieldGaussianFalloffFunctionAPI::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}

/* virtual */
const TfType &
UsdLightFieldGaussianFalloffFunctionAPI::_GetTfType() const
{
return _GetStaticTfType();
}

/*static*/
const TfTokenVector&
UsdLightFieldGaussianFalloffFunctionAPI::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames;
static TfTokenVector allNames =
UsdAPISchemaBase::GetSchemaAttributeNames(true);

if (includeInherited)
return allNames;
else
return localNames;
}

PXR_NAMESPACE_CLOSE_SCOPE

// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
163 changes: 163 additions & 0 deletions pxr/usd/usdLightField/gaussianFalloffFunctionAPI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
//
// Copyright 2016 Pixar
//
// Licensed under the terms set forth in the LICENSE.txt file available at
// https://openusd.org/license.
//
#ifndef USDLIGHTFIELD_GENERATED_GAUSSIANFALLOFFFUNCTIONAPI_H
#define USDLIGHTFIELD_GENERATED_GAUSSIANFALLOFFFUNCTIONAPI_H

/// \file usdLightField/gaussianFalloffFunctionAPI.h

#include "pxr/pxr.h"
#include "pxr/usd/usdLightField/api.h"
#include "pxr/usd/usd/apiSchemaBase.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"

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

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

#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"

PXR_NAMESPACE_OPEN_SCOPE

class SdfAssetPath;

// -------------------------------------------------------------------------- //
// GAUSSIANFALLOFFFUNCTIONAPI //
// -------------------------------------------------------------------------- //

/// \class UsdLightFieldGaussianFalloffFunctionAPI
///
/// Defines a Gaussian fall-off function. An opacity data source is
/// required and it used to control the gaussian peak.
///
class UsdLightFieldGaussianFalloffFunctionAPI : public UsdAPISchemaBase
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;

/// Construct a UsdLightFieldGaussianFalloffFunctionAPI on UsdPrim \p prim .
/// Equivalent to UsdLightFieldGaussianFalloffFunctionAPI::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit UsdLightFieldGaussianFalloffFunctionAPI(const UsdPrim& prim=UsdPrim())
: UsdAPISchemaBase(prim)
{
}

/// Construct a UsdLightFieldGaussianFalloffFunctionAPI on the prim held by \p schemaObj .
/// Should be preferred over UsdLightFieldGaussianFalloffFunctionAPI(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit UsdLightFieldGaussianFalloffFunctionAPI(const UsdSchemaBase& schemaObj)
: UsdAPISchemaBase(schemaObj)
{
}

/// Destructor.
USDLIGHTFIELD_API
virtual ~UsdLightFieldGaussianFalloffFunctionAPI();

/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
USDLIGHTFIELD_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);

/// Return a UsdLightFieldGaussianFalloffFunctionAPI holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// UsdLightFieldGaussianFalloffFunctionAPI(stage->GetPrimAtPath(path));
/// \endcode
///
USDLIGHTFIELD_API
static UsdLightFieldGaussianFalloffFunctionAPI
Get(const UsdStagePtr &stage, const SdfPath &path);


/// Returns true if this <b>single-apply</b> API schema can be applied to
/// the given \p prim. If this schema can not be a applied to the prim,
/// this returns false and, if provided, populates \p whyNot with the
/// reason it can not be applied.
///
/// Note that if CanApply returns false, that does not necessarily imply
/// that calling Apply will fail. Callers are expected to call CanApply
/// before calling Apply if they want to ensure that it is valid to
/// apply a schema.
///
/// \sa UsdPrim::GetAppliedSchemas()
/// \sa UsdPrim::HasAPI()
/// \sa UsdPrim::CanApplyAPI()
/// \sa UsdPrim::ApplyAPI()
/// \sa UsdPrim::RemoveAPI()
///
USDLIGHTFIELD_API
static bool
CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);

/// Applies this <b>single-apply</b> API schema to the given \p prim.
/// This information is stored by adding "GaussianFalloffFunctionAPI" to the
/// token-valued, listOp metadata \em apiSchemas on the prim.
///
/// \return A valid UsdLightFieldGaussianFalloffFunctionAPI object is returned upon success.
/// An invalid (or empty) UsdLightFieldGaussianFalloffFunctionAPI object is returned upon
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
/// resulting in failure.
///
/// \sa UsdPrim::GetAppliedSchemas()
/// \sa UsdPrim::HasAPI()
/// \sa UsdPrim::CanApplyAPI()
/// \sa UsdPrim::ApplyAPI()
/// \sa UsdPrim::RemoveAPI()
///
USDLIGHTFIELD_API
static UsdLightFieldGaussianFalloffFunctionAPI
Apply(const UsdPrim &prim);

protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
USDLIGHTFIELD_API
UsdSchemaKind _GetSchemaKind() const override;

private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
USDLIGHTFIELD_API
static const TfType &_GetStaticTfType();

static bool _IsTypedSchema();

// override SchemaBase virtuals.
USDLIGHTFIELD_API
const TfType &_GetTfType() const override;

public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};

PXR_NAMESPACE_CLOSE_SCOPE

#endif
Loading
Loading