fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / GraphOp / Bindings / Python / osgSetupBindings_OSGUtil.py.in
blob7a3c537359f141c2042ae7d974d5434f67612c2d
1 # PyOpenSG is (C) Copyright 2005-2009 by Allen Bierbaum
3 # This file is part of PyOpenSG.
5 # PyOpenSG is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option)
8 # any later version.
10 # PyOpenSG is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13 # more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # This script is derived from gen_bindings.py, it contains all class specific
20 # tasks for the OSGUtilLib for the integration with the OpenSG CMake system
21 # (GV)
24 from goodies import *
26 import osggen
28 def preScanSetup(gen_classes, fc_infos, core_mods, free_funcs, free_func_mods, exc_types):
30 # Add basic classes that can just be wrapped with no customization
31 for c in ["NavigationManager",
32 "SimpleSceneManager",
33 "Navigator"]:
34 gen_classes.append(osggen.ClassInfo(c))
38 def excludeFCDSetup(opensg_src_dir, fc_ignore_list, skip_fcds):
40 return
44 def genTemplatesSetup(template_builder, tbuilder, non_fc_template_instances):
46 return
50 def postScanSetup(osg, template_alias_db):
52 return
56 def postGenClassesSetup(osg, mb):
58 # Graph ops
59 for n in ["GraphOp", "MakeTransparentGraphOp", "MaterialMergeGraphOp",
60 "PruneGraphOp", "SharePtrGraphOp", "VerifyGeoGraphOp",
61 "GeoTypeGraphOp", "StripeGraphOp", "SplitGraphOp",
62 "VerifyGraphOp", "MergeGraphOp"]:
63 op = osg.class_(n)
64 op.include()
65 # OSG::GraphOp subclasses are not intended to be instantiated directly by user-level code.
66 op.no_init = True
67 osggen.handleClassDefaults(op, False)
68 op.decls("traverseEnter", allow_empty = True).include()
69 op.decls("traverseLeave", allow_empty = True).include()
71 if "GraphOp" != n:
72 op.add_registration_code(
73 "bp::implicitly_convertible<OSG::%s::ObjRefPtr, OSG::GraphOp::ObjRefPtr>();" % n,
74 works_on_instance = False
76 op.add_registration_code(
77 "bp::implicitly_convertible<OSG::%s::ObjTransitPtr, OSG::GraphOp::ObjRefPtr>();" % n,
78 works_on_instance = False
81 op.add_registration_code(
82 "bp::implicitly_convertible<OSG::%s::ObjTransitPtr, OSG::%s::ObjRefPtr>();" % (n, n),
83 works_on_instance = False
86 # The following may not be useful at all.
87 mb.add_registration_code('bp::def("getCPtr", &pyopensg::ToCPtr<OSG::%s::ObjRefPtr>, ' % n + \
88 'bp::return_value_policy<bp::reference_existing_object>());')
90 c = osg.class_("MakeTransparentGraphOp").class_("MaterialObject")
91 c["getMaterial"].call_policies = return_value_policy(reference_existing_object)
92 c = osg.class_("MaterialMergeGraphOp").class_("MaterialObject")
93 c["getMaterial"].call_policies = return_value_policy(reference_existing_object)
95 return
99 def postFCDInfoSetup(osg, mb, adddition_exp):
101 # Graph ops
102 for n in ["GraphOp", "MakeTransparentGraphOp", "MaterialMergeGraphOp",
103 "PruneGraphOp", "SharePtrGraphOp", "VerifyGeoGraphOp",
104 "GeoTypeGraphOp", "StripeGraphOp", "SplitGraphOp",
105 "VerifyGraphOp", "MergeGraphOp"]:
106 c = osg[n]
107 c["usage"].exclude()
109 c = osg["GraphOp"]
111 c.add_wrapper_code("""
112 virtual std::string usage()
114 bp::override func_usage = this->get_override( "usage" );
115 return func_usage().as<std::string>();
117 """)
119 c.add_registration_code("""
120 def("usage",
121 bp::pure_virtual( &::OSG::GraphOp::usage ) );
122 """)
124 return