forked from PixarAnimationStudios/OpenUSD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR PixarAnimationStudios#1729 from Autodesk for their Maya USD …
…plugin to load in 2023
- Loading branch information
Nicolas Popravka
committed
Jan 9, 2023
1 parent
0b3325b
commit 13e0046
Showing
15 changed files
with
147 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include "pxr/pxr.h" | ||
#include "pxr/base/tf/pyBoostObjWrapper.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#ifndef PXR_BASE_TF_PY_BOOST_OBJ_WRAPPER_H | ||
#define PXR_BASE_TF_PY_BOOST_OBJ_WRAPPER_H | ||
|
||
#ifdef PXR_PYTHON_SUPPORT_ENABLED | ||
#include "pxr/base/tf/pyUtils.h" | ||
#include <boost/python/object.hpp> | ||
#else | ||
#include <type_traits> | ||
#endif | ||
|
||
#include <cstddef> | ||
|
||
PXR_NAMESPACE_OPEN_SCOPE | ||
/// \brief TfPyBoostObjWrapperStub | ||
/// | ||
/// Empty stub for ABI compatibility even if Python support is | ||
/// enabled so we can ensure the alignment is the same. | ||
class TfPyBoostObjWrapperStub | ||
{ | ||
public: | ||
static constexpr std::size_t Size = 8; | ||
static constexpr std::size_t Align = 8; | ||
|
||
private: | ||
std::aligned_storage<Size, Align>::type _stub; | ||
}; | ||
|
||
/// \brief TfPyBoostObjWrapper | ||
/// | ||
/// Wrapper of the boost::python::api::object | ||
/// | ||
/// The wrapper provides a uniform type | ||
/// usable when python extensions are accessible | ||
/// and when no python extensions are compiled | ||
#ifdef PXR_PYTHON_SUPPORT_ENABLED | ||
class TfPyBoostObjWrapper | ||
{ | ||
using WrappedType = boost::python::api::object; | ||
|
||
public: | ||
// Just a constructor that forwards everything to the wrapped object. | ||
template<typename ...Args> | ||
TfPyBoostObjWrapper(Args&&... args) | ||
: _wrappedObject(std::forward<Args>(args)...) | ||
{} | ||
|
||
inline WrappedType& get() { return _wrappedObject; } | ||
|
||
private: | ||
WrappedType _wrappedObject; | ||
}; | ||
// Verify binary compatibility between the expected size from the stub and the class | ||
static_assert(sizeof(TfPyBoostObjWrapper) == sizeof(TfPyBoostObjWrapperStub), | ||
"ABI break: Incompatible class sizes."); | ||
static_assert(alignof(TfPyBoostObjWrapper) == alignof(TfPyBoostObjWrapperStub), | ||
"ABI break: Incompatible class alignments."); | ||
#else | ||
class TfPyBoostObjWrapper : TfPyBoostObjWrapperStub | ||
{ | ||
}; | ||
#endif | ||
|
||
PXR_NAMESPACE_CLOSE_SCOPE | ||
|
||
#endif // PXR_BASE_TF_PY_BOOST_OBJ_WRAPPER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.