// // Copyright 2016 Pixar // // Licensed under the Apache License, Version 2.0 (the "Apache License") // with the following modification; you may not use this file except in // compliance with the Apache License and the following modification to it: // Section 6. Trademarks. is deleted and replaced with: // // 6. Trademarks. This License does not grant permission to use the trade // names, trademarks, service marks, or product names of the Licensor // and its affiliates, except as required to comply with Section 4(c) of // the License and to reproduce the content of the NOTICE file. // // You may obtain a copy of the Apache License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the Apache License with the above modification is // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the Apache License for the specific // language governing permissions and limitations under the Apache License. // #include "pxr/pxr.h" #include "pxr/usd/pcp/errors.h" #include "pxr/base/tf/pyContainerConversions.h" #include "pxr/base/tf/pyPtrHelpers.h" #include "pxr/base/tf/pyResultConversions.h" #include "pxr/base/tf/pyEnum.h" #include using namespace boost::python; PXR_NAMESPACE_USING_DIRECTIVE void wrapErrors() { TfPyWrapEnum("ErrorType"); // NOTE: Do not allow construction of these objects from Python. // Boost Python's shared_ptr_from_python will attach a custom // deleter that releases the PyObject, which requires the GIL. // Therefore it's unsafe for C++ code to release a shared_ptr // without holding the GIL. That's impractical so we just // ensure that we don't create error objects in Python. class_ ("ErrorBase", "", no_init) .add_property("errorType", &PcpErrorBase::errorType) .def("__str__", &PcpErrorBase::ToString) ; class_, PcpErrorTargetPathBasePtr > ("ErrorTargetPathBase", "", no_init) ; class_, PcpErrorArcCyclePtr > ("ErrorArcCycle", "", no_init) ; class_, PcpErrorArcPermissionDeniedPtr> ("ErrorArcPermissionDenied", "", no_init) ; class_, PcpErrorInconsistentPropertyTypePtr> ("ErrorInconsistentPropertyType", "", no_init) ; class_, PcpErrorInconsistentAttributeTypePtr> ("ErrorInconsistentAttributeType", "", no_init) ; class_, PcpErrorInconsistentAttributeVariabilityPtr> ("ErrorInconsistentAttributeVariability", "", no_init) ; class_, PcpErrorInternalAssetPathPtr> ("ErrorInternalAssetPath", "", no_init) ; class_, PcpErrorInvalidPrimPathPtr> ("ErrorInvalidPrimPath", "", no_init) ; class_, PcpErrorInvalidAssetPathBasePtr> ("ErrorInvalidAssetPathBase", "", no_init) ; class_, PcpErrorInvalidAssetPathPtr> ("ErrorInvalidAssetPath", "", no_init) ; class_, PcpErrorMutedAssetPathPtr> ("ErrorMutedAssetPath", "", no_init) ; class_, PcpErrorInvalidInstanceTargetPathPtr> ("ErrorInvalidInstanceTargetPath", "", no_init) ; class_, PcpErrorInvalidExternalTargetPathPtr> ("ErrorInvalidExternalTargetPath", "", no_init) ; class_, PcpErrorInvalidTargetPathPtr> ("ErrorInvalidTargetPath", "", no_init) ; class_, PcpErrorInvalidSublayerOffsetPtr> ("ErrorInvalidSublayerOffset", "", no_init) ; class_, PcpErrorInvalidReferenceOffsetPtr> ("ErrorInvalidReferenceOffset", "", no_init) ; class_, PcpErrorInvalidSublayerOwnershipPtr> ("ErrorInvalidSublayerOwnership", "", no_init) ; class_, PcpErrorInvalidSublayerPathPtr> ("ErrorInvalidSublayerPath", "", no_init) ; class_, PcpErrorInvalidVariantSelectionPtr> ("ErrorInvalidVariantSelection", "", no_init) ; class_, PcpErrorOpinionAtRelocationSourcePtr> ("ErrorOpinionAtRelocationSource", "", no_init) ; class_, PcpErrorPrimPermissionDeniedPtr> ("ErrorPrimPermissionDenied", "", no_init) ; class_, PcpErrorPropertyPermissionDeniedPtr> ("ErrorPropertyPermissionDenied", "", no_init) ; class_, PcpErrorSublayerCyclePtr> ("ErrorSublayerCycle", "", no_init) ; class_, PcpErrorTargetPermissionDeniedPtr> ("ErrorTargetPermissionDenied", "", no_init) ; class_, PcpErrorUnresolvedPrimPathPtr> ("ErrorUnresolvedPrimPath", "", no_init) ; // Register conversion for python list <-> vector to_python_converter< PcpErrorVector, TfPySequenceToPython >(); TfPyContainerConversions::from_python_sequence< PcpErrorVector, TfPyContainerConversions::variable_capacity_policy >(); } TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidVariantSelection) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorPropertyPermissionDenied) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorBase) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorTargetPathBase) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorArcCycle) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorArcPermissionDenied) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInconsistentPropertyType) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInconsistentAttributeType) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInconsistentAttributeVariability) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInternalAssetPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidPrimPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidAssetPathBase) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidAssetPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorMutedAssetPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidInstanceTargetPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidExternalTargetPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidTargetPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidSublayerOffset) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidReferenceOffset) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidSublayerOwnership) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorInvalidSublayerPath) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorOpinionAtRelocationSource) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorPrimPermissionDenied) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorSublayerCycle) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorTargetPermissionDenied) TF_REFPTR_CONST_VOLATILE_GET(PcpErrorUnresolvedPrimPath)