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/usdContrived/derivedNonAppliedAPI.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 using namespace foo;
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 UsdContrivedDerivedNonAppliedAPI & self)53 _Repr(const UsdContrivedDerivedNonAppliedAPI &self)
54 {
55 std::string primRepr = TfPyRepr(self.GetPrim());
56 return TfStringPrintf(
57 "UsdContrived.DerivedNonAppliedAPI(%s)",
58 primRepr.c_str());
59 }
60
61 } // anonymous namespace
62
wrapUsdContrivedDerivedNonAppliedAPI()63 void wrapUsdContrivedDerivedNonAppliedAPI()
64 {
65 typedef UsdContrivedDerivedNonAppliedAPI This;
66
67 class_<This, bases<UsdContrivedNonAppliedAPI> >
68 cls("DerivedNonAppliedAPI");
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("GetSchemaAttributeNames",
79 &This::GetSchemaAttributeNames,
80 arg("includeInherited")=true,
81 return_value_policy<TfPySequenceToList>())
82 .staticmethod("GetSchemaAttributeNames")
83
84 .def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
85 return_value_policy<return_by_value>())
86 .staticmethod("_GetStaticTfType")
87
88 .def(!self)
89
90
91 .def("__repr__", ::_Repr)
92 ;
93
94 _CustomWrapCode(cls);
95 }
96
97 // ===================================================================== //
98 // Feel free to add custom code below this line, it will be preserved by
99 // the code generator. The entry point for your custom code should look
100 // minimally like the following:
101 //
102 // WRAP_CUSTOM {
103 // _class
104 // .def("MyCustomMethod", ...)
105 // ;
106 // }
107 //
108 // Of course any other ancillary or support code may be provided.
109 //
110 // Just remember to wrap code in the appropriate delimiters:
111 // 'namespace {', '}'.
112 //
113 // ===================================================================== //
114 // --(BEGIN CUSTOM CODE)--
115
116 namespace {
117
118 WRAP_CUSTOM {
119 }
120
121 }
122