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)
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
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
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",
34 gen_classes
.append(osggen
.ClassInfo(c
))
38 def excludeFCDSetup(opensg_src_dir
, fc_ignore_list
, skip_fcds
):
44 def genTemplatesSetup(template_builder
, tbuilder
, non_fc_template_instances
):
50 def postScanSetup(osg
, template_alias_db
):
56 def postGenClassesSetup(osg
, mb
):
59 for n
in ["GraphOp", "MakeTransparentGraphOp", "MaterialMergeGraphOp",
60 "PruneGraphOp", "SharePtrGraphOp", "VerifyGeoGraphOp",
61 "GeoTypeGraphOp", "StripeGraphOp", "SplitGraphOp",
62 "VerifyGraphOp", "MergeGraphOp"]:
65 # OSG::GraphOp subclasses are not intended to be instantiated directly by user-level code.
67 osggen
.handleClassDefaults(op
, False)
68 op
.decls("traverseEnter", allow_empty
= True).include()
69 op
.decls("traverseLeave", allow_empty
= True).include()
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
)
99 def postFCDInfoSetup(osg
, mb
, adddition_exp
):
102 for n
in ["GraphOp", "MakeTransparentGraphOp", "MaterialMergeGraphOp",
103 "PruneGraphOp", "SharePtrGraphOp", "VerifyGeoGraphOp",
104 "GeoTypeGraphOp", "StripeGraphOp", "SplitGraphOp",
105 "VerifyGraphOp", "MergeGraphOp"]:
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>();
119 c
.add_registration_code("""
121 bp::pure_virtual( &::OSG::GraphOp::usage ) );