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 // GENERATED FILE.  DO NOT EDIT.
25 #include <boost/python/class.hpp>
26 #include "pxr/usd/usdUI/tokens.h"
27 
28 PXR_NAMESPACE_USING_DIRECTIVE
29 
30 namespace {
31 
32 // Helper to return a static token as a string.  We wrap tokens as Python
33 // strings and for some reason simply wrapping the token using def_readonly
34 // bypasses to-Python conversion, leading to the error that there's no
35 // Python type for the C++ TfToken type.  So we wrap this functor instead.
36 class _WrapStaticToken {
37 public:
_WrapStaticToken(const TfToken * token)38     _WrapStaticToken(const TfToken* token) : _token(token) { }
39 
operator ()() const40     std::string operator()() const
41     {
42         return _token->GetString();
43     }
44 
45 private:
46     const TfToken* _token;
47 };
48 
49 template <typename T>
50 void
_AddToken(T & cls,const char * name,const TfToken & token)51 _AddToken(T& cls, const char* name, const TfToken& token)
52 {
53     cls.add_static_property(name,
54                             boost::python::make_function(
55                                 _WrapStaticToken(&token),
56                                 boost::python::return_value_policy<
57                                     boost::python::return_by_value>(),
58                                 boost::mpl::vector1<std::string>()));
59 }
60 
61 } // anonymous
62 
wrapUsdUITokens()63 void wrapUsdUITokens()
64 {
65     boost::python::class_<UsdUITokensType, boost::noncopyable>
66         cls("Tokens", boost::python::no_init);
67     _AddToken(cls, "closed", UsdUITokens->closed);
68     _AddToken(cls, "minimized", UsdUITokens->minimized);
69     _AddToken(cls, "open", UsdUITokens->open);
70     _AddToken(cls, "uiDescription", UsdUITokens->uiDescription);
71     _AddToken(cls, "uiDisplayGroup", UsdUITokens->uiDisplayGroup);
72     _AddToken(cls, "uiDisplayName", UsdUITokens->uiDisplayName);
73     _AddToken(cls, "uiNodegraphNodeDisplayColor", UsdUITokens->uiNodegraphNodeDisplayColor);
74     _AddToken(cls, "uiNodegraphNodeExpansionState", UsdUITokens->uiNodegraphNodeExpansionState);
75     _AddToken(cls, "uiNodegraphNodeIcon", UsdUITokens->uiNodegraphNodeIcon);
76     _AddToken(cls, "uiNodegraphNodePos", UsdUITokens->uiNodegraphNodePos);
77     _AddToken(cls, "uiNodegraphNodeSize", UsdUITokens->uiNodegraphNodeSize);
78     _AddToken(cls, "uiNodegraphNodeStackingOrder", UsdUITokens->uiNodegraphNodeStackingOrder);
79 }
80