changed: gcc8 base update
[opensg.git] / Source / Contrib / ComplexSceneManager / Bindings / Python / osgSetupBindings_OSGContribCSM.py.in
blob5c751b33bead61415e3e990173ebf8075043e0bd
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 OSGContribCSMLib for the integration with the OpenSG CMake
21 # system
22 # (GV)
25 from goodies import *
27 import osggen
28 import splitGenHelper
30 def preScanSetup(gen_classes, fc_infos, core_mods, free_funcs, free_func_mods, exc_types):
32 return
36 def excludeFCDSetup(opensg_src_dir, fc_ignore_list, skip_fcds):
38 # .fcd files to skip because they only cause trouble.
39 skip_fcds.extend([os.path.join(opensg_src_dir, "Contrib", "ComplexSceneManager", "Sensor", "InterfaceSensors",
40 "Devices", "OSGLinuxEventOptions.fcd")])
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 return
62 def postFCDInfoSetup(osg, mb, adddition_exp):
64 splitGenHelper.handleFindNamedComponent(osg, "ComplexSceneManager")
66 #c = osg["ComplexSceneManager"]
67 # OSG::ComplexSceneManager
68 c = osg["ComplexSceneManager"]
69 c["the"].call_policies = return_value_policy(reference_existing_object)
70 c["init"].exclude()
71 c["setMainloop"].exclude()
73 c.add_declaration_code("""
74 namespace
77 void mainLoopCallback(bp::object callable)
79 callable();
82 bool wrapInit(OSG::ComplexSceneManager* csm, bp::list pythonArgv)
84 const int argc(bp::extract<int>(pythonArgv.attr("__len__")()));
85 std::vector<char*> argv(argc);
87 for ( int i = 0; i < argc; ++i )
89 argv[i] = bp::extract<char*>(pythonArgv[i]);
92 return csm->startFrom(argc, &argv[0]);
95 void wrapSetMainloop(OSG::ComplexSceneManager* csm, bp::object fMainLoop)
97 csm->setMainloop(boost::bind(mainLoopCallback, fMainLoop));
101 """)
103 c.add_registration_code('def("init", wrapInit)')
104 c.add_registration_code('def("setMainloop", wrapSetMainloop, (bp::arg("fMainLoop")))')
108 for class_name in ["CSMClusterWindow", "CSMDrawManager", "CSMDrawer"]:
109 c = osg[class_name]
110 c["findNamedComponent"].exclude()
112 c.add_declaration_code("""
113 namespace
116 OSG::FieldContainerRecPtr
117 wrapFindNamedComponent(OSG::%(class_name)s* self, const OSG::Char8* szName)
119 return OSG::FieldContainerRecPtr(self->findNamedComponent(szName));
123 """ % { 'class_name' : class_name })
124 c.add_registration_code("""
125 def("findNamedComponent", wrapFindNamedComponent, (bp::arg("szName")))
126 """)
130 c = osg.class_("CSMViewport")
131 c["beginViewports"].exclude()
132 c["endViewports"].exclude()
134 c = osg["CSMWindow"]
135 c["findViewport"].call_policies = return_value_policy(reference_existing_object)
137 return