1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #include "pxr/usd/usdGeom/scope.h"
25 #include "pxr/usd/usd/schemaBase.h"
26
27 #include "pxr/usd/sdf/primSpec.h"
28
29 #include "pxr/usd/usd/pyConversions.h"
30 #include "pxr/base/tf/pyContainerConversions.h"
31 #include "pxr/base/tf/pyResultConversions.h"
32 #include "pxr/base/tf/pyUtils.h"
33 #include "pxr/base/tf/wrapTypeHelpers.h"
34
35 #include <boost/python.hpp>
36
37 #include <string>
38
39 using namespace boost::python;
40
41 PXR_NAMESPACE_USING_DIRECTIVE
42
43 namespace {
44
45 #define WRAP_CUSTOM \
46 template <class Cls> static void _CustomWrapCode(Cls &_class)
47
48 // fwd decl.
49 WRAP_CUSTOM;
50
51
52 static std::string
_Repr(const UsdGeomScope & self)53 _Repr(const UsdGeomScope &self)
54 {
55 std::string primRepr = TfPyRepr(self.GetPrim());
56 return TfStringPrintf(
57 "UsdGeom.Scope(%s)",
58 primRepr.c_str());
59 }
60
61 } // anonymous namespace
62
wrapUsdGeomScope()63 void wrapUsdGeomScope()
64 {
65 typedef UsdGeomScope This;
66
67 class_<This, bases<UsdGeomImageable> >
68 cls("Scope");
69
70 cls
71 .def(init<UsdPrim>(arg("prim")))
72 .def(init<UsdSchemaBase const&>(arg("schemaObj")))
73 .def(TfTypePythonClass())
74
75 .def("Get", &This::Get, (arg("stage"), arg("path")))
76 .staticmethod("Get")
77
78 .def("Define", &This::Define, (arg("stage"), arg("path")))
79 .staticmethod("Define")
80
81 .def("GetSchemaAttributeNames",
82 &This::GetSchemaAttributeNames,
83 arg("includeInherited")=true,
84 return_value_policy<TfPySequenceToList>())
85 .staticmethod("GetSchemaAttributeNames")
86
87 .def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
88 return_value_policy<return_by_value>())
89 .staticmethod("_GetStaticTfType")
90
91 .def(!self)
92
93
94 .def("__repr__", ::_Repr)
95 ;
96
97 _CustomWrapCode(cls);
98 }
99
100 // ===================================================================== //
101 // Feel free to add custom code below this line, it will be preserved by
102 // the code generator. The entry point for your custom code should look
103 // minimally like the following:
104 //
105 // WRAP_CUSTOM {
106 // _class
107 // .def("MyCustomMethod", ...)
108 // ;
109 // }
110 //
111 // Of course any other ancillary or support code may be provided.
112 //
113 // Just remember to wrap code in the appropriate delimiters:
114 // 'namespace {', '}'.
115 //
116 // ===================================================================== //
117 // --(BEGIN CUSTOM CODE)--
118
119 namespace {
120
121 WRAP_CUSTOM {
122 }
123
124 } // anonymous namespace
125