changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Bindings / Python / osgSetupBindings_OSGGroup.py.in
blobee55db2aec3d6bb5bf5d970b5a0c48cecbeac824
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 OSGGroupLib for the integration with the OpenSG CMake system
21 # (GV)
24 from goodies import *
26 import osggen
27 import splitGenHelper
29 def preScanSetup(gen_classes, fc_infos, core_mods, free_funcs, free_func_mods, exc_types):
31 return
35 def excludeFCDSetup(opensg_src_dir, fc_ignore_list, skip_fcds):
37 fc_ignore_list.extend(["ShadowMapEngine", "SimpleShadowMapEngine"])
40 scp_temp = None
41 spb_temp = None
42 sp_temp = None
44 def genTemplatesSetup(template_builder, tbuilder, non_fc_template_instances):
46 global scp_temp
47 global spb_temp
48 global sp_temp
50 scp_temp = tbuilder.Template("OSG::ContainerMixinHead<OSG::StageDesc>",
51 "StageContainerParent")
53 spb_temp = tbuilder.Template("OSG::TraversalValidationHandlerMixin< OSG::ContainerMixinHead<OSG::StageDesc> >",
54 "StageParentBase")
55 sp_temp = tbuilder.Template("OSG::StageParent", "StageParent")
57 return
61 def postScanSetup(osg, template_alias_db):
63 splitGenHelper.exposeTemplateType(scp_temp)
65 splitGenHelper.exposeTemplateType(spb_temp)
67 spb_temp_decl = spb_temp.decl
68 spb_temp_decl["editSFUpdateMode"].exclude()
69 spb_temp_decl["getSFUpdateMode"].call_policies = return_internal_reference()
71 spb_temp_decl.add_declaration_code("""
72 namespace
75 void destroyedCallback(bp::object callable, OSG::FieldContainer* fc,
76 const OSG::UInt64 i)
78 callable(fc, i);
81 void wrapAddDestroyedFunctor(alias_StageParentBase* spb, bp::object func,
82 const std::string& createSymbol)
84 spb->addDestroyedFunctor(boost::bind(destroyedCallback, func, _1, _2),
85 createSymbol);
89 """)
90 spb_temp_decl["addDestroyedFunctor"].exclude()
91 spb_temp_decl.add_registration_code("""
92 def("addDestroyedFunctor", wrapAddDestroyedFunctor,
93 (bp::arg("func"), bp::arg("createSymbol")))
94 """)
96 splitGenHelper.exposeTemplateType(sp_temp)
98 return
101 def postGenClassesSetup(osg, mb):
103 return
107 def postFCDInfoSetup(osg, mb, adddition_exp):
109 splitGenHelper.handlAutoSlotReplace(osg, "DynamicStateGeneratorStageData")
111 c = osg.class_("RenderCallbackStage")
112 c["addPreRenderFunctor"].exclude()
113 c["addPostRenderFunctor"].exclude()
114 c["fillPreRenderStore"].exclude()
115 c["fillPostRenderStore"].exclude()
117 c.add_declaration_code("""
118 namespace
121 void renderCallback(bp::object callable, OSG::DrawEnv* drawEnv)
123 callable(drawEnv);
126 void wrapAddPreRenderFunctor(OSG::RenderCallbackStage* self,
127 bp::object callable,
128 const std::string& createSymbol)
130 self->addPreRenderFunctor(boost::bind(renderCallback, callable, _1),
131 createSymbol);
134 void wrapAddPostRenderFunctor(OSG::RenderCallbackStage* self,
135 bp::object callable,
136 const std::string& createSymbol)
138 self->addPostRenderFunctor(boost::bind(renderCallback, callable, _1),
139 createSymbol);
142 inline void
143 fillFunctorStore(const bp::list& callables,
144 OSG::RenderCallbackStage::RenderFunctorStore& store)
146 const int length = bp::extract<int>(callables.attr("__len__")());
147 store.resize(length);
149 for ( int i = 0; i < length; ++i )
151 store[i] = boost::bind(renderCallback, callables[i], _1);
155 void wrapFillPreRenderStore(OSG::RenderCallbackStage* self, bp::list callables)
157 OSG::RenderCallbackStage::RenderFunctorStore store;
158 fillFunctorStore(callables, store);
159 self->fillPreRenderStore(store);
162 void wrapFillPostRenderStore(OSG::RenderCallbackStage* self, bp::list callables)
164 OSG::RenderCallbackStage::RenderFunctorStore store;
165 fillFunctorStore(callables, store);
166 self->fillPostRenderStore(store);
170 """)
171 add_member_function(c, "addPreRenderFunctor", "wrapAddPreRenderFunctor")
172 add_member_function(c, "addPostRenderFunctor", "wrapAddPostRenderFunctor")
173 add_member_function(c, "fillPreRenderStore", "wrapFillPreRenderStore")
174 add_member_function(c, "fillPostRenderStore", "wrapFillPostRenderStore")
177 c = osg.class_("CubeMapGenerator")
178 c["initData"].call_policies = return_internal_reference()
181 c = osg.class_("DynamicStateGenerator")
182 c.add_declaration_code("""
183 namespace
186 OSG::FrameBufferObjectRecPtr
187 wrapGetRenderTarget(OSG::DynamicStateGenerator* dsg)
189 return OSG::FrameBufferObjectRecPtr(
190 OSG::FrameBufferObject::ObjTransitPtr(dsg->getRenderTarget())
195 """)
198 c["getRenderTarget"].exclude()
199 c.add_registration_code('def("getRenderTarget", wrapGetRenderTarget)')
201 return