Пример #1
0
 def ParseISurface(self, mb):
     cls = mb.class_('CWrapSurface')
     cls.include()
     cls.rename('ISurface')
     mb.free_function('wrapsurface').include()
     mb.free_function( 'wrapsurface' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
     mb.free_function( 'wrapsurface' ).rename('surface')    
     
     mb.enumeration('CursorCode').include()
     mb.enumeration('FontDrawType_t').include()
     if self.settings.branch == 'swarm':
         mb.class_('FontVertex_t').include()
     else:
         mb.class_('Vertex_t').include()
     mb.class_('IntRect').include()
     
     cls.member_functions( 'DrawGetTextPos' ).add_transformation( FT.output('x'), FT.output('y') )
     cls.member_functions( 'DrawGetTextureSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
     cls.member_functions( 'GetScreenSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
     cls.member_functions( 'GetCharABCwide' ).add_transformation( FT.output('a'), FT.output('b'), FT.output('c') )
     cls.member_functions( 'GetWorkspaceBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
     cls.member_functions( 'GetAbsoluteWindowBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
     cls.member_functions( 'GetProportionalBase' ).add_transformation( FT.output('width'), FT.output('height') )
     cls.member_functions( 'SurfaceGetCursorPos' ).add_transformation( FT.output('x'), FT.output('y') )
     
     cls.member_functions( 'CreateHTMLWindow' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
     cls.member_functions( 'DrawGetTextureMatInfoFactory' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
     cls.member_functions( 'GetIconImageForFullPath' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
Пример #2
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()
        
        # Include message functions and rename them
        mb.free_function('SrcPyMsg').include()
        mb.free_function('SrcPyWarning').include()
        mb.free_function('SrcPyDevMsg').include()
        
        mb.free_function('SrcPyMsg').rename('Msg')
        mb.free_function('SrcPyWarning').rename('PrintWarning')
        mb.free_function('SrcPyDevMsg').rename('DevMsg')

        # Include classes for redirecting output (replace stdout and stderr)
        mb.class_('SrcPyStdOut').include()
        mb.class_('SrcPyStdErr').include()
        
        # Debug logging
        mb.free_function('PyCOM_TimestampedLog').include()
        mb.free_function('PyCOM_TimestampedLog').rename('COM_TimestampedLog')
        
        # Tick and per frame method register functions
        mb.free_function('RegisterTickMethod').include()
        mb.free_function('UnregisterTickMethod').include()
        mb.free_function('GetRegisteredTickMethods').include()
        mb.free_function('IsTickMethodRegistered').include()
        
        mb.free_function('RegisterPerFrameMethod').include()
        mb.free_function('UnregisterPerFrameMethod').include()
        mb.free_function('GetRegisteredPerFrameMethods').include()
        mb.free_function('IsPerFrameMethodRegistered').include()
        
        # Color classes
        cls = mb.class_('Color')
        cls.include()
        cls.mem_funs('GetColor').add_transformation( FT.output('_r'), FT.output('_g'), FT.output('_b'), FT.output('_a') )
        cls.mem_opers('=').exclude() # Breaks debug mode and don't really need it
        
        cls = mb.class_('color32_s')
        cls.include()
        cls.rename('color32')
        cls.mem_funs(allow_empty=True).exclude()
        
        if self.settings.branch == 'swarm':
            # Used by GetRenderColor in Swarm branch
            cls = mb.class_('color24')
            cls.include()
        
        # Global Vars Class
        mb.class_('CGlobalVarsBase').include()
        mb.class_('CGlobalVars').include()
        mb.vars('pSaveData').exclude()
        
        # Add converters
        mb.add_registration_code( "bp::to_python_converter<\n\tstring_t,\n\tstring_t_to_python_str>();")
        mb.add_registration_code( "python_str_to_string_t();" )
        mb.add_registration_code( "wchar_t_to_python_str();" )
        mb.add_registration_code( "ptr_wchar_t_to_python_str();" )
        mb.add_registration_code( "python_str_to_wchar_t();" )
        mb.add_registration_code( "#if PY_VERSION_HEX < 0x03000000\n\tpython_unicode_to_ptr_const_wchar_t();\n\t#endif \\ PY_VERSION_HEX" )
Пример #3
0
 def ParseClient(self, mb):
     # A simple class for python to use projected textures
     mb.class_('ProjectedTexture').include()
     
     # Free functions that don't start with 'UTIL_'
     mb.free_functions('ScreenHeight').include()
     mb.free_functions('ScreenWidth').include()
     mb.free_functions('GetVectorInScreenSpace').include()
     mb.free_functions('GetTargetInScreenSpace').include()
     
     # Main view
     mb.free_function('MainViewOrigin').include()
     mb.free_function('MainViewAngles').include()
     mb.free_function('MainViewForward').include()
     mb.free_function('MainViewRight').include()
     mb.free_function('MainViewUp').include()
     mb.free_function('MainWorldToViewMatrix').include()
     
     # Call policies and excludes
     if settings.ASW_CODE_BASE:
         mb.free_function('UTIL_GetLocalizedKeyString').exclude()
         mb.free_function('UTIL_MessageText').exclude()
         mb.free_functions('UTIL_EntityFromUserMessageEHandle').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
         mb.free_functions('UTIL_PlayerByUserId').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
         
     # Transformations
     mb.free_functions( 'GetVectorInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )  
     mb.free_functions( 'GetTargetInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )  
     
     # Exclude
     # Don't care about the following functions
     mb.free_functions('UTIL_EmitAmbientSound').exclude()  # No definition LOL
Пример #4
0
 def ParseClient(self, mb):
     # Free functions that don't start with 'UTIL_'
     mb.free_functions('ScreenHeight').include()
     mb.free_functions('ScreenWidth').include()
     mb.free_functions('GetVectorInScreenSpace').include()
     mb.free_functions('GetTargetInScreenSpace').include()
     
     # Main view
     mb.free_function('MainViewOrigin').include()
     mb.free_function('MainViewAngles').include()
     mb.free_function('MainViewForward').include()
     mb.free_function('MainViewRight').include()
     mb.free_function('MainViewUp').include()
     mb.free_function('MainWorldToViewMatrix').include()
     
     # Call policies and excludes
     if self.settings.branch == 'swarm':
         mb.free_function('UTIL_GetLocalizedKeyString').exclude()
         mb.free_function('UTIL_MessageText').exclude()
         mb.free_functions('UTIL_EntityFromUserMessageEHandle').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
     mb.free_functions('UTIL_PlayerByUserId').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
         
     # Transformations
     mb.free_functions( 'GetVectorInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
     mb.free_functions( 'GetTargetInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
Пример #5
0
 def ParseClient(self, mb):
     # Free functions that don't start with 'UTIL_'
     mb.free_functions('ScreenHeight').include()
     mb.free_functions('ScreenWidth').include()
     mb.free_functions('GetVectorInScreenSpace').include()
     mb.free_functions('GetTargetInScreenSpace').include()
     
     # Main view
     mb.free_function('MainViewOrigin').include()
     mb.free_function('MainViewAngles').include()
     mb.free_function('MainViewForward').include()
     mb.free_function('MainViewRight').include()
     mb.free_function('MainViewUp').include()
     mb.free_function('MainWorldToViewMatrix').include()
     
     # Call policies and excludes
     if self.settings.branch == 'swarm':
         mb.free_function('UTIL_GetLocalizedKeyString').exclude()
         mb.free_function('UTIL_MessageText').exclude()
         mb.free_functions('UTIL_EntityFromUserMessageEHandle').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
     mb.free_functions('UTIL_PlayerByUserId').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
         
     # Transformations
     mb.free_functions( 'GetVectorInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
     mb.free_functions( 'GetTargetInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
Пример #6
0
 def Parse(self, mb):
     # Exclude everything by default
     mb.decls().exclude()
     
     mb.class_('kbutton_t').include()
     if self.settings.branch == 'swarm':
         mb.class_('kbutton_t').mem_funs('GetPerUser').exclude()
     
     # Include input class
     cls = mb.class_('CInput')
     cls.include()
     cls.mem_funs().virtuality = 'not virtual'
     if self.settings.branch == 'swarm':
         #mb.mem_funs('FindKey').exclude() # FIXME
         mb.mem_funs('FindKey').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) 
     else:
         mb.mem_funs('FindKey').call_policies = call_policies.return_value_policy( call_policies.manage_new_object )  
     mb.mem_funs('GetUserCmd').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) # Can't exclude due being abstract
     
     mb.mem_funs( 'CAM_OrthographicSize' ).add_transformation( FT.output('w'), FT.output('h') )
     
     mb.add_declaration_code( "CInput *wrap_Input()\r\n{\r\n\treturn (CInput *)::input;\r\n}\r\n" )
     mb.add_registration_code( 'bp::def( "input", wrap_Input, bp::return_value_policy<bp::reference_existing_object>() );' )
     
     # ButtonCode.  
     mb.enums('ButtonCode_t').include()
     
     # Remove any protected function 
     mb.calldefs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
Пример #7
0
 def wrap_viewerbase(self):
     vb = self.mb.class_("ViewerBase")
     vb.constructors().exclude()
     vb.noncopyable = True
     vb.no_init = True
     vb.member_function("getWindows").add_transformation(FT.output("windows"))
     vb.member_function("getViews").add_transformation(FT.output("views"))
Пример #8
0
 def wrap_view(self):
     cls = self.mb.namespace("osgViewer").class_("View")
     for ctor in cls.constructors():
         ctor.allow_implicit_conversion = False
     cls.constructors(arg_types=[None, None]).exclude()
     cls.member_functions("computeIntersections").exclude()
     # RuntimeWarning: to-Python converter for class osg::ref_ptr<struct View_wrapper> already registered; second conversion method ignored.
     expose_nonoverridable_ref_ptr_class(cls)
     inner = cls.class_("StereoSlaveCallback")
     inner.member_function("updateSlave").exclude()  # link error
     # 1>..\..\..\..\src\modules\osgViewer\generated_code\View.pypp.cpp(171) : error C2039: 'StereoSlaveCallback_wrapper' : is not a member of 'View_wrapper'
     expose_nonoverridable_ref_ptr_class(inner)
     # Move output arguments to return value tuple
     if False:  # TODO - transformation does not seem to work with protected destructor classes
         gccp = cls.member_function("getCameraContainingPosition")
         gccp.add_transformation(
             FT.output('local_x'),
             FT.output('local_y'),
         )
     # Avoid premature destruction of manipulator
     # WEIRD movie maker crashes when I use (2, 1) here but not (1, 2)
     # BUT also crashes when osg.Camera.setFinalDrawCallback() uses (1, 2) but not (2, 1).
     # Whatever
     cls.member_function(
         "setCameraManipulator").call_policies = with_custodian_and_ward(
             1, 2)  # not crash
Пример #9
0
    def ParseClient(self, mb):
        # Free functions that don't start with 'UTIL_'
        mb.free_functions("ScreenHeight").include()
        mb.free_functions("ScreenWidth").include()
        mb.free_functions("GetVectorInScreenSpace").include()
        mb.free_functions("GetTargetInScreenSpace").include()

        # Main view
        mb.free_function("MainViewOrigin").include()
        mb.free_function("MainViewAngles").include()
        mb.free_function("MainViewForward").include()
        mb.free_function("MainViewRight").include()
        mb.free_function("MainViewUp").include()
        mb.free_function("MainWorldToViewMatrix").include()

        # Call policies and excludes
        if self.settings.branch == "swarm":
            mb.free_function("UTIL_GetLocalizedKeyString").exclude()
            mb.free_function("UTIL_MessageText").exclude()
            mb.free_functions("UTIL_EntityFromUserMessageEHandle").call_policies = call_policies.return_value_policy(
                call_policies.return_by_value
            )
        mb.free_functions("UTIL_PlayerByUserId").call_policies = call_policies.return_value_policy(
            call_policies.return_by_value
        )

        # Transformations
        mb.free_functions("GetVectorInScreenSpace").add_transformation(FT.output("iX"), FT.output("iY"))
        mb.free_functions("GetTargetInScreenSpace").add_transformation(FT.output("iX"), FT.output("iY"))
Пример #10
0
    def ParseTextEntry(self, mb):
        # List of overridables
        mb.mem_funs('SetText').virtuality = 'virtual'
        mb.mem_funs('MoveCursor').virtuality = 'virtual'
        mb.mem_funs('SetDisabledBgColor').virtuality = 'virtual'
        mb.mem_funs('SetMultiline').virtuality = 'virtual'
        mb.mem_funs('SetVerticalScrollbar').virtuality = 'virtual'

        #
        mb.mem_funs('GetEditMenu').exclude(
        )  # Exclude for now, add back later when we found out call policies.

        mb.mem_funs('GetSelectedRange').add_transformation(
            FT.output('cx0'), FT.output('cx1'))
        mb.mem_funs('CursorToPixelSpace').add_transformation(
            FT.inout('cx'), FT.inout('cy'))
        mb.mem_funs('AddAnotherLine').add_transformation(
            FT.output('cx'), FT.output('cy'))
        mb.mem_funs('GetStartDrawIndex').add_transformation(
            FT.output('lineBreakIndexIndex'))

        charstrexcludetypes = [pointer_t(const_t(declarated_t(char_t())))]

        # Wrap GetText manual
        cls = mb.class_('TextEntry')
        cls.mem_funs('GetText').exclude()
        cls.add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    const char *buf = (const char *)malloc( (GetTextLength()+1)*sizeof(char) );\r\n' + \
            '    TextEntry::GetText((char *)buf, GetTextLength()+1);\r\n' + \
            '    boost::python::object rv(buf);\r\n' + \
            '    delete buf;\r\n' + \
            '    return rv;\r\n' + \
            '}'
        )

        cls.add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextEntry_wrapper::* )())( &TextEntry_wrapper::GetText ) )'
        )

        cls.calldefs(
            name='SetText',
            function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(
            name='InsertString',
            function=calldef_withtypes(charstrexcludetypes)).exclude()

        # RichText
        cls = mb.class_('RichText')
        cls.calldefs(
            name='SetText',
            function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(
            name='InsertString',
            function=calldef_withtypes(charstrexcludetypes)).exclude()
        if self.settings.branch == 'swarm':
            mb.mem_funs('GetScrollBar').exclude()
Пример #11
0
 def customize( self, mb ):
     mb.class_("Derived2").member_functions("eval_c").exclude()
     mb.class_( 'BB' ).include()
     do_smth = mb.mem_fun( '::override_bug::AA::do_smth' )
     do_smth.add_transformation( FT.output(0), alias='do_smth_a' )
     do_smth = mb.mem_fun( '::override_bug::BB::do_smth' )
     do_smth.add_transformation( FT.output(0), FT.output(1), alias='do_smth_b' )
     mb.class_( 'XX' ).mem_fun( 'do_smth' ).exclude()
Пример #12
0
    def ScrollBar(self, mb):
        mb.mem_funs( 'GetButton' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetSlider' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        
        mb.mem_funs( 'GetRange' ).add_transformation( FT.output('min'), FT.output('max') ) 

        # ScrollBarSlider
        mb.mem_funs( 'GetNobPos' ).add_transformation( FT.output('min'), FT.output('max') ) 
Пример #13
0
 def customize( self, mb ):
     mb.class_("Derived2").member_functions("eval_c").exclude()
     mb.class_( 'BB' ).include()
     do_smth = mb.mem_fun( '::override_bug::AA::do_smth' )
     do_smth.add_transformation( FT.output(0), alias='do_smth_a' )
     do_smth = mb.mem_fun( '::override_bug::BB::do_smth' )
     do_smth.add_transformation( FT.output(0), FT.output(1), alias='do_smth_b' )
     mb.class_( 'XX' ).mem_fun( 'do_smth' ).exclude()
Пример #14
0
    def ScrollBar(self, mb):
        mb.mem_funs( 'GetButton' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetSlider' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        
        mb.mem_funs( 'GetRange' ).add_transformation( FT.output('min'), FT.output('max') ) 

        # ScrollBarSlider
        mb.mem_funs( 'GetNobPos' ).add_transformation( FT.output('min'), FT.output('max') ) 
Пример #15
0
 def wrap_viewerbase(self):
     vb = self.mb.class_("ViewerBase")
     vb.constructors().exclude()
     vb.noncopyable = True
     vb.no_init = True
     vb.member_function("getWindows").add_transformation(
         FT.output("windows"))
     vb.member_function("getViews").add_transformation(FT.output("views"))
Пример #16
0
 def wrap_TriviewControl(self):
     tvc = self.mb.class_('TriviewControl')
     tvc.include()
     # getFocusLocation passes int refs as args for return.
     gfl = tvc.member_function('getFocusLocation')
     gfl.add_transformation(FT.output('cx'), FT.output('cy'),
                            FT.output('cz'))
     fn = tvc.member_function('getTriViewColorDispType')
     fn.add_transformation(FT.output('mytype'))
Пример #17
0
    def wrap(self):
        mb = self.mb

        # Wrap everything in the "osg" namespace
        osgViewer = mb.namespace("osgViewer")
        osgViewer.include()

        mb.free_functions(lambda f: f.name.startswith("osgViewer")).include()

        wrap_call_policies(self.mb)

        # self.wrap_all_osg_referenced_noderive(osgViewer)
        self.wrap_all_osg_referenced(osgViewer)

        # Avoid infinite recursion runtime error by making some classes
        # non-overridable
        for cls_name in [
                "GraphicsWindowEmbedded",
                "Viewer",
        ]:
            expose_nonoverridable_ref_ptr_class(osgViewer.class_(cls_name))

        for cls in mb.classes(lambda c: c.name.endswith("Handler")):
            cls.member_functions("handle", allow_empty=True).exclude()
            cls.noncopyable = True

        self.wrap_viewerbase()
        self.wrap_view()
        self.wrap_keystone()
        self.wrap_screencapturehandler()

        # Handles all remaining W1009 warnings.
        # execution error W1009: The function takes as argument...
        osgViewer.class_("GraphicsWindow").member_function(
            "getWindowRectangle").add_transformation(FT.output("x"),
                                                     FT.output("y"),
                                                     FT.output("width"),
                                                     FT.output("height"))
        osgViewer.class_("GraphicsWindow").member_function(
            "getSwapGroup").add_transformation(FT.output("on"),
                                               FT.output("group"),
                                               FT.output("barrier"))
        osgViewer.class_("View").member_function(
            "getCameraContainingPosition").exclude()
        # .add_transformation(FT.output("local_x"), FT.output("local_y"))
        osgViewer.class_("DepthPartitionSettings").member_function(
            "getDepthRange").add_transformation(
                # FT.output("view"),
                FT.output("zNear"),
                FT.output("zFar"))

        hide_nonpublic(mb)

        self.mb.build_code_creator(module_name='_osgViewer')
        self.mb.split_module(
            os.path.join(os.path.abspath('.'), 'generated_code'))
        # Create a file to indicate completion of wrapping script
        open(
            os.path.join(os.path.abspath('.'), 'generated_code',
                         'generate_module.stamp'), "w").close()
Пример #18
0
 def wrap_TriviewControl(self):
     tvc = self.mb.class_('TriviewControl')
     tvc.include()
     # getFocusLocation passes int refs as args for return.
     gfl = tvc.member_function('getFocusLocation')
     gfl.add_transformation( 
             FT.output('cx'), 
             FT.output('cy'), 
             FT.output('cz') )
     fn = tvc.member_function('getTriViewColorDispType')
     fn.add_transformation(FT.output('mytype'))
Пример #19
0
    def wrap(self):
        mb = self.mb
        
        # Wrap everything in the "osg" namespace
        osgViewer = mb.namespace("osgViewer")
        osgViewer.include()

        mb.free_functions(lambda f: f.name.startswith("osgViewer")).include()

        wrap_call_policies(self.mb)

        # self.wrap_all_osg_referenced_noderive(osgViewer)
        self.wrap_all_osg_referenced(osgViewer)
        
        # Avoid infinite recursion runtime error by making some classes
        # non-overridable
        for cls_name in ["GraphicsWindowEmbedded", "Viewer", ]:
            expose_nonoverridable_ref_ptr_class(osgViewer.class_(cls_name))

        for cls in mb.classes(lambda c: c.name.endswith("Handler")):
            cls.member_functions("handle", allow_empty=True).exclude()
            cls.noncopyable = True
            
        self.wrap_viewerbase()
        self.wrap_view()
        self.wrap_keystone()
        self.wrap_screencapturehandler()
        
        # Handles all remaining W1009 warnings.
        # execution error W1009: The function takes as argument...
        osgViewer.class_("GraphicsWindow").member_function(
                "getWindowRectangle").add_transformation(
                    FT.output("x"),
                    FT.output("y"),
                    FT.output("width"),
                    FT.output("height"))
        osgViewer.class_("GraphicsWindow").member_function(
                "getSwapGroup").add_transformation(
                    FT.output("on"),
                    FT.output("group"),
                    FT.output("barrier"))
        osgViewer.class_("View").member_function(
                "getCameraContainingPosition").exclude()
                # .add_transformation(FT.output("local_x"), FT.output("local_y"))
        osgViewer.class_("DepthPartitionSettings").member_function(
                "getDepthRange").add_transformation(
                    # FT.output("view"),
                    FT.output("zNear"),
                    FT.output("zFar"))

        hide_nonpublic(mb)
        
        self.mb.build_code_creator(module_name='_osgViewer')
        self.mb.split_module(os.path.join(os.path.abspath('.'), 'generated_code'))
        # Create a file to indicate completion of wrapping script
        open(os.path.join(os.path.abspath('.'), 'generated_code', 'generate_module.stamp'), "w").close()
Пример #20
0
def ManualTransformations ( mb ):
    global_ns = mb.global_ns
    main_ns = global_ns # global_ns.namespace(  )
        
    def create_output( size ):
        return [ ft.output( i ) for i in range( size ) ]
  
    x = main_ns.mem_fun('::Opcode::PlanesCollider::PlanesAABBOverlap') 
    x.add_transformation(ft.output('out_clip_mask'))
    x.documentation = docit ("","Point center, Point extents, , udword in_clip_mask", "out_clip_mask")     
     
    x = main_ns.mem_fun('::IceMaths::IndexedTriangle::GetVRefs') 
    x.add_transformation(ft.output('vref0'),ft.output('vref1'),ft.output('vref2'))
    x.documentation = docit ("","ubyte edgenb", "vref0, vref1, vref2")      
 
    x = main_ns.mem_fun('::IceCore::Container::FindNext') 
    x.add_transformation(ft.inout('entry'))
    x.documentation = docit ("","container, entry", "entry, mode")      
    
    x = main_ns.mem_fun('::IceCore::Container::FindPrev') 
    x.add_transformation(ft.inout('entry'))
    x.documentation = docit ("","container, entry", "entry, mode")   
       
    x = main_ns.free_function('::IceCore::Compute3DCoords') 
    x.add_transformation(ft.output('u'),ft.output('v'),ft.output('w'))
    x.documentation = docit ("","i, nbu, nbu_nbv", "u,v,w")      

    x = main_ns.free_function('::IceCore::Compute2DCoords') 
    x.add_transformation(ft.output('u'),ft.output('v'))
    x.documentation = docit ("","i, nbu", "u,v") 
         
    x = main_ns.free_function('::IceCore::Swap') 
    x.add_transformation(ft.inout('x'),ft.inout('y'))
    x.documentation = docit ("","x,y", "x,y")      

    x = main_ns.free_function('::IceCore::SetLeastNBits') 
    x.add_transformation(ft.inout('x'))
    x.documentation = docit ("","x, n", "x") 
         
    x = main_ns.free_function('::IceCore::ZeroLeastSetBit') 
    x.add_transformation(ft.inout('n'))
    x.documentation = docit ("","n", "n")   
    
    x = main_ns.free_function('::IceCore::SpreadBits') 
    x.add_transformation(ft.inout('n'))
    x.documentation = docit ("","n", "n")  
        
    x = main_ns.free_function('::IceCore::ReverseBits') 
    x.add_transformation(ft.inout('n'))
    x.documentation = docit ("","n", "n")      
    
    x = main_ns.mem_fun('::IceMaths::AABB::ComputeOutline') 
    x.add_transformation(ft.inout('num'))
    
    x = main_ns.mem_fun('::IceMaths::AABB::ComputeBoxArea') 
    x.add_transformation(ft.inout('num'))
Пример #21
0
 def wrap_quaternion(self):
     quat = self.mb.class_("Quat")
     have_getRotate = False # Just wrap one version
     for fn in quat.member_functions("getRotate"):
         if len(fn.arguments) != 2: # ignore 4-argument versions
             fn.exclude()
         elif have_getRotate: # only accept the very first 2-argument version
             fn.exclude()
         else:
             # Only expose this one version of getRotate
             fn.add_transformation(FT.output('angle'), FT.output('vec'))
             # avoid ugly alias
             fn.transformations[-1].alias = fn.alias
             have_getRotate = True
Пример #22
0
 def wrap_quaternion(self):
     quat = self.mb.class_("Quat")
     have_getRotate = False  # Just wrap one version
     for fn in quat.member_functions("getRotate"):
         if len(fn.arguments) != 2:  # ignore 4-argument versions
             fn.exclude()
         elif have_getRotate:  # only accept the very first 2-argument version
             fn.exclude()
         else:
             # Only expose this one version of getRotate
             fn.add_transformation(FT.output("angle"), FT.output("vec"))
             # avoid ugly alias
             fn.transformations[-1].alias = fn.alias
             have_getRotate = True
Пример #23
0
    def Parse(self, mb):
        # Exclude everything, then add what we need
        # Otherwise we get very big source code and dll's
        mb.decls().exclude()

        mb.free_function('NavMeshAvailable').include()
        mb.free_function('NavMeshTestHasArea').include()
        mb.free_function('NavMeshGetPathDistance').include()
        mb.free_function('NavMeshGetPositionNearestNavArea').include()
        mb.free_function('CreateNavArea').include()
        mb.free_function('CreateNavAreaByCorners').include()
        mb.free_function('DestroyNavArea').include()
        mb.free_function('RandomNavAreaPosition').include()
        mb.free_function('RandomNavAreaPositionWithin').include()
        mb.free_function('DestroyAllNavAreas').include()

        mb.free_function('GetActiveNavMesh').include()
        mb.free_function('GetEditingCursor').include()

        mb.free_function('GetNavAreaAt').include()
        mb.free_function('GetNavAreasAtBB').include()
        mb.free_function('SplitAreasAtBB').include()
        mb.free_function('SetAreasBlocked').include()
        mb.free_function('IsAreaBlocked').include()
        mb.free_function('IsBBCoveredByNavAreas').include()

        mb.free_function('TryMergeSurrounding').include()

        mb.free_function('GetHidingSpotsInRadius').include()
        mb.free_function('CreateHidingSpot').include()
        mb.free_function('CreateHidingSpot').add_transformation(
            FT.output('navareaid'))
        mb.free_function('DestroyHidingSpot').include()
        mb.free_function('DestroyHidingSpotByID').include()
Пример #24
0
 def Parse(self, mb):
     # Exclude everything, then add what we need
     # Otherwise we get very big source code and dll's
     mb.decls().exclude() 
     
     mb.free_function('NavMeshAvailable').include()
     mb.free_function('NavMeshTestHasArea').include()
     mb.free_function('NavMeshGetPathDistance').include()
     mb.free_function('NavMeshGetPositionNearestNavArea').include()
     mb.free_function('CreateNavArea').include()
     mb.free_function('CreateNavAreaByCorners').include()
     mb.free_function('DestroyNavArea').include()
     mb.free_function('RandomNavAreaPosition').include()
     mb.free_function('RandomNavAreaPositionWithin').include()
     mb.free_function('DestroyAllNavAreas').include()
     
     mb.free_function('GetActiveNavMesh').include()
     mb.free_function('GetEditingCursor').include()
     
     mb.free_function('GetNavAreaAt').include()
     mb.free_function('GetNavAreasAtBB').include()
     mb.free_function('SplitAreasAtBB').include()
     mb.free_function('SetAreasBlocked').include()
     mb.free_function('IsAreaBlocked').include()
     mb.free_function('IsBBCoveredByNavAreas').include()
     
     mb.free_function('TryMergeSurrounding').include()
     
     mb.free_function('GetHidingSpotsInRadius').include()
     mb.free_function('CreateHidingSpot').include()
     mb.free_function('CreateHidingSpot').add_transformation( FT.output('navareaid') )
     mb.free_function('DestroyHidingSpot').include()
     mb.free_function('DestroyHidingSpotByID').include()
     
Пример #25
0
 def wrap_LocationSimple(self):
     cls = self.mb.class_('LocationSimple')
     cls.include()
     # TODO - use only the float version of getCoord,
     # ...and push arguments to return value.
     for fn in cls.member_functions('getCoord'):
         arg_t = fn.argument_types[0]
         if (arg_t.decl_string == "int &"):
             # fn.exclude() # don't want the int one
             fn_alias = 'getCoordInt'
         else:
             # want the float one
             fn_alias = 'getCoord'
         fn.add_transformation(FT.output('xx'),
                               FT.output('yy'),
                               FT.output('zz'),
                               alias=fn_alias)
Пример #26
0
    def ParseTextEntry(self, mb):
        # List of overridables
        mb.mem_funs('SetText').virtuality = 'virtual'
        mb.mem_funs('MoveCursor').virtuality = 'virtual'
        mb.mem_funs('SetDisabledBgColor').virtuality = 'virtual'
        mb.mem_funs('SetMultiline').virtuality = 'virtual'
        mb.mem_funs('SetVerticalScrollbar').virtuality = 'virtual'

        #
        mb.mem_funs('GetEditMenu').exclude()        # Exclude for now, add back later when we found out call policies.
        
        mb.mem_funs( 'GetSelectedRange' ).add_transformation( FT.output('cx0'), FT.output('cx1') )   
        mb.mem_funs( 'CursorToPixelSpace' ).add_transformation( FT.inout('cx'), FT.inout('cy') ) 
        mb.mem_funs( 'AddAnotherLine' ).add_transformation( FT.output('cx'), FT.output('cy') ) 
        mb.mem_funs( 'GetStartDrawIndex' ).add_transformation( FT.output('lineBreakIndexIndex') )
        
        charstrexcludetypes = [pointer_t(const_t(declarated_t(char_t())))]
        
        # Wrap GetText manual
        cls = mb.class_('TextEntry')
        cls.mem_funs('GetText').exclude()
        cls.add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    const char *buf = (const char *)malloc( (GetTextLength()+1)*sizeof(char) );\r\n' + \
            '    TextEntry::GetText((char *)buf, GetTextLength()+1);\r\n' + \
            '    boost::python::object rv(buf);\r\n' + \
            '    delete buf;\r\n' + \
            '    return rv;\r\n' + \
            '}'
        )
        
        cls.add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextEntry_wrapper::* )())( &TextEntry_wrapper::GetText ) )'
        )
        
        cls.calldefs(name='SetText', function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(name='InsertString', function=calldef_withtypes(charstrexcludetypes)).exclude()

        # RichText
        cls = mb.class_('RichText')
        cls.calldefs(name='SetText', function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(name='InsertString', function=calldef_withtypes(charstrexcludetypes)).exclude()
        if self.settings.branch == 'swarm':
            mb.mem_funs('GetScrollBar').exclude()
Пример #27
0
 def wrap_LocationSimple(self):
     cls = self.mb.class_('LocationSimple')
     cls.include()
     # TODO - use only the float version of getCoord, 
     # ...and push arguments to return value.
     for fn in cls.member_functions('getCoord'):
         arg_t = fn.argument_types[0]
         if (arg_t.decl_string == "int &"):
             # fn.exclude() # don't want the int one
             fn_alias = 'getCoordInt'
         else:
             # want the float one
             fn_alias = 'getCoord'
         fn.add_transformation( 
                               FT.output('xx'), 
                               FT.output('yy'), 
                               FT.output('zz'),
                               alias = fn_alias )
Пример #28
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()

        mb.class_('kbutton_t').include()
        if self.settings.branch == 'swarm':
            mb.class_('kbutton_t').mem_funs('GetPerUser').exclude()

        # Include input class
        cls = mb.class_('CInput')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        if self.settings.branch == 'swarm':
            #mb.mem_funs('FindKey').exclude() # FIXME
            mb.mem_funs(
                'FindKey').call_policies = call_policies.return_value_policy(
                    call_policies.reference_existing_object)
        else:
            mb.mem_funs(
                'FindKey').call_policies = call_policies.return_value_policy(
                    call_policies.manage_new_object)
        mb.mem_funs(
            'GetUserCmd').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object
            )  # Can't exclude due being abstract

        mb.mem_funs('CAM_OrthographicSize').add_transformation(
            FT.output('w'), FT.output('h'))

        mb.add_declaration_code(
            "CInput *wrap_Input()\r\n{\r\n\treturn (CInput *)::input;\r\n}\r\n"
        )
        mb.add_registration_code(
            'bp::def( "input", wrap_Input, bp::return_value_policy<bp::reference_existing_object>() );'
        )

        # ButtonCode.
        mb.enums('ButtonCode_t').include()

        # Remove any protected function
        mb.calldefs(matchers.access_type_matcher_t('protected')).exclude()
Пример #29
0
 def wrap_view(self):
     cls = self.mb.namespace("osgViewer").class_("View")
     for ctor in cls.constructors():
         ctor.allow_implicit_conversion = False
     cls.constructors(arg_types=[None, None]).exclude()
     cls.member_functions("computeIntersections").exclude()
     # RuntimeWarning: to-Python converter for class osg::ref_ptr<struct View_wrapper> already registered; second conversion method ignored.
     expose_nonoverridable_ref_ptr_class(cls)
     inner = cls.class_("StereoSlaveCallback")
     inner.member_function("updateSlave").exclude() # link error
     # 1>..\..\..\..\src\modules\osgViewer\generated_code\View.pypp.cpp(171) : error C2039: 'StereoSlaveCallback_wrapper' : is not a member of 'View_wrapper'
     expose_nonoverridable_ref_ptr_class(inner)
     # Move output arguments to return value tuple
     if False: # TODO - transformation does not seem to work with protected destructor classes
         gccp = cls.member_function("getCameraContainingPosition")
         gccp.add_transformation(FT.output('local_x'), FT.output('local_y'),)
     # Avoid premature destruction of manipulator
     # WEIRD movie maker crashes when I use (2, 1) here but not (1, 2)
     # BUT also crashes when osg.Camera.setFinalDrawCallback() uses (1, 2) but not (2, 1).
     # Whatever
     cls.member_function("setCameraManipulator").call_policies = with_custodian_and_ward(1, 2) # not crash
Пример #30
0
 def ParseFrame(self, mb):
     # List of overridables
     mb.mem_funs('SetTitle').virtuality = 'virtual'
     mb.mem_funs('Activate').virtuality = 'virtual'
     mb.mem_funs('ActivateMinimized').virtuality = 'virtual'
     mb.mem_funs('Close').virtuality = 'virtual'
     mb.mem_funs('CloseModal').virtuality = 'virtual'
     mb.mem_funs('SetMoveable').virtuality = 'virtual'
     mb.mem_funs('SetSizeable').virtuality = 'virtual'
     mb.mem_funs('SetMenuButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetMinimizeButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetMaximizeButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetMinimizeToSysTrayButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetCloseButtonVisible').virtuality = 'virtual'
     mb.mem_funs('FlashWindow').virtuality = 'virtual'
     mb.mem_funs('FlashWindowStop').virtuality = 'virtual'
     mb.mem_funs('SetTitleBarVisible').virtuality = 'virtual'
     mb.mem_funs('SetClipToParent').virtuality = 'virtual'
     mb.mem_funs('SetSmallCaption').virtuality = 'virtual'
     mb.mem_funs('DoModal').virtuality = 'virtual'
     mb.mem_funs('OnClose').virtuality = 'virtual'
     mb.mem_funs('OnFinishedClose').virtuality = 'virtual'
     mb.mem_funs('OnMinimize').virtuality = 'virtual'
     mb.mem_funs('OnMinimizeToSysTray').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('GetDefaultScreenPosition').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     
     #
     mb.mem_funs('SetDeleteSelfOnClose').exclude()
     mb.mem_funs('GetSysMenu').exclude() # Exclude for now, add back later when we found out call policies.
     
     mb.mem_funs( 'GetDefaultScreenPosition' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') ) 
     mb.mem_funs( 'GetClientArea' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') ) 
Пример #31
0
 def ParseFrame(self, mb):
     # List of overridables
     mb.mem_funs('SetTitle').virtuality = 'virtual'
     mb.mem_funs('Activate').virtuality = 'virtual'
     mb.mem_funs('ActivateMinimized').virtuality = 'virtual'
     mb.mem_funs('Close').virtuality = 'virtual'
     mb.mem_funs('CloseModal').virtuality = 'virtual'
     mb.mem_funs('SetMoveable').virtuality = 'virtual'
     mb.mem_funs('SetSizeable').virtuality = 'virtual'
     mb.mem_funs('SetMenuButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetMinimizeButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetMaximizeButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetMinimizeToSysTrayButtonVisible').virtuality = 'virtual'
     mb.mem_funs('SetCloseButtonVisible').virtuality = 'virtual'
     mb.mem_funs('FlashWindow').virtuality = 'virtual'
     mb.mem_funs('FlashWindowStop').virtuality = 'virtual'
     mb.mem_funs('SetTitleBarVisible').virtuality = 'virtual'
     mb.mem_funs('SetClipToParent').virtuality = 'virtual'
     mb.mem_funs('SetSmallCaption').virtuality = 'virtual'
     mb.mem_funs('DoModal').virtuality = 'virtual'
     mb.mem_funs('OnClose').virtuality = 'virtual'
     mb.mem_funs('OnFinishedClose').virtuality = 'virtual'
     mb.mem_funs('OnMinimize').virtuality = 'virtual'
     mb.mem_funs('OnMinimizeToSysTray').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('GetDefaultScreenPosition').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     mb.mem_funs('OnCloseFrameButtonPressed').virtuality = 'virtual'
     
     mb.mem_funs('SetDeleteSelfOnClose').exclude()
     mb.mem_funs('GetSysMenu').exclude()
     
     mb.mem_funs( 'GetDefaultScreenPosition' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') ) 
     mb.mem_funs( 'GetClientArea' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') ) 
Пример #32
0
    def ParseTextEntry(self, mb):
        # List of overridables
        mb.mem_funs('SetText').virtuality = 'virtual'
        mb.mem_funs('MoveCursor').virtuality = 'virtual'
        mb.mem_funs('SetDisabledBgColor').virtuality = 'virtual'
        mb.mem_funs('SetMultiline').virtuality = 'virtual'
        mb.mem_funs('SetVerticalScrollbar').virtuality = 'virtual'

        #
        mb.mem_funs('GetEditMenu').exclude()        # Exclude for now, add back later when we found out call policies.
        
        mb.mem_funs( 'GetSelectedRange' ).add_transformation( FT.output('cx0'), FT.output('cx1') )   
        mb.mem_funs( 'CursorToPixelSpace' ).add_transformation( FT.inout('cx'), FT.inout('cy') ) 
        mb.mem_funs( 'AddAnotherLine' ).add_transformation( FT.output('cx'), FT.output('cy') ) 
        mb.mem_funs( 'GetStartDrawIndex' ).add_transformation( FT.output('lineBreakIndexIndex') ) 
        
        # Wrap GetText manual
        mb.class_('TextEntry').mem_funs('GetText').exclude()
        mb.class_('TextEntry').add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    const char *buf = (const char *)malloc( (GetTextLength()+1)*sizeof(char) );\r\n' + \
            '    TextEntry::GetText((char *)buf, GetTextLength()+1);\r\n' + \
            #'    ((char *)buf)[GetTextLength()] = \'\\0\';\r\n' + \
            '    boost::python::object rv(buf);\r\n' + \
            '    delete buf;\r\n' + \
            '    return rv;\r\n' + \
            '}'
        )
        
        mb.class_('TextEntry').add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextEntry_wrapper::* )())( &TextEntry_wrapper::GetText ) )'
        )

        # RichText
        if settings.ASW_CODE_BASE:
            mb.mem_funs('GetScrollBar').exclude()
Пример #33
0
def ManualTransformations ( mb ):
    global_ns = mb.global_ns
    if MAIN_NAMESPACE:
        main_ns = global_ns.namespace( MAIN_NAMESPACE )
    else:
        main_ns = global_ns
                
    def create_output( size ):
        return [ ft.output( i ) for i in range( size ) ]

    return        
    x= main_ns.mem_funs('::Caelum::Astronomy::getGregorianDateFromJulianDay')
    x.add_transformation( ft.output('year'), ft.output('month'), ft.output('day'), alias = 'getGregorianDateFromJulianDay' )
    x.documentation = docit ("","JulianDay", "tuple - year,month,day")
        
    x=main_ns.mem_fun('::Caelum::Astronomy::getGregorianDateTimeFromJulianDay')
    x.add_transformation( ft.output('year'), ft.output('month'), ft.output('day'),ft.output('hour'), ft.output('minute'), ft.output('second'), alias='getGregorianDateTimeFromJulianDay' )
    x.documentation = docit ("","JulianDay", "tuple - year,month,day,hour, minute, second")

    x=main_ns.mem_fun('::Caelum::Astronomy::convertEclipticToEquatorialRad')
    x.add_transformation( ft.inout ('rasc'), ft.inout('decl'), alias='convertEclipticToEquatorialRad')
    x.documentation = docit("","","tuple - rasc, decl")
    
    x=main_ns.mem_fun('::Caelum::Astronomy::convertRectangularToSpherical')
    x.add_transformation( ft.inout ('rasc'), ft.inout('decl'), ft.inout('dist'), alias='convertRectangularToSpherical')
    x.documentation = docit("","","tuple - rasc, decl, dist")
    
    x=main_ns.mem_fun('::Caelum::Astronomy::convertSphericalToRectangular')
    x.add_transformation( ft.inout ('x'), ft.inout('y'), ft.inout('z'), alias='convertSphericalToRectangular')
    x.documentation = docit("","","tuple - x,y,z")
    
    x=main_ns.mem_fun('::Caelum::Astronomy::convertEquatorialToHorizontal')
    x.add_transformation( ft.inout ('azimuth'), ft.inout('altitude'), alias='convertEquatorialToHorizontal')
    x.documentation = docit("","","tuple - azimuth,altitude")
    
    x=main_ns.mem_fun('::Caelum::Astronomy::getHorizontalSunPosition', arg_types=['::Caelum::LongReal','::Caelum::LongReal','::Caelum::LongReal','::Caelum::LongReal &','::Caelum::LongReal &'])
    x.add_transformation( ft.inout ('azimuth'), ft.inout('altitude'), alias='getHorizontalSunPositionDouble')
    x.documentation = docit("","","tuple - azimuth,altitude")

    x=main_ns.mem_fun('::Caelum::Astronomy::getHorizontalMoonPosition',arg_types=['::Caelum::LongReal','::Caelum::LongReal','::Caelum::LongReal','::Caelum::LongReal &','::Caelum::LongReal &'])
    x.add_transformation( ft.inout ('azimuth'), ft.inout('altitude'), alias='getHorizontalMoonPositionDouble')
    x.documentation = docit("","","tuple - azimuth,altitude")
    
    x=main_ns.mem_fun('::Caelum::Astronomy::getEclipticMoonPositionRad')
    x.add_transformation( ft.inout ('lon'), ft.inout('lat'), alias='getEclipticMoonPositionRad')
    x.documentation = docit("","","tuple - lon,lat")
 def test(self):
     mb = module_builder.module_builder_t(
         [module_builder.create_text_fc(self.CLASS_DEF)],
         xml_generator_config=autoconfig.xml_generator_config)
     mb.namespace(name='::tester').include()
     x = mb.class_('x')
     x.add_registration_code('//hello world reg')
     x.add_declaration_code('//hello world decl')
     nested = x.class_('x_nested')
     nested.add_declaration_code('//hello nested decl')
     nested.add_registration_code('//hello nested reg', False)
     mb.calldefs('check_overload').use_overload_macro = True
     mb.calldefs( 'get_opaque' ).call_policies \
       = module_builder.call_policies.return_value_policy( module_builder.call_policies.return_opaque_pointer )
     mb.class_('op_struct').exclude()
     mb.member_function( 'get_rate' ).call_policies \
         = module_builder.call_policies.return_value_policy( module_builder.call_policies.return_pointee_value )
     mb.member_function('get_size').add_transformation(ft.output(0))
     mb.build_code_creator('x_class_multi')
     mb.split_module(autoconfig.build_dir, [mb.class_('::tester::x')],
                     on_unused_file_found=lambda fpath: fpath,
                     use_files_sum_repository=True)
Пример #35
0
 def test(self):
     mb = module_builder.module_builder_t(
             [ module_builder.create_text_fc( self.CLASS_DEF ) ]
             , gccxml_path=autoconfig.gccxml.executable )
     mb.namespace( name='::tester' ).include()
     x = mb.class_( 'x' )
     x.add_registration_code( '//hello world reg' )
     x.add_declaration_code( '//hello world decl' )
     nested = x.class_( 'x_nested' )
     nested.add_declaration_code( '//hello nested decl' )
     nested.add_registration_code( '//hello nested reg', False )
     mb.calldefs( 'check_overload' ).use_overload_macro = True
     mb.calldefs( 'get_opaque' ).call_policies \
       = module_builder.call_policies.return_value_policy( module_builder.call_policies.return_opaque_pointer )
     mb.class_( 'op_struct' ).exclude()
     mb.mem_fun( 'get_rate' ).call_policies \
         = module_builder.call_policies.return_value_policy( module_builder.call_policies.return_pointee_value )
     mb.mem_fun( 'get_size' ).add_transformation( ft.output(0) )
     mb.build_code_creator('x_class_multi')
     mb.split_module( autoconfig.build_dir
                     , [ mb.class_( '::tester::x' ) ]
                     , on_unused_file_found=lambda fpath: fpath
                     , use_files_sum_repository=True)
Пример #36
0
def add_transformations ( mb ):
    ns = mb.global_ns.namespace ('OgreNewt')
    
    def create_output( size ):
        return [ ft.output( i ) for i in range( size ) ]
   
    ns.mem_fun('::OgreNewt::Body::getPositionOrientation').add_transformation( *create_output(2) )
    ns.mem_fun('::OgreNewt::Body::getMassMatrix').add_transformation( *create_output(2) )
    ns.mem_fun('::OgreNewt::Body::getInvMass').add_transformation( *create_output(2) )
    ns.mem_fun('::OgreNewt::Body::getFreezeThreshold').add_transformation( *create_output(2) )
    ns.mem_fun('::OgreNewt::ConvexCollision::calculateInertialMatrix').add_transformation( *create_output(2) )
    
    ns.mem_fun('::OgreNewt::CustomJoint::pinAndDirToLocal') \
        .add_transformation(ft.output('localOrient0'), ft.output('localPos0'), ft.output('localOrient1'), ft.output('localPos1') )
    ns.mem_fun('::OgreNewt::CustomJoint::localToGlobal') \
        .add_transformation(ft.output('globalOrient'), ft.output('globalPos') )

    ns.mem_fun('::OgreNewt::Vehicle::Tire::getPositionOrientation').add_transformation( *create_output(2) )
    ns.mem_fun('::OgreNewt::ContactCallback::getContactPositionAndNormal').add_transformation( *create_output(2) )
    ns.mem_fun('::OgreNewt::ContactCallback::getContactTangentDirections').add_transformation( *create_output(2) )
   
    ns.free_fun('CollisionRayCast').add_transformation( ft.output('retColID') )
    ns.free_fun('CollisionCollideContinue').add_transformation( ft.output('retTimeOfImpact') )
Пример #37
0
    def ParseMatchmaking(self, mb):
        # The main matchmaking interface
        cls = mb.class_('ISteamMatchmaking')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs('GetLobbyGameServer').add_transformation(
            FT.output('punGameServerIP'), FT.output('punGameServerPort'),
            FT.output('psteamIDGameServer'))

        cls.mem_fun('GetLobbyDataByIndex').exclude()
        cls.mem_fun('SendLobbyChatMsg').exclude()
        cls.mem_fun('GetLobbyChatEntry').exclude()

        mb.free_function('PyGetLobbyDataByIndex').include()
        mb.free_function('PySendLobbyChatMsg').include()
        mb.free_function('PyGetLobbyChatEntry').include()

        mb.var('k_uAPICallInvalid').include()

        self.AddSteamCallResult('LobbyMatchList', 'LobbyMatchList_t')
        self.AddSteamCallResult('LobbyGameCreated', 'LobbyGameCreated_t')
        self.AddSteamCallResult('LobbyCreated', 'LobbyCreated_t')
        self.AddSteamCallResult('LobbyEnter', 'LobbyEnter_t')

        self.AddSteamCallback('LobbyChatUpdate', 'LobbyChatUpdate_t')
        self.AddSteamCallback('LobbyChatMsg', 'LobbyChatMsg_t')
        self.AddSteamCallback('LobbyDataUpdate', 'LobbyDataUpdate_t')

        # Servers matchmaking interface
        cls = mb.class_('PySteamMatchmakingServers')
        cls.include()
        cls.rename('SteamMatchmakingServers')

        cls = mb.class_('PySteamMatchmakingServerListResponse')
        cls.include()
        cls.rename('SteamMatchmakingServerListResponse')
        cls.mem_fun('PyServerResponded').rename('ServerResponded')
        cls.mem_fun('PyServerFailedToRespond').rename('ServerFailedToRespond')
        cls.mem_fun('PyRefreshComplete').rename('RefreshComplete')

        cls = mb.class_('gameserveritem_t')
        cls.include()
        cls.mem_fun('SetName').exclude()
        self.PythonfyVariables(cls)
        cls.var('m_szGameDir').exclude()
        cls.var('m_szMap').exclude()
        cls.var('m_szGameDescription').exclude()
        cls.var('m_szGameTags').exclude()

        cls = mb.class_('pygameserveritem_t')
        cls.include()
        self.PythonfyVariables(cls)
        self.AddProperty(cls, 'gamedir', 'GetGameDir')
        self.AddProperty(cls, 'map', 'GetMap')
        self.AddProperty(cls, 'gamedescription', 'GetGameDescription')
        self.AddProperty(cls, 'gametags', 'GetGameTags')

        cls = mb.class_('servernetadr_t')
        cls.include()
        cls.rename('servernetadr')

        cls = mb.class_('PySteamMatchmakingPingResponse')
        cls.include()
        cls.rename('SteamMatchmakingPingResponse')

        cls = mb.class_('PySteamMatchmakingPlayersResponse')
        cls.include()
        cls.rename('SteamMatchmakingPlayersResponse')

        cls = mb.class_('PySteamMatchmakingRulesResponse')
        cls.include()
        cls.rename('SteamMatchmakingRulesResponse')

        # Enums
        mb.enums('ELobbyType').include()
        mb.enums('ELobbyComparison').include()
        mb.enums('ELobbyDistanceFilter').include()
        mb.enums('EMatchMakingServerResponse').include()
Пример #38
0
    mb.calldefs(access_type_matcher_t('protected')).exclude()
    mb.calldefs(access_type_matcher_t('private')).exclude()
    # ####################################################
    # SCRIPT POUR ../input_output/bin.h
    mb.class_("t_pos").decl("operator float *").exclude()
    # ####################################################
    # SCRIPT POUR ../input_output/gabe/stdgabe.h
    mb.namespace("formatGABE").exclude()
    mb.namespace("formatGABE").decls("GABE_OBJECTTYPE").include()
    mb.decls(lambda decl: 'impl_' in decl.name).exclude()
    io_gabe = mb.class_("Gabe_rw")
    io_gabe.mem_fun("size").alias = "__len__"
    #transforme le parametre en valeur de retour des fonctions commencant par ReadCol
    io_gabe.decls(
        lambda decl: decl.name.startswith('ReadCol')).add_transformation(
            FT.output(1))

    # ####################################################
    # SCRIPT POUR ../input_output/mbin.h
    cmbin = mb.namespace("formatMBIN").class_("CMBIN")
    cmbin.mem_fun("ImportBIN").exclude()
    cmbin.mem_fun("ExportBIN").exclude()

    # ####################################################
    # SCRIPT POUR     ../input_output/cxml.h
    # mb.namespace("BasicXmlProcess").exclude()
    # cxmlnode=mb.class_("CXmlNode")
    # cxmlnode.mem_fun("GetChild").call_policies =  call_policies.return_value_policy( call_policies.return_opaque_pointer )
    # cxmlnode.decls("t_nodeData").exclude()
    # cxml=mb.class_("CXml")
    # cxml.mem_fun("GetRoot").call_policies =  call_policies.return_value_policy( call_policies.return_opaque_pointer )
Пример #39
0
    def ParsePanel(self, mb):
        # List of functions that should be overridable
        mb.mem_funs('SetVisible').virtuality = 'virtual'
        mb.mem_funs('SetParent').virtuality = 'virtual'
        mb.mem_funs('SetEnabled').virtuality = 'virtual'
        
        mb.mem_funs('SetBgColor').virtuality = 'virtual'
        mb.mem_funs('SetFgColor').virtuality = 'virtual'
        mb.mem_funs('SetCursor').virtuality = 'virtual'
        
        mb.mem_funs('InvalidateLayout').virtuality = 'virtual'
        
        mb.mem_funs('SetBorder').virtuality = 'virtual'
        mb.mem_funs('SetPaintBorderEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintBackgroundEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintBackgroundType').virtuality = 'virtual'
        mb.mem_funs('SetScheme').virtuality = 'virtual'
        
        mb.mem_funs('ApplySchemeSettings').virtuality = 'virtual'
        mb.mem_funs('OnCommand').virtuality = 'virtual'
        mb.mem_funs('OnMouseCaptureLost').virtuality = 'virtual'
        mb.mem_funs('OnSetFocus').virtuality = 'virtual'
        mb.mem_funs('OnKillFocus').virtuality = 'virtual'
        mb.mem_funs('OnDelete').virtuality = 'virtual'
        mb.mem_funs('OnThink').virtuality = 'virtual'
        mb.mem_funs('OnChildAdded').virtuality = 'virtual'
        mb.mem_funs('OnSizeChanged').virtuality = 'virtual'
        mb.mem_funs('OnTick').virtuality = 'virtual'
        
        mb.mem_funs('OnCursorMoved').virtuality = 'virtual'
        mb.mem_funs('OnCursorEntered').virtuality = 'virtual'
        mb.mem_funs('OnCursorExited').virtuality = 'virtual'
        mb.mem_funs('OnMousePressed').virtuality = 'virtual'
        mb.mem_funs('OnMouseDoublePressed').virtuality = 'virtual'
        mb.mem_funs('OnMouseReleased').virtuality = 'virtual'
        mb.mem_funs('OnMouseWheeled').virtuality = 'virtual'
        mb.mem_funs('OnMouseTriplePressed').virtuality = 'virtual'
        
        mb.mem_funs('OnKeyCodePressed').virtuality = 'virtual'
        mb.mem_funs('OnKeyCodeTyped').virtuality = 'virtual'
        mb.mem_funs('OnKeyCodeReleased').virtuality = 'virtual'
        mb.mem_funs('OnKeyFocusTicked').virtuality = 'virtual'
        mb.mem_funs('OnMouseFocusTicked').virtuality = 'virtual'
        
        mb.mem_funs('PaintBackground').virtuality = 'virtual'
        mb.mem_funs('Paint').virtuality = 'virtual'
        #mb.mem_funs('PaintBorder').virtuality = 'virtual' # TODO: Don't believe we are ever interested in painting borders in python
        mb.mem_funs('PaintBuildOverlay').virtuality = 'virtual'
        mb.mem_funs('PostChildPaint').virtuality = 'virtual'
        mb.mem_funs('PerformLayout').virtuality = 'virtual'
        
        mb.mem_funs('SetMouseInputEnabled').virtuality = 'virtual'
        mb.mem_funs('SetKeyBoardInputEnabled').virtuality = 'virtual'
        
        mb.mem_funs('SetDragEnabled').virtuality = 'virtual'
        
        mb.mem_funs('OnRequestFocus').virtuality = 'virtual'
        mb.mem_funs('OnScreenSizeChanged').virtuality = 'virtual'

        # Transformations
        mb.mem_funs( 'GetPos' ).add_transformation( FT.output('x'), FT.output('y') )
        mb.class_('Panel').mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.class_('Panel').mem_funs( 'GetBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'GetMinimumSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'LocalToScreen' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'ScreenToLocal' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'ParentLocalToScreen' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'GetInset' ).add_transformation( FT.output('left'), FT.output('top'), FT.output('right'), FT.output('bottom') )
        mb.mem_funs( 'GetPaintSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'GetClipRect' ).add_transformation( FT.output('x0'), FT.output('y0'), FT.output('x1'), FT.output('y1') )
        mb.mem_funs( 'GetPinOffset' ).add_transformation( FT.output('dx'), FT.output('dy') )
        mb.mem_funs( 'GetResizeOffset' ).add_transformation( FT.output('dx'), FT.output('dy') )
        mb.mem_funs( 'GetCornerTextureSize' ).add_transformation( FT.output('w'), FT.output('h') )    
        
        # Exclude list
        mb.mem_funs('QueryInterface').exclude()
        
        # We don't care about build mode, since we can easily reload modules in python
        # We also don't want the user to be able to call methods like Delete.
        mb.mem_funs('IsBuildModeEditable').exclude()
        mb.mem_funs('SetBuildModeEditable').exclude()
        mb.mem_funs('IsBuildModeDeletable').exclude()
        mb.mem_funs('SetBuildModeDeletable').exclude()
        mb.mem_funs('IsBuildModeActive').exclude()
        #mb.mem_funs('SetAutoDelete').exclude()
        #mb.mem_funs('IsAutoDeleteSet').exclude()
        mb.mem_funs('OnDelete').exclude()
        mb.mem_funs('MarkForDeletion').exclude()
        mb.mem_funs('SetBuildGroup').exclude()
        mb.mem_funs('IsBuildGroupEnabled').exclude()
        mb.mem_funs('CreateControlByName').exclude()
        
        mb.mem_funs('LoadKeyBindings').exclude()
        mb.mem_funs('SaveKeyBindingsToBuffer').exclude()
        mb.mem_funs('LookupBoundKeys').exclude()
        mb.mem_funs('OnKeyTyped').exclude()
        mb.mem_funs('HasHotkey').exclude()

        mb.mem_funs('GetDragData').exclude()
        if self.settings.branch == 'swarm':
            mb.mem_funs('GetDragFailCursor').exclude()
        mb.mem_funs('GetDropCursor').exclude()
        mb.mem_funs('GetDropTarget').exclude()
        mb.mem_funs('IsDroppable').exclude()
        mb.mem_funs('OnPanelDropped').exclude()
        mb.mem_funs('OnPanelEnteredDroppablePanel').exclude()
        mb.mem_funs('OnPanelExitedDroppablePanel').exclude()
        mb.mem_funs('OnDragFailed').exclude()
        mb.mem_funs('OnDropContextHoverHide').exclude()
        mb.mem_funs('OnDropContextHoverShow').exclude()
        mb.mem_funs('OnDroppablePanelPaint').exclude()
        mb.mem_funs('OnGetAdditionalDragPanels').exclude()
        mb.mem_funs('OnDragFailed').exclude()
        
        mb.vars('m_PanelMap').exclude()
        mb.vars('m_MessageMap').exclude()
        mb.mem_funs('GetPanelMap').exclude()
        if self.settings.branch == 'source2013':
            mb.mem_funs('GetChildren').exclude()
       
        # Must use return_by_value. Then the converter will be used to wrap the vgui element in a safe handle
        mb.mem_funs( 'GetChild' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetBorder' ).call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
        if self.settings.branch == 'source2007':
            mb.mem_funs('GetBorderAtIndex').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
        mb.mem_funs( 'GetParent' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindSiblingByName' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindChildByName' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'HasHotkey' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetPanelWithKeyBindings' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupBinding' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupBindingByKeyCode' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupDefaultKey' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupMapForBinding' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetTooltip' ).call_policies = call_policies.return_internal_reference()  
        mb.mem_funs( 'GetDragDropInfo' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetDragPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindPanelAnimationEntry' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindDropTargetPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
        
        if self.settings.branch == 'swarm':
            mb.mem_funs( 'GetNavDown' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavDownPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavLeft' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavLeftPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavRight' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavRightPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavUp' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavUpPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateDown' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateLeft' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateRight' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateTo' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateUp' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavDown' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavLeft' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavRight' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavUp' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 

            # Exclude
            mb.mem_funs('OnUnserialized').exclude()
            mb.mem_funs('GetSizer').exclude()
            mb.mem_funs('GetUnpackStructure').exclude()
            
        if self.settings.branch == 'swarm':
            # Tooltip class
            cls = mb.class_('Tooltip')
            cls.include()
Пример #40
0
    def ParseImageClasses(self, mb):
        # IBorder
        cls = mb.class_('IBorder')
        cls.include()
        cls.mem_funs('ApplySchemeSettings').include()    
        cls.mem_funs('Paint').virtuality = 'pure virtual'
        cls.mem_funs('ApplySchemeSettings').virtuality = 'pure virtual'

        # IImage
        cls = mb.class_('IImage')
        cls.include()  
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs('Paint').virtuality = 'pure virtual'
        
        # Image
        cls = mb.class_('Image')
        cls.include()
        #cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.no_init = True
        #cls.calldefs().virtuality = 'not virtual' 
        cls.calldefs('Image').exclude()
        cls.mem_funs( 'Paint' ).exclude()
        cls.add_wrapper_code( 'virtual void Paint() {}' )    # Stub for wrapper class. Otherwise it will complain.
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        
        # FIXME: Py++ is giving problems on some functions
        cls.mem_funs('SetPos').virtuality = 'not virtual'
        #cls.mem_funs('GetPos').virtuality = 'not virtual'
        #cls.mem_funs('GetSize').virtuality = 'not virtual'
        #cls.mem_funs('GetContentSize').virtuality = 'not virtual'
        cls.mem_funs('SetColor').virtuality = 'not virtual'
        cls.mem_funs('SetBkColor').virtuality = 'not virtual'
        cls.mem_funs('GetColor').virtuality = 'not virtual'
        
        cls.mem_funs('SetSize').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawFilledRect').virtuality = 'not virtual' 
        cls.mem_funs('DrawOutlinedRect').virtuality = 'not virtual' 
        cls.mem_funs('DrawLine').virtuality = 'not virtual' 
        cls.mem_funs('DrawPolyLine').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextFont').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextPos').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintText').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintText').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintChar').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintChar').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTexture').virtuality = 'not virtual' 
        cls.mem_funs('DrawTexturedRect').virtuality = 'not virtual' 
        
        # TextImage
        cls = mb.class_('TextImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        #cls.calldefs('SetText', calldef_withtypes([pointer_t(const_t(declarated_t(wchar_t())))])).exclude()
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetDrawWidth' ).add_transformation( FT.output('width') )
        cls.mem_funs( 'SizeText' ).exclude()     # DECLARATION ONLY
        
        cls.mem_funs('GetText').exclude()
        cls.add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    char buf[1025];\r\n' + \
            '    TextImage::GetText(buf, 1025);\r\n' + \
            '    return boost::python::object(buf);\r\n' + \
            '}'
        )
        cls.add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextImage_wrapper::* )())( &TextImage_wrapper::GetText ) )'
        )
        
        # BitmapImage
        cls = mb.class_('BitmapImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        if self.settings.branch == 'source2013':
            cls.mem_fun('SetBitmap').exclude()
        #cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        
        cls.calldefs('GetColor', calldef_withtypes([reference_t(declarated_t(int_t()))])).add_transformation(FT.output('r'), FT.output('g'), FT.output('b'), FT.output('a'))
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        
        # CAvatarImage
        cls = mb.class_('CAvatarImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.rename('AvatarImage')
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'InitFromRGBA' ).exclude()
        
        mb.enum('EAvatarSize').include()
Пример #41
0
    def ParsePanel(self, mb):
        # List of functions that should be overridable
        mb.mem_funs('SetVisible').virtuality = 'virtual'
        mb.mem_funs('SetParent').virtuality = 'virtual'
        mb.mem_funs('SetEnabled').virtuality = 'virtual'
        
        mb.mem_funs('SetBgColor').virtuality = 'virtual'
        mb.mem_funs('SetFgColor').virtuality = 'virtual'
        mb.mem_funs('SetCursor').virtuality = 'virtual'
        
        mb.mem_funs('InvalidateLayout').virtuality = 'virtual'
        
        mb.mem_funs('SetBorder').virtuality = 'virtual'
        mb.mem_funs('SetPaintBorderEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintBackgroundEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintBackgroundType').virtuality = 'virtual'
        mb.mem_funs('SetScheme').virtuality = 'virtual'
        
        mb.mem_funs('ApplySchemeSettings').virtuality = 'virtual'
        mb.mem_funs('OnCommand').virtuality = 'virtual'
        mb.mem_funs('OnMouseCaptureLost').virtuality = 'virtual'
        mb.mem_funs('OnSetFocus').virtuality = 'virtual'
        mb.mem_funs('OnKillFocus').virtuality = 'virtual'
        mb.mem_funs('OnDelete').virtuality = 'virtual'
        mb.mem_funs('OnThink').virtuality = 'virtual'
        mb.mem_funs('OnChildAdded').virtuality = 'virtual'
        mb.mem_funs('OnSizeChanged').virtuality = 'virtual'
        mb.mem_funs('OnTick').virtuality = 'virtual'
        
        mb.mem_funs('OnCursorMoved').virtuality = 'virtual'
        mb.mem_funs('OnCursorEntered').virtuality = 'virtual'
        mb.mem_funs('OnCursorExited').virtuality = 'virtual'
        mb.mem_funs('OnMousePressed').virtuality = 'virtual'
        mb.mem_funs('OnMouseDoublePressed').virtuality = 'virtual'
        mb.mem_funs('OnMouseReleased').virtuality = 'virtual'
        mb.mem_funs('OnMouseWheeled').virtuality = 'virtual'
        mb.mem_funs('OnMouseTriplePressed').virtuality = 'virtual'
        
        mb.mem_funs('OnKeyCodePressed').virtuality = 'virtual'
        mb.mem_funs('OnKeyCodeTyped').virtuality = 'virtual'
        mb.mem_funs('OnKeyCodeReleased').virtuality = 'virtual'
        mb.mem_funs('OnKeyFocusTicked').virtuality = 'virtual'
        mb.mem_funs('OnMouseFocusTicked').virtuality = 'virtual'
        
        mb.mem_funs('PaintBackground').virtuality = 'virtual'
        mb.mem_funs('Paint').virtuality = 'virtual'
        #mb.mem_funs('PaintBorder').virtuality = 'virtual' # TODO: Don't believe we are ever interested in painting borders in python
        mb.mem_funs('PaintBuildOverlay').virtuality = 'virtual'
        mb.mem_funs('PostChildPaint').virtuality = 'virtual'
        mb.mem_funs('PerformLayout').virtuality = 'virtual'
        
        mb.mem_funs('SetMouseInputEnabled').virtuality = 'virtual'
        mb.mem_funs('SetKeyBoardInputEnabled').virtuality = 'virtual'
        
        mb.mem_funs('SetDragEnabled').virtuality = 'virtual'
        
        mb.mem_funs('OnRequestFocus').virtuality = 'virtual'
        mb.mem_funs('OnScreenSizeChanged').virtuality = 'virtual'

        # Transformations
        mb.mem_funs( 'GetPos' ).add_transformation( FT.output('x'), FT.output('y') )
        mb.class_('Panel').mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.class_('Panel').mem_funs( 'GetBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'GetMinimumSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'LocalToScreen' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'ScreenToLocal' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'ParentLocalToScreen' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'GetInset' ).add_transformation( FT.output('left'), FT.output('top'), FT.output('right'), FT.output('bottom') )
        mb.mem_funs( 'GetPaintSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'GetClipRect' ).add_transformation( FT.output('x0'), FT.output('y0'), FT.output('x1'), FT.output('y1') )
        mb.mem_funs( 'GetPinOffset' ).add_transformation( FT.output('dx'), FT.output('dy') )
        mb.mem_funs( 'GetResizeOffset' ).add_transformation( FT.output('dx'), FT.output('dy') )
        mb.mem_funs( 'GetCornerTextureSize' ).add_transformation( FT.output('w'), FT.output('h') )    
        
        # Exclude list
        mb.mem_funs('QueryInterface').exclude()
        
        # Custom implemented
        mb.mem_funs('PaintBackground').exclude()
        mb.mem_funs('Paint').exclude()
        mb.mem_funs('InvalidateLayout').exclude()
        
        # We don't care about build mode, since we can easily reload modules in python
        # We also don't want the user to be able to call methods like Delete.
        mb.mem_funs('IsBuildModeEditable').exclude()
        mb.mem_funs('SetBuildModeEditable').exclude()
        mb.mem_funs('IsBuildModeDeletable').exclude()
        mb.mem_funs('SetBuildModeDeletable').exclude()
        mb.mem_funs('IsBuildModeActive').exclude()
        #mb.mem_funs('SetAutoDelete').exclude()
        #mb.mem_funs('IsAutoDeleteSet').exclude()
        mb.mem_funs('OnDelete').exclude()
        mb.mem_funs('MarkForDeletion').exclude()
        mb.mem_funs('SetBuildGroup').exclude()
        mb.mem_funs('IsBuildGroupEnabled').exclude()
        mb.mem_funs('CreateControlByName').exclude()
        
        mb.mem_funs('LoadKeyBindings').exclude()
        mb.mem_funs('SaveKeyBindingsToBuffer').exclude()
        mb.mem_funs('LookupBoundKeys').exclude()
        mb.mem_funs('OnKeyTyped').exclude()
        mb.mem_funs('HasHotkey').exclude()

        mb.mem_funs('GetDragData').exclude()
        if self.settings.branch == 'swarm':
            mb.mem_funs('GetDragFailCursor').exclude()
        mb.mem_funs('GetDropCursor').exclude()
        mb.mem_funs('GetDropTarget').exclude()
        mb.mem_funs('IsDroppable').exclude()
        mb.mem_funs('OnPanelDropped').exclude()
        mb.mem_funs('OnPanelEnteredDroppablePanel').exclude()
        mb.mem_funs('OnPanelExitedDroppablePanel').exclude()
        mb.mem_funs('OnDragFailed').exclude()
        mb.mem_funs('OnDropContextHoverHide').exclude()
        mb.mem_funs('OnDropContextHoverShow').exclude()
        mb.mem_funs('OnDroppablePanelPaint').exclude()
        mb.mem_funs('OnGetAdditionalDragPanels').exclude()
        mb.mem_funs('OnDragFailed').exclude()
        
        mb.vars('m_PanelMap').exclude()
        mb.vars('m_MessageMap').exclude()
        mb.mem_funs('GetPanelMap').exclude()
        if self.settings.branch == 'source2013':
            mb.mem_funs('GetChildren').exclude()
       
        # Must use return_by_value. Then the converter will be used to wrap the vgui element in a safe handle
        mb.mem_funs( 'GetChild' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetBorder' ).call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
        if self.settings.branch == 'source2007':
            mb.mem_funs('GetBorderAtIndex').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
        mb.mem_funs( 'GetParent' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindSiblingByName' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindChildByName' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'HasHotkey' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetPanelWithKeyBindings' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupBinding' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupBindingByKeyCode' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupDefaultKey' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'LookupMapForBinding' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetTooltip' ).call_policies = call_policies.return_internal_reference()  
        mb.mem_funs( 'GetDragDropInfo' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetDragPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindPanelAnimationEntry' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'FindDropTargetPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
        
        if self.settings.branch == 'swarm':
            mb.mem_funs( 'GetNavDown' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavDownPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavLeft' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavLeftPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavRight' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavRightPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavUp' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'GetNavUpPanel' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateDown' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateLeft' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateRight' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateTo' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'NavigateUp' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavDown' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavLeft' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavRight' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
            mb.mem_funs( 'SetNavUp' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 

            # Exclude
            mb.mem_funs('OnUnserialized').exclude()
            mb.mem_funs('GetSizer').exclude()
            mb.mem_funs('GetUnpackStructure').exclude()
            
        if self.settings.branch == 'swarm':
            # Tooltip class
            cls = mb.class_('Tooltip')
            cls.include()
Пример #42
0
    #mb.namespace("core_mathlib").exclude()
    mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude()
    mb.calldefs( access_type_matcher_t( 'private' ) ).exclude()
    # ####################################################
    # SCRIPT POUR ../input_output/bin.h
    mb.class_("t_pos").decl("operator float *").exclude()
    # ####################################################
    # SCRIPT POUR ../input_output/gabe/stdgabe.h
    mb.namespace("formatGABE").exclude()
    mb.namespace("formatGABE").decls("GABE_OBJECTTYPE").include()
    mb.decls( lambda decl: 'impl_' in decl.name ).exclude()
    io_gabe=mb.class_("Gabe_rw")
    io_gabe.mem_fun("size").alias="__len__"
    #transforme le parametre en valeur de retour des fonctions commencant par ReadCol
    io_gabe.decls(lambda decl: decl.name.startswith( 'ReadCol' )).add_transformation( FT.output(1) )

    # ####################################################
    # SCRIPT POUR ../input_output/mbin.h
    cmbin=mb.namespace("formatMBIN").class_("CMBIN")
    cmbin.mem_fun("ImportBIN").exclude()
    cmbin.mem_fun("ExportBIN").exclude()
    
    # ####################################################
    # SCRIPT POUR     ../input_output/cxml.h
    # mb.namespace("BasicXmlProcess").exclude()
    # cxmlnode=mb.class_("CXmlNode")
    # cxmlnode.mem_fun("GetChild").call_policies =  call_policies.return_value_policy( call_policies.return_opaque_pointer )
    # cxmlnode.decls("t_nodeData").exclude()
    # cxml=mb.class_("CXml")
    # cxml.mem_fun("GetRoot").call_policies =  call_policies.return_value_policy( call_policies.return_opaque_pointer )
Пример #43
0
    def ParsePanel(self, mb):
        #all_classes = mb.classes(self.panel_cls_list)
    
        if not novguilib: # FIXME/TODO
            mb.mem_funs('PyDeletePanel').rename('DeletePanel')
            mb.mem_fun('PyOnMessage').rename( 'OnMessage' )

        # List of functions that should be overridable
        mb.mem_funs('SetVisible').virtuality = 'virtual'
        mb.mem_funs('SetParent').virtuality = 'virtual'
        mb.mem_funs('SetEnabled').virtuality = 'virtual'
        
        mb.mem_funs('SetBgColor').virtuality = 'virtual'
        mb.mem_funs('SetFgColor').virtuality = 'virtual'
        mb.mem_funs('SetCursor').virtuality = 'virtual'
        
        mb.mem_funs('InvalidateLayout').virtuality = 'virtual'
        
        mb.mem_funs('SetBorder').virtuality = 'virtual'
        mb.mem_funs('SetPaintBorderEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintBackgroundEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintEnabled').virtuality = 'virtual'
        mb.mem_funs('SetPaintBackgroundType').virtuality = 'virtual'
        mb.mem_funs('SetScheme').virtuality = 'virtual'
        
        mb.mem_funs('ApplySchemeSettings').virtuality = 'virtual'
        mb.mem_funs('OnCommand').virtuality = 'virtual'
        mb.mem_funs('OnMouseCaptureLost').virtuality = 'virtual'
        mb.mem_funs('OnSetFocus').virtuality = 'virtual'
        mb.mem_funs('OnKillFocus').virtuality = 'virtual'
        mb.mem_funs('OnDelete').virtuality = 'virtual'
        mb.mem_funs('OnThink').virtuality = 'virtual'
        mb.mem_funs('OnChildAdded').virtuality = 'virtual'
        mb.mem_funs('OnSizeChanged').virtuality = 'virtual'
        mb.mem_funs('OnTick').virtuality = 'virtual'
        
        mb.mem_funs('OnCursorMoved').virtuality = 'virtual'
        mb.mem_funs('OnCursorEntered').virtuality = 'virtual'
        mb.mem_funs('OnCursorExited').virtuality = 'virtual'
        mb.mem_funs('OnMousePressed').virtuality = 'virtual'
        mb.mem_funs('OnMouseDoublePressed').virtuality = 'virtual'
        mb.mem_funs('OnMouseReleased').virtuality = 'virtual'
        mb.mem_funs('OnMouseWheeled').virtuality = 'virtual'
        mb.mem_funs('OnMouseTriplePressed').virtuality = 'virtual'
        
        mb.mem_funs('OnKeyCodePressed').virtuality = 'virtual'
        mb.mem_funs('OnKeyCodeTyped').virtuality = 'virtual'
        mb.mem_funs('OnKeyCodeReleased').virtuality = 'virtual'
        mb.mem_funs('OnKeyFocusTicked').virtuality = 'virtual'
        mb.mem_funs('OnMouseFocusTicked').virtuality = 'virtual'
        
        mb.mem_funs('PaintBackground').virtuality = 'virtual'
        mb.mem_funs('Paint').virtuality = 'virtual'
        #mb.mem_funs('PaintBorder').virtuality = 'virtual' # TODO: Don't believe we are ever interested in painting borders in python
        mb.mem_funs('PaintBuildOverlay').virtuality = 'virtual'
        mb.mem_funs('PostChildPaint').virtuality = 'virtual'
        mb.mem_funs('PerformLayout').virtuality = 'virtual'
        
        mb.mem_funs('SetMouseInputEnabled').virtuality = 'virtual'
        mb.mem_funs('SetKeyBoardInputEnabled').virtuality = 'virtual'
        
        mb.mem_funs('SetDragEnabled').virtuality = 'virtual'
        
        mb.mem_funs('OnRequestFocus').virtuality = 'virtual'
        mb.mem_funs('OnScreenSizeChanged').virtuality = 'virtual'

        # Transformations
        mb.mem_funs( 'GetPos' ).add_transformation( FT.output('x'), FT.output('y') )
        mb.class_('Panel').mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.class_('Panel').mem_funs( 'GetBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'GetMinimumSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'LocalToScreen' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'ScreenToLocal' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'ParentLocalToScreen' ).add_transformation( FT.inout('x'), FT.inout('y') )
        mb.mem_funs( 'GetInset' ).add_transformation( FT.output('left'), FT.output('top'), FT.output('right'), FT.output('bottom') )
        mb.mem_funs( 'GetPaintSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        mb.mem_funs( 'GetClipRect' ).add_transformation( FT.output('x0'), FT.output('y0'), FT.output('x1'), FT.output('y1') )
        mb.mem_funs( 'GetPinOffset' ).add_transformation( FT.output('dx'), FT.output('dy') )
        mb.mem_funs( 'GetResizeOffset' ).add_transformation( FT.output('dx'), FT.output('dy') )
        mb.mem_funs( 'GetCornerTextureSize' ).add_transformation( FT.output('w'), FT.output('h') )    
        
        # Exclude list
        mb.mem_funs('SetParent', lambda decl: HasArgType(decl, 'Panel')).exclude() # Custom wrapper
        if not novguilib: # FIXME/TODO
            mb.mem_funs('PyOnMessage').exclude() # Custom wrapper
            
        mb.mem_funs('QueryInterface').exclude()
        
        # Custom implemented
        mb.mem_funs('PaintBackground').exclude()
        mb.mem_funs('Paint').exclude()
        mb.mem_funs('InvalidateLayout').exclude()
        
        # We don't care about build mode, since we can easily reload modules in python
        # We also don't want the user to be able to call methods like Delete.
        mb.mem_funs('IsBuildModeEditable').exclude()
        mb.mem_funs('SetBuildModeEditable').exclude()
        mb.mem_funs('IsBuildModeDeletable').exclude()
        mb.mem_funs('SetBuildModeDeletable').exclude()
        mb.mem_funs('IsBuildModeActive').exclude()
        #mb.mem_funs('SetAutoDelete').exclude()
        #mb.mem_funs('IsAutoDeleteSet').exclude()
        if not novguilib: # Overriden in ASW_CODE_BASE to prevent delete. Instead a friendly Python cleanup is done.
            mb.mem_funs('DeletePanel').exclude()
        mb.mem_funs('OnDelete').exclude()
        mb.mem_funs('MarkForDeletion').exclude()
        mb.mem_funs('SetBuildGroup').exclude()
        mb.mem_funs('IsBuildGroupEnabled').exclude()
        mb.mem_funs('CreateControlByName').exclude()
        
        mb.mem_funs('LoadKeyBindings').exclude() # Not sure why this one is giving problems. Not that it is important.
        
        mb.mem_funs('OnKeyTyped').exclude()
        mb.mem_funs('HasHotkey').exclude()
        
        mb.vars('m_PanelMap').exclude()
        mb.vars('m_MessageMap').exclude()
        mb.mem_funs('GetPanelMap').exclude()
       
        # Must use return_by_value. Then the converter will be used to wrap the vgui element in a safe handle
        mb.mem_funs( 'GetChild' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'GetBorder' ).call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )  
        mb.mem_funs( 'GetParent' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'FindSiblingByName' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'FindChildByName' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'HasHotkey' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'GetPanelWithKeyBindings' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'LookupBinding' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'LookupBindingByKeyCode' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'LookupDefaultKey' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'LookupMapForBinding' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'GetTooltip' ).call_policies = call_policies.return_internal_reference()  
        mb.mem_funs( 'GetDragDropInfo' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'GetDragPanel' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'GetPanel' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'FindPanelAnimationEntry' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        mb.mem_funs( 'FindDropTargetPanel' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
        
        if settings.ASW_CODE_BASE:
            mb.mem_funs( 'GetNavDown' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'GetNavDownPanel' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'GetNavLeft' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'GetNavLeftPanel' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'GetNavRight' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'GetNavRightPanel' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'GetNavUp' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'GetNavUpPanel' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'NavigateDown' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'NavigateLeft' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'NavigateRight' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'NavigateTo' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'NavigateUp' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'SetNavDown' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'SetNavLeft' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'SetNavRight' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
            mb.mem_funs( 'SetNavUp' ).call_policies = call_policies.return_value_policy( call_policies.return_by_value )  

            # Exclude
            mb.mem_funs('OnUnserialized').exclude()
            mb.mem_funs('GetSizer').exclude()
            mb.mem_funs('GetUnpackStructure').exclude()
            
        # Tooltip class
        cls = mb.class_('Tooltip')
        cls.include()
Пример #44
0
    def customize( self, mb ):
        
        mb.global_ns.calldefs().create_with_signature = True
        
        hello_world = mb.free_fun( 'hello_world' )
        hello_world.add_transformation( ft.output(0) )
        
        calc = mb.class_('calculator_t' )
        assign_funs = calc.mem_funs( lambda decl: decl.name.startswith( 'assign' ) )
        assign_funs.add_transformation( ft.output(0), ft.output(1) )
        
        clone_and_assign_5 = calc.mem_fun( 'clone_and_assign_5' )
        clone_and_assign_5.add_transformation( ft.output(0) )
        clone_and_assign_5.call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
            
        window = mb.class_( 'window_t' )
        window.mem_fun( 'resize' ).add_transformation( ft.input(0), ft.input(1) )
        window.mem_fun( 'resize_in_out' ).add_transformation( ft.inout(0), ft.inout(1) )
        
        point3d = mb.class_( 'point3d_t' )
        point3d.add_wrapper_code( '' )
        point3d.mem_fun( 'initialize' ).add_transformation( ft.input_static_array(0, size=3) )
        point3d.mem_fun( 'position' ).add_transformation( ft.output_static_array(0, size=3) )
        point3d.mem_fun( 'distance' ).add_transformation( ft.output(1) )
        
        image = mb.class_( "image_t" )
        image.always_expose_using_scope = True
        image.member_function( "get_size" )
        image.member_function( "get_size" ).add_transformation( ft.output(0), ft.output(1) )
        image.member_function( "get_one_value" ).add_transformation( ft.output(0) )
        image.member_function( "get_size2" ).add_transformation( ft.output(0), ft.output(1) )
        image.member_function( "input_arg" ).add_transformation( ft.input(0) )
        image.member_function( "fixed_input_array" ).add_transformation( ft.input_static_array(0,3) )
        image.member_function( "fixed_output_array" ).add_transformation( ft.output_static_array(0,3) )
        mb.free_function("get_cpp_instance").call_policies \
            = call_policies.return_value_policy(call_policies.reference_existing_object)
        mb.variable( "cpp_instance" ).exclude()

        cls = mb.class_("no_virtual_members_t")
        cls.member_function("member").add_transformation( ft.output(0) )

        cls = mb.class_("ft_private_destructor_t")
        cls.member_function("get_value").add_transformation( ft.output(0) )

        mb.decls(lambda decl: decl.name.startswith("_")).exclude()

        cls = mb.class_("bug_render_target_t")
        cls.mem_fun("get_statistics", arg_types=['float &']*2).add_transformation( ft.output(0), ft.output(1) )
        
        cls = mb.class_( 'modify_type_tester_t' )
        do_nothing = cls.mem_fun( 'do_nothing' )
        do_nothing.add_transformation( ft.modify_type(0, declarations.remove_reference ) )

        clone = cls.mem_fun( 'clone' )
        clone.call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
        clone.add_transformation( ft.modify_type(0, declarations.remove_reference ) )
        
        cls = mb.class_( 'input_c_buffer_tester_t')
        write_mf = cls.mem_fun( 'write' )
        write_mf.add_transformation( ft.input_c_buffer( 'buffer', 'size' ) )
        write_s = cls.mem_fun( 'write_s' )
        write_s.add_transformation( ft.input_c_buffer( 'buffer', 'size' ) )
        
        resource = mb.class_( 'resources_t' )
        resource.held_type = 'std::auto_ptr< %s >' % resource.decl_string
        transfer_ownership_tester = mb.class_( 'transfer_ownership_tester_t' )
        tester = transfer_ownership_tester.mem_fun( 'tester' )
        tester.add_transformation( ft.transfer_ownership( 0 ) )
        
        render_queue_listener_t = mb.class_( 'render_queue_listener_t' )
        render_queue_ended = render_queue_listener_t.mem_fun( 'render_queue_ended' )
        render_queue_ended.add_transformation( ft.inout(2) )
Пример #45
0
    def ParseInterfaces(self, mb):
        # ISchemeManager
        mb.free_function('scheme').include()
        mb.free_function(
            'scheme').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)

        cls = mb.class_('ISchemeManager')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs(
            'GetImage').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        cls.mem_funs(
            'GetIScheme').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        #cls.mem_funs( 'GetBorder' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)

        if self.settings.branch == 'swarm':
            cls.mem_funs('GetSurface').exclude()

        # IScheme
        cls = mb.class_('IScheme')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs(
            'GetBorder').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        if self.settings.branch == 'source2013':
            cls.mem_funs('GetBorderAtIndex'
                         ).call_policies = call_policies.return_value_policy(
                             call_policies.reference_existing_object)

        if self.settings.branch == 'swarm':
            cls.class_('fontalias_t').exclude()

        # ILocalize
        cls = mb.class_('PyLocalize')
        cls.rename('Localize')
        cls.include()
        cls.mem_fun('Find').call_policies = call_policies.return_value_policy(
            call_policies.return_by_value)
        cls.mem_fun('GetValueByIndex'
                    ).call_policies = call_policies.return_value_policy(
                        call_policies.return_by_value)
        if self.settings.branch == 'swarm':
            mb.var('INVALID_STRING_INDEX').include()

        #mb.var('g_pylocalize').include()
        #mb.var('g_pylocalize').rename('localize')
        mb.add_registration_code(
            "bp::scope().attr( \"localize\" ) = boost::ref(g_pylocalize);")

        # IPanel
        cls = mb.class_('CWrapIPanel')
        cls.include()
        cls.rename('IPanel')
        cls.mem_funs('GetPos').add_transformation(FT.output('x'),
                                                  FT.output('y'))
        cls.mem_funs('GetSize').add_transformation(FT.output('wide'),
                                                   FT.output('tall'))
        cls.mem_funs('GetAbsPos').add_transformation(FT.output('x'),
                                                     FT.output('y'))
        if self.settings.branch == 'swarm':
            cls.mem_funs(
                'Plat').call_policies = call_policies.return_value_policy(
                    call_policies.return_by_value)
        cls.mem_funs(
            'GetPanel').call_policies = call_policies.return_value_policy(
                call_policies.return_by_value)

        mb.free_function('wrapipanel').include()
        mb.free_function(
            'wrapipanel').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        mb.free_function('wrapipanel').rename('ipanel')

        # VGUI Input
        cls = mb.class_('IInput')
        cls.include()
        #cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs('GetCursorPos').add_transformation(
            FT.output('x'), FT.output('y'))
        cls.mem_funs('GetCursorPosition').add_transformation(
            FT.output('x'), FT.output('y'))
        cls.mem_funs(
            'GetIMEWindow').call_policies = call_policies.return_value_policy(
                call_policies.return_by_value)

        mb.free_function('input').include()
        mb.free_function(
            'input').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        mb.free_function('input').rename('vgui_input')

        # ISystem
        cls = mb.class_('ISystem')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs('GetUserConfigFileData'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.return_by_value)
        cls.mem_funs('GetRegistryInteger').add_transformation(
            FT.output('value'))

        vgui = mb.namespace('vgui')
        vgui.free_function('system').include()
        vgui.free_function(
            'system').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        vgui.free_function('system').rename('vgui_system')

        # IClientMode
        cls = mb.class_('IClientMode')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'

        if self.settings.branch == 'swarm':
            mb.add_declaration_code(
                "IClientMode *wrap_GetClientMode( void )\r\n{\r\n\treturn GetClientMode();\r\n}\r\n"
            )
            mb.add_registration_code(
                'bp::def( "GetClientMode", wrap_GetClientMode, bp::return_value_policy<bp::reference_existing_object>() );'
            )

        if self.settings.branch == 'source2013':
            # TODO: Returns wchar_t *. Get a converter.
            cls.mem_fun('GetMapName').exclude()
            cls.mem_fun('GetServerName').exclude()

        cls.mem_funs(
            'GetViewport').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        cls.mem_funs('GetViewportAnimationController'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.reference_existing_object)
        cls.mem_funs('GetMessagePanel'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.reference_existing_object)
        cls.mem_funs('AdjustEngineViewport').add_transformation(
            FT.output('x'), FT.output('y'), FT.output('width'),
            FT.output('height'))
        cls.mem_funs('ActivateInGameVGuiContext').include(
        )  # Not safe, but IClientMode should not be overridden.

        if self.settings.branch == 'swarm':
            cls.mem_funs('GetPanelFromViewport'
                         ).call_policies = call_policies.return_value_policy(
                             call_policies.reference_existing_object)
Пример #46
0
    def ParseImageClasses(self, mb):
        # IBorder
        cls = mb.class_('IBorder')
        cls.include()
        cls.mem_funs('ApplySchemeSettings').include()    
        cls.mem_funs('Paint').virtuality = 'pure virtual'
        cls.mem_funs('ApplySchemeSettings').virtuality = 'pure virtual'

        # IImage
        cls = mb.class_('IImage')
        cls.include()  
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs('Paint').virtuality = 'pure virtual'
        
        # Image
        cls = mb.class_('Image')
        cls.include()
        #cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.no_init = True
        #cls.calldefs().virtuality = 'not virtual' 
        cls.calldefs('Image').exclude()
        cls.mem_funs( 'Paint' ).exclude()
        cls.add_wrapper_code( 'virtual void Paint() {}' )    # Stub for wrapper class. Otherwise it will complain.
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        
        # FIXME: Py++ is giving problems on some functions
        cls.mem_funs('SetPos').virtuality = 'not virtual'
        #cls.mem_funs('GetPos').virtuality = 'not virtual'
        #cls.mem_funs('GetSize').virtuality = 'not virtual'
        #cls.mem_funs('GetContentSize').virtuality = 'not virtual'
        cls.mem_funs('SetColor').virtuality = 'not virtual'
        cls.mem_funs('SetBkColor').virtuality = 'not virtual'
        cls.mem_funs('GetColor').virtuality = 'not virtual'
        
        cls.mem_funs('SetSize').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawFilledRect').virtuality = 'not virtual' 
        cls.mem_funs('DrawOutlinedRect').virtuality = 'not virtual' 
        cls.mem_funs('DrawLine').virtuality = 'not virtual' 
        cls.mem_funs('DrawPolyLine').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextFont').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextPos').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintText').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintText').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintChar').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintChar').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTexture').virtuality = 'not virtual' 
        cls.mem_funs('DrawTexturedRect').virtuality = 'not virtual' 
        
        # TextImage
        cls = mb.class_('TextImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.mem_funs( 'SetText', lambda decl: HasArgType(decl, 'wchar_t') ).exclude()
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetDrawWidth' ).add_transformation( FT.output('width') )
        cls.mem_funs( 'SizeText' ).exclude()     # DECLARATION ONLY
        
        cls.mem_funs('GetText').exclude()
        cls.add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    char buf[1025];\r\n' + \
            '    TextImage::GetText(buf, 1025);\r\n' + \
            '    return boost::python::object(buf);\r\n' + \
            '}'
        )
        cls.add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextImage_wrapper::* )())( &TextImage_wrapper::GetText ) )'
        )
        
        """
        cls.add_wrapper_code( 
            '''virtual void GetTextSize( int & wide, int & tall ){
                bp::override func_GetTextSize = this->get_override( "GetTextSize" );
                if( func_GetTextSize.ptr() != Py_None )
                    try {
                        func_GetTextSize( wide, tall );
                    } catch(bp::error_already_set &) {
                        PyErr_Print();
                        this->vgui::TextImage::GetTextSize( wide, tall );
                    }
                else
                    this->vgui::TextImage::GetTextSize( wide, tall );
            }
            
            virtual boost::python::tuple default_GetTextSize() {
                int wide2;
                int tall2;
                vgui::TextImage::GetTextSize( wide2, tall2 );
                return bp::make_tuple( wide2, tall2 );
            }'''
        )
        cls.add_registration_code(
            '''{ //::vgui::TextImage::GetTextSize
        
            typedef void ( TextImage_wrapper::*GetTextSize_function_type )() ;
            
            TextImage_exposer.def( 
                "GetTextSize"
                , GetTextSize_function_type( &TextImage_wrapper::default_GetTextSize ) );
        
            }'''
            , works_on_instance=False
        )
        """
        
        # BitmapImage
        cls = mb.class_('BitmapImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        #cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.mem_funs( 'GetColor', lambda decl: HasArgType(decl, 'int') ).add_transformation( FT.output('r'), FT.output('g'), FT.output('b'), FT.output('a') )
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )

        
        # CAvatarImage
        cls = mb.class_('CAvatarImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.rename('AvatarImage')
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'InitFromRGBA' ).exclude()
Пример #47
0
        call_policies.reference_existing_object)

for c in mb.classes(lambda x: x.name.startswith("Singleton")):
    c.add_static_property('instance', fget=c.member_function("Instance"))

for c in mb.classes():
    for f in c.member_functions("Cache", arg_types=[], allow_empty=True):
        f.exclude()
        c.add_static_property('cache', fget=f)

#mb.class_( "FileIterator_t" ).opaque = True
#mb.class_( "TextureInfo" ).opaque = True
mb.class_(lambda x: x.name.startswith('HWND')).opaque = True

mb.class_("FileSystem").member_function("GetFileSize").add_transformation(
    ft.output("len"))
mb.class_("Pack").member_function("GetFileSize").add_transformation(
    ft.output("len"))
mb.class_("Pack").member_function("GetFileOffset").add_transformation(
    ft.output("ofs"))
mb.class_("Viewport").member_functions("Project").add_transformation(
    ft.output("x"), ft.output("y"))
mb.class_("AABBTree").member_functions(
    "TestIntersection",
    arg_types=['float &', None, None,
               None]).add_transformation(ft.output("t"),
                                         ft.output("normal"),
                                         alias='test_intersection_ray')
mb.class_("Texture").member_functions("GetFrameTexCoords").add_transformation(
    ft.output("u0"), ft.output("v0"), ft.output("u1"), ft.output("v1"))
mb.member_functions("Projection").add_transformation(ft.output("a"),
Пример #48
0
    def ParseInterfaces(self, mb):
        # ISchemeManager
        mb.free_function('scheme').include()
        mb.free_function(
            'scheme').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)

        cls = mb.class_('ISchemeManager')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs(
            'GetImage').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        cls.mem_funs(
            'GetIScheme').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        #cls.mem_funs( 'GetBorder' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)

        if self.settings.branch == 'swarm':
            cls.mem_funs('GetSurface').exclude()

        # IScheme
        cls = mb.class_('IScheme')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs(
            'GetBorder').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        if self.settings.branch == 'source2013':
            cls.mem_funs('GetBorderAtIndex'
                         ).call_policies = call_policies.return_value_policy(
                             call_policies.reference_existing_object)

        if self.settings.branch == 'swarm':
            cls.class_('fontalias_t').exclude()

        # ILocalize
        cls = mb.class_('PyLocalize')
        cls.rename('Localize')
        cls.include()
        cls.mem_fun('Find').call_policies = call_policies.return_value_policy(
            call_policies.return_by_value)
        cls.mem_fun('GetValueByIndex'
                    ).call_policies = call_policies.return_value_policy(
                        call_policies.return_by_value)
        if self.settings.branch == 'swarm':
            mb.var('INVALID_STRING_INDEX').include()

        #mb.var('g_pylocalize').include()
        #mb.var('g_pylocalize').rename('localize')
        mb.add_registration_code(
            "bp::scope().attr( \"localize\" ) = boost::ref(g_pylocalize);")

        # IPanel
        cls = mb.class_('CWrapIPanel')
        cls.include()
        cls.rename('IPanel')
        cls.mem_funs('GetPos').add_transformation(FT.output('x'),
                                                  FT.output('y'))
        cls.mem_funs('GetSize').add_transformation(FT.output('wide'),
                                                   FT.output('tall'))
        cls.mem_funs('GetAbsPos').add_transformation(FT.output('x'),
                                                     FT.output('y'))
        if self.settings.branch == 'swarm':
            cls.mem_funs(
                'Plat').call_policies = call_policies.return_value_policy(
                    call_policies.return_by_value)
        cls.mem_funs(
            'GetPanel').call_policies = call_policies.return_value_policy(
                call_policies.return_by_value)

        mb.free_function('wrapipanel').include()
        mb.free_function(
            'wrapipanel').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        mb.free_function('wrapipanel').rename('ipanel')

        # VGUI Input
        cls = mb.class_('IInput')
        cls.include()
        #cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs('GetCursorPos').add_transformation(
            FT.output('x'), FT.output('y'))
        cls.mem_funs('GetCursorPosition').add_transformation(
            FT.output('x'), FT.output('y'))
        cls.mem_funs(
            'GetIMEWindow').call_policies = call_policies.return_value_policy(
                call_policies.return_by_value)

        mb.free_function('input').include()
        mb.free_function(
            'input').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        mb.free_function('input').rename('vgui_input')

        # ISystem
        cls = mb.class_('ISystem')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs('GetUserConfigFileData'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.return_by_value)
        cls.mem_funs('GetRegistryInteger').add_transformation(
            FT.output('value'))

        # Exclude registry modification functions, likely not needed from Python
        cls.mem_funs('SetRegistryInteger').exclude()
        cls.mem_funs('SetRegistryString').exclude()
        cls.mem_funs('DeleteRegistryKey').exclude()

        # Properly wrap getting a registery string
        mb.add_declaration_code(
            '''static boost::python::tuple GetRegistryString_cc10e70c5f6b49d5963b27442c970b19( ::vgui::ISystem & inst, char const * key ){
    char value2[512];
    bool result = inst.GetRegistryString(key, value2, sizeof(value2));
    return bp::make_tuple( result, value2 );
}
        ''')
        cls.mem_funs('GetRegistryString').exclude()
        cls.add_registration_code('''def( 
            "GetRegistryString"
            , (boost::python::tuple (*)( ::vgui::ISystem &,char const * ))( &GetRegistryString_cc10e70c5f6b49d5963b27442c970b19 )
            , ( bp::arg("inst"), bp::arg("key") ) )
        ''')

        vgui = mb.namespace('vgui')
        vgui.free_function('system').include()
        vgui.free_function(
            'system').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        vgui.free_function('system').rename('vgui_system')

        # IClientMode
        cls = mb.class_('IClientMode')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'

        if self.settings.branch == 'swarm':
            mb.add_declaration_code(
                "IClientMode *wrap_GetClientMode( void )\r\n{\r\n\treturn GetClientMode();\r\n}\r\n"
            )
            mb.add_registration_code(
                'bp::def( "GetClientMode", wrap_GetClientMode, bp::return_value_policy<bp::reference_existing_object>() );'
            )

        if self.settings.branch == 'source2013':
            # TODO: Returns wchar_t *. Get a converter.
            cls.mem_fun('GetMapName').exclude()
            cls.mem_fun('GetServerName').exclude()

        cls.mem_funs(
            'GetViewport').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        cls.mem_funs('GetViewportAnimationController'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.reference_existing_object)
        cls.mem_funs('GetMessagePanel'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.reference_existing_object)
        cls.mem_funs('AdjustEngineViewport').add_transformation(
            FT.output('x'), FT.output('y'), FT.output('width'),
            FT.output('height'))
        cls.mem_funs('ActivateInGameVGuiContext').include(
        )  # Not safe, but IClientMode should not be overridden.

        if self.settings.branch == 'swarm':
            cls.mem_funs('GetPanelFromViewport'
                         ).call_policies = call_policies.return_value_policy(
                             call_policies.reference_existing_object)
Пример #49
0
    def ParseISurface(self, mb):
        cls = mb.class_('CWrapSurface')
        cls.include()
        cls.rename('ISurface')
        mb.free_function('wrapsurface').include()
        mb.free_function(
            'wrapsurface').call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object)
        mb.free_function('wrapsurface').rename('surface')

        mb.enum('CursorCode').include()
        mb.enum('FontDrawType_t').include()
        if self.settings.branch == 'swarm':
            mb.class_('FontVertex_t').include()
        else:
            mb.class_('Vertex_t').include()
        mb.class_('IntRect').include()

        cls.mem_funs('DrawGetTextPos').add_transformation(
            FT.output('x'), FT.output('y'))
        cls.mem_funs('DrawGetTextureSize').add_transformation(
            FT.output('wide'), FT.output('tall'))
        cls.mem_funs('GetScreenSize').add_transformation(
            FT.output('wide'), FT.output('tall'))
        cls.mem_funs('GetCharABCwide').add_transformation(
            FT.output('a'), FT.output('b'), FT.output('c'))
        cls.mem_funs('GetWorkspaceBounds').add_transformation(
            FT.output('x'), FT.output('y'), FT.output('wide'),
            FT.output('tall'))
        cls.mem_funs('GetAbsoluteWindowBounds').add_transformation(
            FT.output('x'), FT.output('y'), FT.output('wide'),
            FT.output('tall'))
        cls.mem_funs('GetProportionalBase').add_transformation(
            FT.output('width'), FT.output('height'))
        cls.mem_funs('SurfaceGetCursorPos').add_transformation(
            FT.output('x'), FT.output('y'))

        cls.mem_funs('CreateHTMLWindow'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.reference_existing_object)
        cls.mem_funs('DrawGetTextureMatInfoFactory'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.reference_existing_object)
        cls.mem_funs('GetIconImageForFullPath'
                     ).call_policies = call_policies.return_value_policy(
                         call_policies.reference_existing_object)
    def customize( self, mb ):
        
        mb.global_ns.calldefs().create_with_signature = True
        
        hello_world = mb.free_fun( 'hello_world' )
        hello_world.add_transformation( ft.output(0) )
        
        calc = mb.class_('calculator_t' )
        assign_funs = calc.mem_funs( lambda decl: decl.name.startswith( 'assign' ) )
        assign_funs.add_transformation( ft.output(0), ft.output(1) )
        
        clone_and_assign_5 = calc.mem_fun( 'clone_and_assign_5' )
        clone_and_assign_5.add_transformation( ft.output(0) )
        clone_and_assign_5.call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
            
        window = mb.class_( 'window_t' )
        window.mem_fun( 'resize' ).add_transformation( ft.input(0), ft.input(1) )
        window.mem_fun( 'resize_in_out' ).add_transformation( ft.inout(0), ft.inout(1) )
        
        point3d = mb.class_( 'point3d_t' )
        point3d.add_wrapper_code( '' )
        point3d.mem_fun( 'initialize' ).add_transformation( ft.input_static_array(0, size=3) )
        point3d.mem_fun( 'position' ).add_transformation( ft.output_static_array(0, size=3) )
        distance = point3d.mem_fun( 'distance' )
        distance.add_transformation( ft.output(1) )
        distance.transformations[0].controller.add_pre_call_code( '//dddddddddddddd' )
        distance.transformations[0].controller.add_post_call_code( '//qqqqqqqqqqqqq' )
        
        image = mb.class_( "image_t" )
        image.always_expose_using_scope = True
        image.member_function( "get_size" )
        image.member_function( "get_size" ).add_transformation( ft.output(0), ft.output(1) )
        image.member_function( "get_one_value" ).add_transformation( ft.output(0) )
        image.member_function( "get_size2" ).add_transformation( ft.output(0), ft.output(1) )
        image.member_function( "input_arg" ).add_transformation( ft.input(0) )
        image.member_function( "fixed_input_array" ).add_transformation( ft.input_static_array(0,3) )
        image.member_function( "fixed_output_array" ).add_transformation( ft.output_static_array(0,3) )
        mb.free_function("get_cpp_instance").call_policies \
            = call_policies.return_value_policy(call_policies.reference_existing_object)
        mb.variable( "cpp_instance" ).exclude()

        cls = mb.class_("no_virtual_members_t")
        cls.member_function("member").add_transformation( ft.output(0) )

        cls = mb.class_("ft_private_destructor_t")
        cls.member_function("get_value").add_transformation( ft.output(0) )

        mb.decls(lambda decl: decl.name.startswith("_")).exclude()

        cls = mb.class_("bug_render_target_t")
        cls.mem_fun("get_statistics", arg_types=['float &']*2).add_transformation( ft.output(0), ft.output(1) )
        
        cls = mb.class_( 'modify_type_tester_t' )
        do_nothing = cls.mem_fun( 'do_nothing' )
        do_nothing.add_transformation( ft.modify_type(0, declarations.remove_reference ) )

        clone = cls.mem_fun( 'clone' )
        clone.call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
        clone.add_transformation( ft.modify_type(0, declarations.remove_reference ) )
        
        cls = mb.class_( 'input_c_buffer_tester_t')
        write_mf = cls.mem_fun( 'write' )
        write_mf.add_transformation( ft.input_c_buffer( 'buffer', 'size' ) )
        write_s = cls.mem_fun( 'write_s' )
        write_s.add_transformation( ft.input_c_buffer( 'buffer', 'size' ) )
        
        resource = mb.class_( 'resources_t' )
        resource.held_type = 'std::auto_ptr< %s >' % resource.decl_string
        transfer_ownership_tester = mb.class_( 'transfer_ownership_tester_t' )
        tester = transfer_ownership_tester.mem_fun( 'tester' )
        tester.add_transformation( ft.transfer_ownership( 0 ) )
        
        render_queue_listener_t = mb.class_( 'render_queue_listener_t' )
        render_queue_ended = render_queue_listener_t.mem_fun( 'render_queue_ended' )
        render_queue_ended.add_transformation( ft.inout(2) )

        ft_bugs = mb.namespace( 'ft_bugs' )
        h = ft_bugs.mem_fun( 'h' )
        h.add_transformation( ft.modify_type(0, remove_const_ref ) )
        h.call_policies = call_policies.return_internal_reference()

        h2 = ft_bugs.mem_fun( 'h2' )
        h2.add_transformation( ft.modify_type(0, remove_const_ref ) )
        h2.call_policies = call_policies.return_internal_reference()

        ft_bugs.class_( 'B' ).always_expose_using_scope = True
        ft_bugs.mem_fun( 'get_a' ).call_policies \
            = call_policies.return_value_policy( call_policies.reference_existing_object )

        ft_bugs2 = mb.namespace( 'ft_bugs2' )
        g = ft_bugs2.mem_fun( 'g' )
        g.add_transformation( ft.modify_type(0, remove_const_ref ) )
        g.call_policies = call_policies.return_internal_reference()
Пример #51
0
 def ParseMatchmaking(self, mb):
     # The main matchmaking interface
     cls = mb.class_('ISteamMatchmaking')
     cls.include()
     cls.no_init = True
     cls.noncopyable = True
     cls.mem_funs().virtuality = 'not virtual'
     cls.mem_funs('GetLobbyGameServer').add_transformation(FT.output('punGameServerIP'), FT.output('punGameServerPort'), FT.output('psteamIDGameServer'))
     
     mb.free_function('PyGetLobbyDataByIndex').include()
     mb.free_function('PySendLobbyChatMsg').include()
     mb.free_function('PyGetLobbyChatEntry').include()
     
     mb.var('k_uAPICallInvalid').include()
     
     self.AddSteamCallResult('LobbyMatchList', 'LobbyMatchList_t')
     self.AddSteamCallResult('LobbyGameCreated', 'LobbyGameCreated_t')
     self.AddSteamCallResult('LobbyCreated', 'LobbyCreated_t')
     self.AddSteamCallResult('LobbyEnter', 'LobbyEnter_t')
     
     self.AddSteamCallback('LobbyChatUpdate', 'LobbyChatUpdate_t')
     self.AddSteamCallback('LobbyChatMsg', 'LobbyChatMsg_t')
     self.AddSteamCallback('LobbyDataUpdate', 'LobbyDataUpdate_t')
     
     # Servers matchmaking interface
     cls = mb.class_('PySteamMatchmakingServers')
     cls.include()
     cls.rename('SteamMatchmakingServers')
     
     cls = mb.class_('PySteamMatchmakingServerListResponse')
     cls.include()
     cls.rename('SteamMatchmakingServerListResponse')
     cls.mem_fun('PyServerResponded').rename('ServerResponded')
     cls.mem_fun('PyServerFailedToRespond').rename('ServerFailedToRespond')
     cls.mem_fun('PyRefreshComplete').rename('RefreshComplete')
     
     cls = mb.class_('gameserveritem_t')
     cls.include()
     cls.mem_fun('SetName').exclude()
     self.PythonfyVariables(cls)
     cls.var('m_szGameDir').exclude()
     cls.var('m_szMap').exclude()
     cls.var('m_szGameDescription').exclude()
     cls.var('m_szGameTags').exclude()
     
     cls = mb.class_('pygameserveritem_t')
     cls.include()
     self.PythonfyVariables(cls)
     self.AddProperty(cls, 'gamedir', 'GetGameDir')
     self.AddProperty(cls, 'map', 'GetMap')
     self.AddProperty(cls, 'gamedescription', 'GetGameDescription')
     self.AddProperty(cls, 'gametags', 'GetGameTags')
     
     cls = mb.class_('servernetadr_t')
     cls.include()
     cls.rename('servernetadr')
     
     cls = mb.class_('PySteamMatchmakingPingResponse')
     cls.include()
     cls.rename('SteamMatchmakingPingResponse')
     
     cls = mb.class_('PySteamMatchmakingPlayersResponse')
     cls.include()
     cls.rename('SteamMatchmakingPlayersResponse')
     
     cls = mb.class_('PySteamMatchmakingRulesResponse')
     cls.include()
     cls.rename('SteamMatchmakingRulesResponse')
     
     # Enums
     mb.enums('ELobbyType').include()
     mb.enums('ELobbyComparison').include()
     mb.enums('ELobbyDistanceFilter').include()
     mb.enums('EMatchMakingServerResponse').include()
Пример #52
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()

        # Include message functions and rename them
        mb.free_function('SrcPyMsg').include()
        mb.free_function('SrcPyWarning').include()
        mb.free_function('SrcPyDevMsg').include()

        mb.free_function('SrcPyMsg').rename('Msg')
        mb.free_function('SrcPyWarning').rename('PrintWarning')
        mb.free_function('SrcPyDevMsg').rename('DevMsg')

        # Include classes for redirecting output (replace stdout and stderr)
        mb.class_('SrcPyStdOut').include()
        mb.class_('SrcPyStdErr').include()

        # Debug logging
        mb.free_function('PyCOM_TimestampedLog').include()
        mb.free_function('PyCOM_TimestampedLog').rename('COM_TimestampedLog')

        # Tick and per frame method register functions
        mb.free_function('RegisterTickMethod').include()
        mb.free_function('UnregisterTickMethod').include()
        mb.free_function('GetRegisteredTickMethods').include()
        mb.free_function('IsTickMethodRegistered').include()

        mb.free_function('RegisterPerFrameMethod').include()
        mb.free_function('UnregisterPerFrameMethod').include()
        mb.free_function('GetRegisteredPerFrameMethods').include()
        mb.free_function('IsPerFrameMethodRegistered').include()

        # Color classes
        cls = mb.class_('Color')
        cls.include()
        cls.mem_funs('GetColor').add_transformation(FT.output('_r'),
                                                    FT.output('_g'),
                                                    FT.output('_b'),
                                                    FT.output('_a'))
        cls.mem_opers(
            '=').exclude()  # Breaks debug mode and don't really need it

        cls = mb.class_('color32_s')
        cls.include()
        cls.rename('color32')
        cls.mem_funs(allow_empty=True).exclude()

        if self.settings.branch == 'swarm':
            # Used by GetRenderColor in Swarm branch
            cls = mb.class_('color24')
            cls.include()

        # Global Vars Class
        mb.class_('CGlobalVarsBase').include()
        mb.class_('CGlobalVars').include()
        mb.vars('pSaveData').exclude()

        # Add converters
        mb.add_registration_code(
            "bp::to_python_converter<\n\tstring_t,\n\tstring_t_to_python_str>();"
        )
        mb.add_registration_code("python_str_to_string_t();")
        mb.add_registration_code("wchar_t_to_python_str();")
        mb.add_registration_code("ptr_wchar_t_to_python_str();")
        mb.add_registration_code("python_str_to_wchar_t();")
        mb.add_registration_code(
            "#if PY_VERSION_HEX < 0x03000000\n\tpython_unicode_to_ptr_const_wchar_t();\n\t#endif \\ PY_VERSION_HEX"
        )
Пример #53
0
    def Parse(self, mb):
        mb.decls().exclude()

        # Get item
        getitem_wrapper =    'static ::vec_t GetItem( %(cls_name)s const & inst, int i ) {\r\n' + \
                                '   if( i < 0 || i > %(nitems)s ) {\r\n' + \
                                '       PyErr_SetString(PyExc_IndexError, "Index out of range" );\r\n' + \
                                '       throw boost::python::error_already_set();\r\n' + \
                                '   }\r\n' + \
                                '   return inst[i];\r\n' + \
                                '}\r\n'

        getitem_reg = '%(cls_name)s_exposer.def( "__getitem__", &::%(cls_name)s_wrapper::GetItem );\r\n'

        # Set item
        setitem_wrapper =    'static void SetItem( %(cls_name)s & inst, int i, ::vec_t v ) {\r\n' + \
                                '   if( i < 0 || i > %(nitems)s ) {\r\n' + \
                                '       PyErr_SetString(PyExc_IndexError, "Index out of range" );\r\n' + \
                                '       throw boost::python::error_already_set();\r\n' + \
                                '   }\r\n' + \
                                '   inst[i] = v;\r\n' + \
                                '}\r\n'

        setitem_reg = '%(cls_name)s_exposer.def( "__setitem__", &::%(cls_name)s_wrapper::SetItem );\r\n'

        # String
        str_vmatrix_wrapper = 'static boost::python::object Str( VMatrix const & inst ) {\r\n' + \
                                '   return boost::python::object(VMatToString(inst));\r\n' + \
                                '}\r\n'

        str_reg = '%(cls_name)s_exposer.def( "__str__", &::%(cls_name)s_wrapper::Str );\r\n'

        # Classes
        cls = mb.class_('Vector')
        cls.include()
        cls.mem_opers(
            '=').exclude()  # Breaks debug mode and don't really need it

        cls.add_wrapper_code(getitem_wrapper % {
            'cls_name': 'Vector',
            'nitems': '2'
        })
        cls.add_registration_code(getitem_reg % {'cls_name': 'Vector'}, False)
        cls.add_wrapper_code(setitem_wrapper % {
            'cls_name': 'Vector',
            'nitems': '2'
        })
        cls.add_registration_code(setitem_reg % {'cls_name': 'Vector'}, False)

        cls = mb.class_('Vector2D')
        cls.include()
        cls.mem_opers(
            '=').exclude()  # Breaks debug mode and don't really need it

        cls.add_wrapper_code(getitem_wrapper % {
            'cls_name': 'Vector2D',
            'nitems': '1'
        })
        cls.add_registration_code(getitem_reg % {'cls_name': 'Vector2D'},
                                  False)
        cls.add_wrapper_code(setitem_wrapper % {
            'cls_name': 'Vector2D',
            'nitems': '1'
        })
        cls.add_registration_code(setitem_reg % {'cls_name': 'Vector2D'},
                                  False)

        cls = mb.class_('QAngle')
        cls.include()
        cls.mem_opers(
            '=').exclude()  # Breaks debug mode and don't really need it

        cls.add_wrapper_code(getitem_wrapper % {
            'cls_name': 'QAngle',
            'nitems': '2'
        })
        cls.add_registration_code(getitem_reg % {'cls_name': 'QAngle'}, False)
        cls.add_wrapper_code(setitem_wrapper % {
            'cls_name': 'QAngle',
            'nitems': '2'
        })
        cls.add_registration_code(setitem_reg % {'cls_name': 'QAngle'}, False)

        cls = mb.class_('Quaternion')
        cls.include()
        cls.mem_opers(
            '=').exclude()  # Breaks debug mode and don't really need it

        # Call policies
        mb.mem_funs(
            'AsVector2D'
        ).call_policies = call_policies.return_internal_reference()

        # Transform functions that take pointers as arguments
        mb.free_functions('SolveInverseQuadraticMonotonic').add_transformation(
            FT.output('a'), FT.output('b'), FT.output('c'))
        mb.free_functions('ComputeTrianglePlane').add_transformation(
            FT.output('intercept'))
        mb.free_functions(
            'CalcSqrDistAndClosestPointOnAABB').add_transformation(
                FT.output('distSqrOut'))
        mb.free_functions(
            'SolveInverseReciprocalQuadratic').add_transformation(
                FT.output('a'), FT.output('b'), FT.output('c'))
        mb.free_functions('SolveQuadratic').add_transformation(
            FT.output('root1'), FT.output('root2'))
        mb.free_functions('SolveInverseQuadratic').add_transformation(
            FT.output('a'), FT.output('b'), FT.output('c'))
        mb.free_functions('QuaternionAxisAngle').add_transformation(
            FT.output('axis'), FT.output('angle'))
        mb.free_functions('RotationDeltaAxisAngle').add_transformation(
            FT.output('deltaAxis'), FT.output('deltaAngle'))

        # Compressed color
        mb.class_('ColorRGBExp32').include()

        # cplane_t
        mb.class_('cplane_t').include()
        mb.class_('cplane_t').var('pad').exclude()

        # matrix3x4_t
        mb.class_('matrix3x4_t').include()
        mb.class_('matrix3x4_t').mem_opers().exclude()

        # -----
        # Add custom item access functions to the Vector class
        mb.global_ns.mem_opers('[]').exclude()

        mb.class_('Vector').add_registration_code(
            'def( bp::init< const Vector & >(( bp::arg("vOther") )) )')
        mb.class_('QAngle').add_registration_code(
            'def( bp::init< const QAngle & >(( bp::arg("vOther") )) )')

        # Vars
        mb.vars('vec3_origin').include()
        mb.vars('vec3_angle').include()
        mb.vars('vec3_invalid').include()
        mb.vars('nanmask').include()

        # Mathlib.h functions
        mb.free_function('RandomAngularImpulse').include()

        mb.free_functions('VectorMaximum').include()
        mb.free_functions('VectorMAInline').include()
        mb.free_functions('VectorMA').include()

        mb.free_functions('RoundInt').include()
        mb.free_functions('Q_log2').include()
        mb.free_functions('SinCos').include()
        mb.free_functions('TableCos').include()
        mb.free_functions('TableSin').include()
        if self.settings.branch == 'swarm':
            mb.free_functions('IsPowerOfTwo').include()
        mb.free_functions('SmallestPowerOfTwoGreaterOrEqual').include()
        mb.free_functions('LargestPowerOfTwoLessThanOrEqual').include()
        mb.free_functions('FloorDivMod').include()
        mb.free_functions('GreatestCommonDivisor').include()
        mb.free_functions('IsDenormal').include()

        mb.free_functions('MatrixVectors').include()
        mb.free_functions('VectorRotate').include()
        mb.free_functions('TransformAnglesToLocalSpace').include()

        mb.free_functions('MatrixInitialize').include()
        mb.free_functions('MatrixCopy').include()
        mb.free_functions('MatrixInvert').include()
        mb.free_functions('MatricesAreEqual').include()
        mb.free_functions('MatrixGetColumn').include()
        mb.free_functions('MatrixSetColumn').include()
        mb.free_functions('ConcatRotations').include()
        mb.free_functions('ConcatTransforms').include()
        mb.free_functions('MatrixMultiply').include()

        mb.free_function('QuaternionSlerp').include()
        mb.free_function('QuaternionSlerpNoAlign').include()
        mb.free_function('QuaternionBlend').include()
        mb.free_function('QuaternionBlendNoAlign').include()
        mb.free_function('QuaternionIdentityBlend').include()
        mb.free_function('QuaternionAngleDiff').include()
        mb.free_function('QuaternionScale').include()
        mb.free_function('QuaternionDotProduct').include()
        mb.free_function('QuaternionConjugate').include()
        mb.free_function('QuaternionInvert').include()
        mb.free_function('QuaternionNormalize').include()
        mb.free_function('QuaternionAdd').include()
        mb.free_function('QuaternionMult').include()
        mb.free_functions('QuaternionMatrix').include()
        mb.free_functions('QuaternionAngles').include()
        mb.free_functions('AngleQuaternion').include()
        mb.free_function('QuaternionAxisAngle').include()
        mb.free_function('AxisAngleQuaternion').include()
        mb.free_function('BasisToQuaternion').include()
        mb.free_function('MatrixQuaternion').include()

        mb.free_functions('MatrixRowDotProduct').include()
        mb.free_functions('MatrixColumnDotProduct').include()

        mb.free_functions('anglemod').include()
        mb.free_functions('RemapVal').include()
        mb.free_functions('RemapValClamped').include()
        mb.free_functions('Lerp').include()
        mb.free_functions('Sqr').include()
        mb.free_functions('FLerp').include()
        mb.free_functions('Sign').include()
        mb.free_functions('ClampArrayBounds').include()

        mb.free_functions('AngleVectors').include()
        mb.free_functions('AngleVectors').include()
        mb.free_functions('AngleVectorsTranspose').include()
        mb.free_functions('AngleMatrix').include()
        mb.free_functions('AngleMatrix').include()
        mb.free_functions('AngleIMatrix').include()
        mb.free_functions('VectorAngles').include()
        mb.free_functions('VectorMatrix').include()
        mb.free_functions('VectorVectors').include()
        mb.free_functions('SetIdentityMatrix').include()
        mb.free_functions('SetScaleMatrix').include()
        mb.free_functions('MatrixBuildRotationAboutAxis').include()

        mb.free_functions('MatrixTranspose').include()
        mb.free_functions('MatrixInverseTranspose').include()
        mb.free_functions('PositionMatrix').include()
        mb.free_functions('MatrixPosition').include()
        mb.free_functions('VectorRotate').include()
        mb.free_functions('VectorIRotate').include()
        mb.free_functions('MatrixAngles').include()
        mb.free_functions('VectorCompare').include()
        mb.free_functions('VectorTransform').include()
        mb.free_functions('VectorITransform').include()

        mb.free_functions('BoxOnPlaneSide').include()
        mb.free_functions('VectorFill').include()
        mb.free_functions('VectorNegate').include()
        mb.free_functions('VectorAvg').include()
        mb.free_functions('BoxOnPlaneSide2').include()
        mb.free_functions('ClearBounds').include()
        mb.free_functions('AddPointToBounds').include()

        mb.free_functions('BuildGammaTable').include()
        mb.free_functions('TexLightToLinear').include()
        mb.free_functions('LinearToTexture').include()
        mb.free_functions('LinearToScreenGamma').include()
        mb.free_functions('TextureToLinear').include()

        mb.free_functions('SolveQuadratic').include()
        mb.free_functions('SolveInverseQuadratic').include()
        mb.free_functions('SolveInverseQuadraticMonotonic').include()
        mb.free_functions('SolveInverseReciprocalQuadratic').include()

        mb.free_functions('VectorYawRotate').include()

        mb.free_functions('Bias').include()
        mb.free_functions('Gain').include()
        mb.free_functions('SmoothCurve').include()
        mb.free_functions('SmoothCurve_Tweak').include()
        mb.free_functions('ExponentialDecay').include()
        mb.free_functions('ExponentialDecay').include()
        mb.free_functions('ExponentialDecayIntegral').include()
        mb.free_functions('SimpleSpline').include()
        mb.free_functions('SimpleSplineRemapVal').include()
        mb.free_functions('SimpleSplineRemapValClamped').include()
        mb.free_functions('RoundFloatToInt').include()
        mb.free_functions('RoundFloatToByte').include()
        mb.free_functions('RoundFloatToUnsignedLong').include()
        mb.free_functions('IsIntegralValue').include()
        mb.free_functions('Float2Int').include()
        mb.free_functions('Floor2Int').include()
        mb.free_functions('FastFToC').include()
        mb.free_functions('ClampToMsec').include()
        mb.free_functions('Ceil2Int').include()

        mb.free_functions('GetBarycentricCoords2D').include()
        mb.free_functions('QuickBoxSphereTest').include()
        mb.free_functions('QuickBoxIntersectTest').include()

        mb.free_functions('GammaToLinearFullRange').include()
        mb.free_functions('LinearToGammaFullRange').include()
        mb.free_functions('GammaToLinear').include()
        mb.free_functions('LinearToGamma').include()
        mb.free_functions('SrgbGammaToLinear').include()
        mb.free_functions('SrgbLinearToGamma').include()
        mb.free_functions('X360GammaToLinear').include()
        mb.free_functions('X360LinearToGamma').include()
        mb.free_functions('SrgbGammaTo360Gamma').include()
        mb.free_functions('LinearToVertexLight').include()
        mb.free_functions('LinearToLightmap').include()
        mb.free_functions('ColorClamp').include()
        mb.free_functions('ColorClampTruncate').include()

        mb.free_functions('Catmull_Rom_Spline').include()
        mb.free_functions('Catmull_Rom_Spline_Tangent').include()
        mb.free_functions('Catmull_Rom_Spline_Integral').include()
        mb.free_functions('Catmull_Rom_Spline_Integral').include()
        mb.free_functions('Catmull_Rom_Spline_Normalize').include()
        mb.free_functions('Catmull_Rom_Spline_Integral_Normalize').include()
        mb.free_functions('Catmull_Rom_Spline_NormalizeX').include()
        mb.free_functions('Catmull_Rom_Spline_NormalizeX').include()
        mb.free_functions('Hermite_Spline').include()
        #mb.free_functions('Hermite_SplineBasis').include()
        mb.free_functions('Kochanek_Bartels_Spline').include()
        mb.free_functions('Kochanek_Bartels_Spline_NormalizeX').include()
        mb.free_functions('Cubic_Spline').include()
        mb.free_functions('Cubic_Spline_NormalizeX').include()
        mb.free_functions('BSpline').include()
        mb.free_functions('BSpline_NormalizeX').include()
        mb.free_functions('Parabolic_Spline').include()
        mb.free_functions('Parabolic_Spline_NormalizeX').include()
        mb.free_functions('QuinticInterpolatingPolynomial').include()
        #mb.free_functions('GetInterpolationData').include()
        mb.free_functions('RangeCompressor').include()

        mb.free_functions('CalcSqrDistanceToAABB').include()
        mb.free_functions('CalcClosestPointOnAABB').include()
        mb.free_functions('CalcSqrDistAndClosestPointOnAABB').include()
        mb.free_functions('CalcDistanceToAABB').include()

        #mb.free_functions('CalcLineToLineIntersectionSegment').include() # TODO

        mb.free_functions('Approach').include()
        mb.free_functions('ApproachAngle').include()
        mb.free_functions('AngleDiff').include()
        mb.free_functions('AngleDistance').include()
        mb.free_functions('AngleNormalize').include()
        mb.free_functions('AngleNormalizePositive').include()
        mb.free_functions('AnglesAreEqual').include()
        mb.free_functions('RotationDeltaAxisAngle').include()
        mb.free_functions('RotationDelta').include()
        mb.free_functions('ComputeTrianglePlane').include()
        mb.free_functions('PolyFromPlane').include()
        mb.free_functions('ClipPolyToPlane').include()
        mb.free_functions('ClipPolyToPlane_Precise').include()
        mb.free_functions('CalcTriangleTangentSpace').include()

        mb.free_functions('TransformAABB').include()
        mb.free_functions('ITransformAABB').include()
        mb.free_functions('RotateAABB').include()
        mb.free_functions('IRotateAABB').include()
        mb.free_functions('MatrixTransformPlane').include()
        mb.free_functions('MatrixITransformPlane').include()
        mb.free_functions('CeilPow2').include()
        mb.free_functions('FloorPow2').include()
        mb.free_functions('RGBtoHSV').include()
        mb.free_functions('HSVtoRGB').include()

        # Vector.h functions
        mb.free_functions('VectorClear').include()
        mb.free_functions('VectorCopy').include()
        mb.free_functions('VectorAdd').include()
        mb.free_functions('VectorSubtract').include()
        mb.free_functions('VectorMultiply').include()
        mb.free_functions('VectorDivide').include()
        mb.free_functions('VectorScale').include()
        mb.free_functions('VectorMA').include()
        mb.free_functions('VectorsAreEqual').include()
        mb.free_functions('ComputeClosestPoint').include()
        mb.free_functions('VectorAbs').include()
        mb.free_functions('VectorLength').include()
        mb.free_functions('DotProduct').include()
        mb.free_functions('CrossProduct').include()
        mb.free_functions('VectorMin').include()
        mb.free_functions('VectorMax').include()
        mb.free_functions('VectorLerp').include()
        mb.free_functions('RandomVector').include()

        mb.free_functions('QAnglesAreEqual').include()
        #mb.free_functions('QAngleToAngularImpulse').include()
        #mb.free_functions('AngularImpulseToQAngle').include()

        mb.free_functions('VectorNormalize').include()
        mb.free_functions('VectorNormalizeFast').include()

        # Vector2d.h functions
        mb.free_functions('Vector2DClear').include()
        mb.free_functions('Vector2DCopy').include()
        mb.free_functions('Vector2DAdd').include()
        mb.free_functions('Vector2DSubtract').include()
        mb.free_functions('Vector2DMultiply').include()
        mb.free_functions('Vector2DDivide').include()
        mb.free_functions('Vector2DMA').include()
        mb.free_functions('Vector2DMin').include()
        mb.free_functions('Vector2DMax').include()
        mb.free_functions('Vector2DLength').include()
        mb.free_functions('DotProduct2D').include()
        mb.free_functions('Vector2DLerp').include()
        mb.free_functions('Vector2DNormalize').include()
        mb.free_functions('ComputeClosestPoint2D').include()

        # QAngle functions
        mb.free_function('RandomAngle').include()

        # VMatrix
        cls = mb.class_('VMatrix')
        cls.include()
        cls.mem_opers(
            '=').exclude()  # Breaks debug mode and don't really need it
        cls.mem_opers('[]').exclude()
        cls.mem_funs('Base').exclude()
        cls.mem_funs('As3x4').exclude()
        cls.mem_funs('GetTranslation').exclude()
        cls.vars('m').exclude()

        cls.add_wrapper_code(str_vmatrix_wrapper % {'cls_name': 'VMatrix'})
        cls.add_registration_code(str_reg % {'cls_name': 'VMatrix'}, False)

        mb.free_functions('MatrixSetIdentity').include()
        mb.free_functions('MatrixTranspose').include()
        mb.free_functions('MatrixCopy').include()
        mb.free_functions('MatrixMultiply').include()

        mb.free_functions('MatrixGetColumn').include()
        mb.free_functions('MatrixSetColumn').include()
        mb.free_functions('MatrixGetRow').include()
        mb.free_functions('MatrixSetRow').include()

        mb.free_functions('MatrixTranslate').include()
        mb.free_functions('MatrixBuildRotationAboutAxis').include()
        mb.free_functions('MatrixBuildRotateZ').include()
        mb.free_functions('MatrixRotate').include()

        mb.free_functions('MatrixFromAngles').include()
        mb.free_functions('MatrixToAngles').include()

        # Exclude
        if self.settings.branch not in ['swarm', 'source2013']:
            mb.vars('pfVectorNormalizeFast').exclude()
            mb.vars('pfVectorNormalize').exclude()
            mb.vars('pfInvRSquared').exclude()
        mb.vars('m_flMatVal').exclude()
        mb.vars('quat_identity').exclude(
        )  # <- Does not even exist except for a declaration?

        # Exclude some functions
        mb.mem_funs('Base').exclude(
        )  # Base gives a pointer to the address of the data. Not very python like.
        mb.free_functions('AllocTempVector').exclude()
        mb.class_('Vector2D').mem_funs('Cross').exclude()  # Declaration only?
        mb.free_function('ConcatRotations').exclude()  # Declaration only?

        # Remove any protected function
        mb.calldefs(matchers.access_type_matcher_t('protected')).exclude()

        # Remove any function with "float *" values
        # A lot of functions have two versions (or more), of which one takes "float *" arguments
        vec_t = mb.typedef('vec_t')
        excludetypes = [
            pointer_t(float_t()),
            pointer_t(const_t(float_t())),
            pointer_t(declarated_t(vec_t)),
            pointer_t(const_t(declarated_t(vec_t))),
        ]
        mb.calldefs(calldef_withtypes(excludetypes)).exclude()

        # Silent warnings of generating class wrappers
        mb.classes().disable_warnings(messages.W1027)

        # Include functions with "float *" parameter. For these functions we should transform the "float *" parameter
        mb.free_functions('CalcClosestPointOnLine2D').include()
        mb.free_functions('CalcClosestPointOnLine2D').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcDistanceToLine2D').include()
        mb.free_functions('CalcDistanceToLine2D').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcDistanceSqrToLine2D').include()
        mb.free_functions('CalcDistanceSqrToLine2D').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcClosestPointOnLineSegment2D').include()
        mb.free_functions(
            'CalcClosestPointOnLineSegment2D').add_transformation(
                FT.output('t'))
        mb.free_functions('CalcDistanceToLineSegment2D').include()
        mb.free_functions('CalcDistanceToLineSegment2D').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcDistanceSqrToLineSegment2D').include()
        mb.free_functions('CalcDistanceSqrToLineSegment2D').add_transformation(
            FT.output('t'))

        mb.free_functions('CalcClosestPointOnLine').include()
        mb.free_functions('CalcClosestPointOnLine').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcDistanceToLine').include()
        mb.free_functions('CalcDistanceToLine').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcDistanceSqrToLine').include()
        mb.free_functions('CalcDistanceSqrToLine').add_transformation(
            FT.output('t'))

        mb.free_functions('CalcClosestPointOnLineSegment').include()
        mb.free_functions('CalcClosestPointOnLineSegment').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcDistanceToLineSegment').include()
        mb.free_functions('CalcDistanceToLineSegment').add_transformation(
            FT.output('t'))
        mb.free_functions('CalcDistanceSqrToLineSegment').include()
        mb.free_functions('CalcDistanceSqrToLineSegment').add_transformation(
            FT.output('t'))
Пример #54
0
    #mb.namespace("core_mathlib").exclude()
    mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude()
    mb.calldefs( access_type_matcher_t( 'private' ) ).exclude()
    # ####################################################
    # SCRIPT POUR ../input_output/bin.h
    mb.class_("t_pos").decl("operator float *").exclude()
    # ####################################################
    # SCRIPT POUR ../input_output/gabe/stdgabe.h
    mb.namespace("formatGABE").exclude()
    mb.namespace("formatGABE").decls("GABE_OBJECTTYPE").include()
    mb.decls( lambda decl: 'impl_' in decl.name ).exclude()
    io_gabe=mb.class_("Gabe_rw")
    io_gabe.mem_fun("size").alias="__len__"
    #transforme le parametre en valeur de retour des fonctions commencant par ReadCol
    io_gabe.decls(lambda decl: decl.name.startswith( 'ReadCol' )).add_transformation( FT.output(1) )

    # ####################################################
    # SCRIPT POUR ../input_output/mbin.h
    cmbin=mb.namespace("formatMBIN").class_("CMBIN")
    cmbin.mem_fun("ImportBIN").exclude()
    cmbin.mem_fun("ExportBIN").exclude()
    
    # ####################################################
    # SCRIPT POUR     ../input_output/cxml.h
    # mb.namespace("BasicXmlProcess").exclude()
    # cxmlnode=mb.class_("CXmlNode")
    # cxmlnode.mem_fun("GetChild").call_policies =  call_policies.return_value_policy( call_policies.return_opaque_pointer )
    # cxmlnode.decls("t_nodeData").exclude()
    # cxml=mb.class_("CXml")
    # cxml.mem_fun("GetRoot").call_policies =  call_policies.return_value_policy( call_policies.return_opaque_pointer )
Пример #55
0
 def create_output( size ):
     return [ ft.output( i ) for i in range( size ) ]
Пример #56
0
    def ParseImageClasses(self, mb):
        # IBorder
        cls = mb.class_('IBorder')
        cls.include()
        cls.mem_funs('ApplySchemeSettings').include()    
        cls.mem_funs('Paint').virtuality = 'pure virtual'
        cls.mem_funs('ApplySchemeSettings').virtuality = 'pure virtual'

        # IImage
        cls = mb.class_('IImage')
        cls.include()  
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs('Paint').virtuality = 'pure virtual'
        
        # Image
        cls = mb.class_('Image')
        cls.include()
        #cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.no_init = True
        #cls.calldefs().virtuality = 'not virtual' 
        cls.calldefs('Image').exclude()
        cls.mem_funs( 'Paint' ).exclude()
        cls.add_wrapper_code( 'virtual void Paint() {}' )    # Stub for wrapper class. Otherwise it will complain.
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        
        # FIXME: Py++ is giving problems on some functions
        cls.mem_funs('SetPos').virtuality = 'not virtual'
        #cls.mem_funs('GetPos').virtuality = 'not virtual'
        #cls.mem_funs('GetSize').virtuality = 'not virtual'
        #cls.mem_funs('GetContentSize').virtuality = 'not virtual'
        cls.mem_funs('SetColor').virtuality = 'not virtual'
        cls.mem_funs('SetBkColor').virtuality = 'not virtual'
        cls.mem_funs('GetColor').virtuality = 'not virtual'
        
        cls.mem_funs('SetSize').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawFilledRect').virtuality = 'not virtual' 
        cls.mem_funs('DrawOutlinedRect').virtuality = 'not virtual' 
        cls.mem_funs('DrawLine').virtuality = 'not virtual' 
        cls.mem_funs('DrawPolyLine').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextFont').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextColor').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTextPos').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintText').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintText').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintChar').virtuality = 'not virtual' 
        cls.mem_funs('DrawPrintChar').virtuality = 'not virtual' 
        cls.mem_funs('DrawSetTexture').virtuality = 'not virtual' 
        cls.mem_funs('DrawTexturedRect').virtuality = 'not virtual' 
        
        # TextImage
        cls = mb.class_('TextImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        #cls.calldefs('SetText', calldef_withtypes([pointer_t(const_t(declarated_t(wchar_t())))])).exclude()
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetDrawWidth' ).add_transformation( FT.output('width') )
        cls.mem_funs( 'SizeText' ).exclude()     # DECLARATION ONLY
        
        cls.mem_funs('GetText').exclude()
        cls.add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    char buf[1025];\r\n' + \
            '    TextImage::GetText(buf, 1025);\r\n' + \
            '    return boost::python::object(buf);\r\n' + \
            '}'
        )
        cls.add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextImage_wrapper::* )())( &TextImage_wrapper::GetText ) )'
        )
        
        # BitmapImage
        cls = mb.class_('BitmapImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        if self.settings.branch == 'source2013':
            cls.mem_fun('SetBitmap').exclude()
        #cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        
        cls.calldefs('GetColor', calldef_withtypes([reference_t(declarated_t(int_t()))])).add_transformation(FT.output('r'), FT.output('g'), FT.output('b'), FT.output('a'))
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        
        # CAvatarImage
        cls = mb.class_('CAvatarImage')
        cls.include()
        cls.calldefs().virtuality = 'not virtual' 
        cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
        cls.rename('AvatarImage')
        cls.mem_funs( 'GetSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'GetContentSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
        cls.mem_funs( 'InitFromRGBA' ).exclude()
        
        mb.enum('EAvatarSize').include()