예제 #1
0
 def ApplyCommonRules(self, mb):
     # Common function added for getting the "PyObject" of an entity
     mb.mem_funs('GetPySelf').exclude()
     
     ihandleentity = mb.class_('IHandleEntity')
     
     # All return values derived from IHandleEntity entity will be returned by value.
     # This ensures the converter is called
     testinherit = MatcherTestInheritClass(ihandleentity)
     decls = mb.calldefs(matchers.custom_matcher_t(testinherit))
     decls.call_policies = call_policies.return_value_policy(call_policies.return_by_value)
     
     # All CBaseEntity related classes should have a custom call trait
     self.baseentcls = mb.class_('CBaseEntity' if self.isserver else 'C_BaseEntity')
     def ent_call_trait(type_):
         return '%(arg)s ? %(arg)s->GetPyHandle() : boost::python::object()'
     entclasses = mb.classes(self.TestCBaseEntity)
     for entcls in entclasses:
         entcls.custom_call_trait = ent_call_trait
         
     # All functions receiving an IHandleEntity argument should be converted
     def ihandleentity_call_trait(type_):
         return 'PyEntityFromEntityHandle( %(arg)s )'
     ihandleentity.custom_call_trait = ihandleentity_call_trait
     
     # Anything returning KeyValues should be returned by value so it calls the converter
     keyvalues = mb.class_('KeyValues')
     mb.calldefs(matchers.calldef_matcher_t(return_type=pointer_t(declarated_t(keyvalues))), allow_empty=True).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
     mb.calldefs(matchers.calldef_matcher_t(return_type=pointer_t(const_t(declarated_t(keyvalues)))), allow_empty=True).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
     
     # Anything returning a void pointer is excluded by default
     mb.calldefs(matchers.calldef_matcher_t(return_type=pointer_t(declarated_t(void_t()))), allow_empty=True).exclude()
     mb.calldefs(matchers.calldef_matcher_t(return_type=pointer_t(const_t(declarated_t(void_t())))), allow_empty=True).exclude()
예제 #2
0
 def ApplyCommonRules(self, mb):
     # Common function added for getting the "PyObject" of an entity
     mb.member_functions('GetPySelf').exclude()
     
     ihandleentity = mb.class_('IHandleEntity')
     
     # All return values derived from IHandleEntity entity will be returned by value.
     # This ensures the converter is called
     testinherit = MatcherTestInheritClass(ihandleentity)
     decls = mb.calldefs(matchers.custom_matcher_t(testinherit))
     decls.call_policies = call_policies.return_value_policy(call_policies.return_by_value)
     
     # All CBaseEntity related classes should have a custom call trait
     self.baseentcls = mb.class_('CBaseEntity' if self.isserver else 'C_BaseEntity')
     def ent_call_trait(type_):
         return '%(arg)s ? %(arg)s->GetPyHandle() : boost::python::object()'
     entclasses = mb.classes(self.TestCBaseEntity)
     for entcls in entclasses:
         entcls.custom_call_trait = ent_call_trait
         
     # All functions receiving an IHandleEntity argument should be converted
     def ihandleentity_call_trait(type_):
         return 'PyEntityFromEntityHandle( %(arg)s )'
     ihandleentity.custom_call_trait = ihandleentity_call_trait
     
     # Anything returning KeyValues should be returned by value so it calls the converter
     keyvalues = mb.class_('KeyValues')
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(declarated_t(keyvalues))), allow_empty=True).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(const_t(declarated_t(keyvalues)))), allow_empty=True).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
     
     # Anything returning a void pointer is excluded by default
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(declarated_t(void_t()))), allow_empty=True).exclude()
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(const_t(declarated_t(void_t())))), allow_empty=True).exclude()
예제 #3
0
파일: scanner.py 프로젝트: iMichka/pygccxml
 def __read_cv_qualified_type(self, attrs):
     if XML_AN_CONST in attrs and XML_AN_VOLATILE in attrs:
         return declarations.volatile_t(
             declarations.const_t(attrs[XML_AN_TYPE]))
     elif XML_AN_CONST in attrs:
         return declarations.const_t(attrs[XML_AN_TYPE])
     elif XML_AN_VOLATILE in attrs:
         return declarations.volatile_t(attrs[XML_AN_TYPE])
     elif XML_AN_RESTRICT in attrs:
         return declarations.restrict_t(attrs[XML_AN_TYPE])
     else:
         assert 0
예제 #4
0
 def __read_cv_qualified_type(self, attrs):
     if XML_AN_CONST in attrs and XML_AN_VOLATILE in attrs:
         return declarations.volatile_t(
             declarations.const_t(attrs[XML_AN_TYPE]))
     elif XML_AN_CONST in attrs:
         return declarations.const_t(attrs[XML_AN_TYPE])
     elif XML_AN_VOLATILE in attrs:
         return declarations.volatile_t(attrs[XML_AN_TYPE])
     elif XML_AN_RESTRICT in attrs:
         return declarations.restrict_t(attrs[XML_AN_TYPE])
     else:
         assert 0
예제 #5
0
 def ParseEditablePanel(self, mb):
     focusnavgroup = mb.class_('FocusNavGroup')
     buildgroup = mb.class_('BuildGroup')
     excludetypes = [
         pointer_t(const_t(declarated_t(focusnavgroup))),
         pointer_t(declarated_t(focusnavgroup)),
         reference_t(declarated_t(focusnavgroup)),
         pointer_t(const_t(declarated_t(buildgroup))),
         pointer_t(declarated_t(buildgroup)),
         reference_t(declarated_t(buildgroup)),
     ]
     mb.calldefs(calldef_withtypes(excludetypes), allow_empty=True).exclude()
     
     mb.mem_funs( 'GetDialogVariables' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
예제 #6
0
 def ParseEditablePanel(self, mb):
     focusnavgroup = mb.class_('FocusNavGroup')
     buildgroup = mb.class_('BuildGroup')
     excludetypes = [
         pointer_t(const_t(declarated_t(focusnavgroup))),
         pointer_t(declarated_t(focusnavgroup)),
         reference_t(declarated_t(focusnavgroup)),
         pointer_t(const_t(declarated_t(buildgroup))),
         pointer_t(declarated_t(buildgroup)),
         reference_t(declarated_t(buildgroup)),
     ]
     mb.calldefs(calldef_withtypes(excludetypes), allow_empty=True).exclude()
     
     mb.mem_funs( 'GetDialogVariables' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
예제 #7
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()
예제 #8
0
 def __init__( self, function ):
     sealed_fun_controller_t.__init__( self, function )
     
     inst_arg_type = declarations.declarated_t( self.function.parent )
     if self.function.has_const:
         inst_arg_type = declarations.const_t( inst_arg_type )
     inst_arg_type = declarations.reference_t( inst_arg_type )
     
     self.__inst_arg = declarations.argument_t( name=self.register_variable_name( 'inst' )
                                                , decl_type=inst_arg_type )
예제 #9
0
 def __init__( self, function ):
     sealed_fun_controller_t.__init__( self, function )
     
     inst_arg_type = declarations.declarated_t( self.function.parent )
     if self.function.has_const:
         inst_arg_type = declarations.const_t( inst_arg_type )
     inst_arg_type = declarations.reference_t( inst_arg_type )
     
     self.__inst_arg = declarations.argument_t( name=self.register_variable_name( 'inst' )
                                                , type=inst_arg_type )
예제 #10
0
    def __call__( self, calldef, hint=None ):
        if not isinstance( calldef, declarations.calldef_t ):
            return None

        if isinstance( calldef, declarations.constructor_t ):
            return None
        return_type = declarations.remove_alias( calldef.return_type )
        void_ptr = declarations.pointer_t( declarations.void_t() )
        const_void_ptr = declarations.pointer_t( declarations.const_t( declarations.void_t() ) )
        if declarations.is_same( return_type, void_ptr ) \
           or declarations.is_same( return_type, const_void_ptr ):
            return decl_wrappers.return_value_policy( decl_wrappers.return_opaque_pointer )
        return None
예제 #11
0
    def __call__( self, calldef, hint=None ):
        if not isinstance( calldef, declarations.calldef_t ):
            return None

        if isinstance( calldef, declarations.constructor_t ):
            return None
        return_type = declarations.remove_alias( calldef.return_type )
        void_ptr = declarations.pointer_t( declarations.void_t() )
        const_void_ptr = declarations.pointer_t( declarations.const_t( declarations.void_t() ) )
        if declarations.is_same( return_type, void_ptr ) \
           or declarations.is_same( return_type, const_void_ptr ):
            return decl_wrappers.return_value_policy( decl_wrappers.return_opaque_pointer )
        return None
예제 #12
0
    def customize(self, mb):
        mb.global_ns.exclude()

        mb.free_function('create_randome_rationals').include()

        xxx = mb.class_('XXX')
        xxx.include()
        xxx_ref = declarations.reference_t(
            declarations.const_t(declarations.declarated_t(xxx)))
        oper = mb.global_ns.free_operator('<<', arg_types=[None, xxx_ref])
        oper.include()

        mb.class_('YYY').include()

        rational = mb.class_('rational<long>')
        rational.include()
        rational.alias = "pyrational"

        #Test query api.
        #artificial declarations come back
        #rational.operator( '=' )
        #rational.operator( name='operator=' )
        #rational.operator( symbol='=' )
        rational.operators('=')
        rational.operators(name='operator=')
        rational.operators(symbol='=')
        #artificial declarations come back
        #rational.member_operator( '=' )
        #rational.member_operator( name='operator=' )
        #rational.member_operator( symbol='=' )
        rational.member_operators('=')
        rational.member_operators(name='operator=')
        rational.member_operators(symbol='=')
        mb.global_ns.free_operators('<<')
        mb.global_ns.free_operators(name='operator<<')
        mb.global_ns.free_operators(symbol='<<')

        r_assign = rational.calldef('assign', recursive=False)
        r_assign.call_policies = call_policies.return_self()

        foperators = mb.free_operators(
            lambda decl: 'rational<long>' in decl.decl_string)
        foperators.include()

        bad_rational = mb.class_('bad_rational')
        bad_rational.include()
        mb.namespace('Geometry').include()
        mb.namespace('Geometry').class_('VecOfInts').exclude()

        mb.namespace('Geometry2').include()
예제 #13
0
 def wrap_all_osg_referenced_noderive(self, namespace):
     # Identify all classes derived from osg::Referenced, 
     # and set their boost::python held_type to "osg::ref_ptr<class>"
     osg = self.mb.namespace("osg")
     referenced = osg.class_("Referenced")
     referenced_derived = DerivedClasses(referenced)
     referenced_derived.include_module(namespace)
     copyop = osg.class_("CopyOp")
     # We are interested in constructors that take an argument of type "const osg::CopyOp&""
     copyop_arg_t = declarations.reference_t(declarations.const_t(declarations.declarated_t(copyop)))
     for cls in referenced_derived:
         expose_nonoverridable_ref_ptr_class(cls)
         # These copy constructors consistently cause trouble
         for ctor in cls.constructors(arg_types=[None, copyop_arg_t], allow_empty=True):
             ctor.exclude()
예제 #14
0
    def customize( self, mb ):
        mb.global_ns.exclude()

        mb.free_function( 'create_randome_rationals' ).include()

        xxx = mb.class_( 'XXX' )
        xxx.include()
        xxx_ref = declarations.reference_t( declarations.const_t( declarations.declarated_t( xxx ) ) )
        oper = mb.global_ns.free_operator( '<<', arg_types=[None, xxx_ref] )
        oper.include()

        mb.class_( 'YYY' ).include()

        rational = mb.class_('rational<long>')
        rational.include()
        rational.alias = "pyrational"

        #Test query api.
        #artificial declarations come back
        #rational.operator( '=' )
        #rational.operator( name='operator=' )
        #rational.operator( symbol='=' )
        rational.operators( '=' )
        rational.operators( name='operator=' )
        rational.operators( symbol='=' )
        #artificial declarations come back
        #rational.member_operator( '=' )
        #rational.member_operator( name='operator=' )
        #rational.member_operator( symbol='=' )
        rational.member_operators( '=' )
        rational.member_operators( name='operator=' )
        rational.member_operators( symbol='=' )
        mb.global_ns.free_operators( '<<' )
        mb.global_ns.free_operators( name='operator<<' )
        mb.global_ns.free_operators( symbol='<<' )

        r_assign = rational.calldef( 'assign', recursive=False )
        r_assign.call_policies = call_policies.return_self()

        foperators = mb.free_operators( lambda decl: 'rational<long>' in decl.decl_string )
        foperators.include()

        bad_rational = mb.class_('bad_rational' )
        bad_rational.include()
        mb.namespace( 'Geometry' ).include()
        mb.namespace( 'Geometry' ).class_( 'VecOfInts' ).exclude()

        mb.namespace( 'Geometry2' ).include()
예제 #15
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()
예제 #16
0
 def wrap_all_osg_referenced_noderive(self, namespace):
     # Identify all classes derived from osg::Referenced,
     # and set their boost::python held_type to "osg::ref_ptr<class>"
     osg = self.mb.namespace("osg")
     referenced = osg.class_("Referenced")
     referenced_derived = DerivedClasses(referenced)
     referenced_derived.include_module(namespace)
     copyop = osg.class_("CopyOp")
     # We are interested in constructors that take an argument of type "const osg::CopyOp&""
     copyop_arg_t = declarations.reference_t(
         declarations.const_t(declarations.declarated_t(copyop)))
     for cls in referenced_derived:
         expose_nonoverridable_ref_ptr_class(cls)
         # These copy constructors consistently cause trouble
         for ctor in cls.constructors(arg_types=[None, copyop_arg_t],
                                      allow_empty=True):
             ctor.exclude()
예제 #17
0
    def customize(self, mb):
        mb.global_ns.exclude()

        xxx = mb.class_("XXX")
        xxx.include()
        xxx_ref = declarations.reference_t(declarations.const_t(declarations.declarated_t(xxx)))
        oper = mb.global_ns.free_operator("<<", arg_types=[None, xxx_ref])
        oper.include()

        mb.class_("YYY").include()

        rational = mb.class_("rational<long>")
        rational.include()
        rational.alias = "pyrational"

        # Test query api.
        # artificial declarations come back
        # rational.operator( '=' )
        # rational.operator( name='operator=' )
        # rational.operator( symbol='=' )
        rational.operators("=")
        rational.operators(name="operator=")
        rational.operators(symbol="=")
        # artificial declarations come back
        # rational.member_operator( '=' )
        # rational.member_operator( name='operator=' )
        # rational.member_operator( symbol='=' )
        rational.member_operators("=")
        rational.member_operators(name="operator=")
        rational.member_operators(symbol="=")
        mb.global_ns.free_operators("<<")
        mb.global_ns.free_operators(name="operator<<")
        mb.global_ns.free_operators(symbol="<<")

        r_assign = rational.calldef("assign", recursive=False)
        r_assign.call_policies = call_policies.return_self()

        foperators = mb.free_operators(lambda decl: "rational<long>" in decl.decl_string)
        foperators.include()

        bad_rational = mb.class_("bad_rational")
        bad_rational.include()
예제 #18
0
 def inst_arg_type( self, has_const ):
     inst_arg_type = declarations.declarated_t( self.declaration.parent )
     if has_const:
         inst_arg_type = declarations.const_t(inst_arg_type)
     inst_arg_type = declarations.reference_t(inst_arg_type)
     return inst_arg_type
예제 #19
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()

        # By default include all functions starting with "UTIL_". Rest we will do manually
        mb.free_functions(lambda decl: "UTIL_" in decl.name).include()

        mb.free_function("UTIL_GetModDir").exclude()

        # Exclude and replace
        mb.free_functions("UTIL_TraceLine").include()
        mb.free_functions("UTIL_TraceHull").include()
        mb.free_functions("UTIL_TraceEntity").include()
        mb.free_functions("UTIL_TraceRay").exclude()
        mb.free_functions("UTIL_PyTraceRay").rename("UTIL_TraceRay")
        mb.free_functions("UTIL_PyEntitiesInSphere").rename("UTIL_EntitiesInSphere")
        mb.free_functions("UTIL_PyEntitiesInBox").rename("UTIL_EntitiesInBox")

        mb.free_functions("UTIL_EntitiesAlongRay").exclude()
        mb.free_functions("UTIL_PyEntitiesAlongRay").rename("UTIL_EntitiesAlongRay")

        # Enums
        mb.enum("ShakeCommand_t").include()

        # Call policies
        mb.free_functions("UTIL_PlayerByIndex").call_policies = call_policies.return_value_policy(
            call_policies.return_by_value
        )

        # Exclude
        # Don't care about the following functions
        mb.free_functions("UTIL_LoadFileForMe").exclude()
        mb.free_functions("UTIL_FreeFile").exclude()

        # Exclude for now
        mb.free_functions("UTIL_EntitiesInSphere").exclude()
        mb.free_functions("UTIL_EntitiesInBox").exclude()

        # Add
        mb.free_function("StandardFilterRules").include()
        mb.free_function("PassServerEntityFilter").include()

        # //--------------------------------------------------------------------------------------------------------------------------------
        # Tracing
        cls = mb.class_("CBaseTrace")
        cls.include()
        cls = mb.class_("CGameTrace")
        cls.include()
        cls.rename("trace_t")
        cls.var("m_pEnt").rename("ent")
        cls.var("m_pEnt").getter_call_policies = call_policies.return_value_policy(call_policies.return_by_value)

        cls = mb.class_("PyRay_t")
        cls.include()
        cls.rename("Ray_t")
        cls.vars("m_Start").rename("start")
        cls.vars("m_Delta").rename("delta")
        cls.vars("m_StartOffset").rename("startoffset")
        cls.vars("m_Extents").rename("extents")
        cls.vars("m_IsRay").rename("isray")
        cls.vars("m_IsSwept").rename("isswept")

        # //--------------------------------------------------------------------------------------------------------------------------------
        # Trace Filters
        # By default, it's not possible to override TraceFilter methods
        cls = mb.class_("ITraceFilter")
        cls.include()
        cls.calldefs().exclude()

        tracefilters = [
            "CTraceFilter",
            "CTraceFilterEntitiesOnly",
            "CTraceFilterWorldOnly",
            "CTraceFilterWorldAndPropsOnly",
            "CTraceFilterHitAll",
            "CTraceFilterSimple",
            "CTraceFilterSkipTwoEntities",
            "CTraceFilterSimpleList",
            "CTraceFilterOnlyNPCsAndPlayer",
            "CTraceFilterNoNPCsOrPlayer",
            "CTraceFilterLOS",
            "CTraceFilterSkipClassname",
            "CTraceFilterSkipTwoClassnames",
            "CTraceFilterSimpleClassnameList",
            "CTraceFilterChain",
            "CPyTraceFilterSimple",
            "CTraceFilterOnlyUnitsAndPlayer",
            "CTraceFilterNoUnitsOrPlayer",
            "CTraceFilterIgnoreTeam",
            "CTraceFilterSkipFriendly",
            "CTraceFilterSkipEnemies",
            "CTraceFilterWars",
            "CWarsBulletsFilter",
        ]
        for clsname in tracefilters:
            self.SetupTraceFilter(mb, clsname)

        mb.class_("CTraceFilterSimple").rename("CTraceFilterSimpleInternal")
        mb.class_("CPyTraceFilterSimple").rename("CTraceFilterSimple")

        mb.mem_funs("GetPassEntity").call_policies = call_policies.return_value_policy(call_policies.return_by_value)

        mb.class_("csurface_t").include()

        # //--------------------------------------------------------------------------------------------------------------------------------
        # Collision utils
        mb.free_functions("PyIntersectRayWithTriangle").include()
        mb.free_functions("PyIntersectRayWithTriangle").rename("IntersectRayWithTriangle")
        mb.free_functions("ComputeIntersectionBarycentricCoordinates").include()
        mb.free_functions("IntersectRayWithRay").include()
        mb.free_functions("IntersectRayWithSphere").include()
        mb.free_functions("IntersectInfiniteRayWithSphere").include()
        mb.free_functions("IsSphereIntersectingCone").include()
        mb.free_functions("IntersectRayWithPlane").include()
        mb.free_functions("IntersectRayWithAAPlane").include()
        mb.free_functions("IntersectRayWithBox").include()
        mb.class_("BoxTraceInfo_t").include()
        mb.free_functions("IntersectRayWithBox").include()
        mb.free_functions("IntersectRayWithOBB").include()
        mb.free_functions("IsSphereIntersectingSphere").include()
        if self.settings.branch != "swarm":  # IsBoxIntersectingSphere gives a problem
            mb.free_functions("IsBoxIntersectingSphere").include()
        mb.free_functions("IsBoxIntersectingSphereExtents").include()
        mb.free_functions("IsRayIntersectingSphere").include()
        mb.free_functions("IsCircleIntersectingRectangle").include()
        mb.free_functions("IsOBBIntersectingOBB").include()
        mb.free_functions("IsPointInCone").include()
        mb.free_functions("IntersectTriangleWithPlaneBarycentric").include()
        mb.enum("QuadBarycentricRetval_t").include()
        mb.free_functions("PointInQuadToBarycentric").include()
        mb.free_functions("PointInQuadFromBarycentric").include()
        mb.free_functions("TexCoordInQuadFromBarycentric").include()
        mb.free_functions("ComputePointFromBarycentric").include()
        mb.free_functions("IsRayIntersectingOBB").include()
        mb.free_functions("ComputeSeparatingPlane").include()
        mb.free_functions("IsBoxIntersectingTriangle").include()
        # mb.free_functions('CalcClosestPointOnTriangle').include()
        mb.free_functions("OBBHasFullyContainedIntersectionWithQuad").include()
        mb.free_functions("RayHasFullyContainedIntersectionWithQuad").include()

        vectorcls = mb.class_("Vector")
        excludetypes = [
            declarated_t(vectorcls),
            reference_t(declarated_t(vectorcls)),
            reference_t(const_t(declarated_t(vectorcls))),
        ]
        vectormatcher = calldef_withtypes(excludetypes)
        mb.free_functions("IsBoxIntersectingBox", vectormatcher).include()
        mb.free_functions("IsBoxIntersectingBoxExtents", vectormatcher).include()
        mb.free_functions("IsBoxIntersectingRay", vectormatcher).include()
        mb.free_functions("IsPointInBox", vectormatcher).include()

        # Prediction functions
        mb.free_function("GetSuppressHost").include()
        mb.free_function("GetSuppressHost").call_policies = call_policies.return_value_policy(
            call_policies.return_by_value
        )

        if self.isserver:
            self.ParseServer(mb)
        else:
            self.ParseClient(mb)

        # Finally apply common rules to all includes functions and classes, etc.
        self.ApplyCommonRules(mb)
예제 #20
0
    def ParsePanels(self, mb):
        # Panels
        cls = mb.class_('DeadPanel')
        cls.include()
        cls.mem_funs('NonZero', allow_empty=True).rename('__nonzero__')
        cls.mem_funs('Bool', allow_empty=True).rename('__bool__')
        
        # For each panel sub class we take some default actions
        for cls_name in self.panel_cls_list:
            cls = mb.class_(cls_name)

            # Include everything by default
            cls.include()
            cls.no_init = False
            
            # Be selective about we need to override
            cls.mem_funs().virtuality = 'not virtual' 
            
            #if cls_name not in ['AnimationController', 'Frame', 'ScrollBar', 'CBaseMinimap']:
            #    cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
            
            # By default exclude any subclass. These classes are likely controlled intern by the panel
            if cls.classes(allow_empty=True):
                cls.classes().exclude()
                
            self.AddVGUIConverter(mb, cls_name, self.novguilib, containsabstract=False)
            
            # # Add custom wrappers for functions who take keyvalues as input
            if self.novguilib:
                # No access to source code, so need to add message stuff for python here.
                cls.add_wrapper_code('virtual void OnMessage(const KeyValues *params, VPANEL fromPanel) {\r\n' +
                                     '    if( Panel_DispatchMessage( m_PyMessageMap, params, fromPanel ) )\r\n' +
                                     '        return;\r\n' +
                                     '    Panel::OnMessage(params, fromPanel);\r\n' +
                                     '}\r\n' + \
                                     '\r\n' + \
                                     'void RegMessageMethod( const char *message, boost::python::object method, int numParams=0, \r\n' + \
                                     '       const char *nameFirstParam="", int typeFirstParam=DATATYPE_VOID, \r\n' + \
                                     '       const char *nameSecondParam="", int typeSecondParam=DATATYPE_VOID ) { \r\n' + \
                                     '       py_message_entry_t entry;\r\n' + \
                                     '       entry.method = method;\r\n' + \
                                     '       entry.numParams = numParams;\r\n' + \
                                     '       entry.firstParamName = nameFirstParam;\r\n' + \
                                     '       entry.firstParamSymbol = KeyValuesSystem()->GetSymbolForString(nameFirstParam);\r\n' + \
                                     '       entry.firstParamType = typeFirstParam;\r\n' + \
                                     '       entry.secondParamName = nameSecondParam;\r\n' + \
                                     '       entry.secondParamSymbol = KeyValuesSystem()->GetSymbolForString(nameSecondParam);\r\n' + \
                                     '       entry.secondParamType = typeSecondParam;\r\n' + \
                                     '\r\n' + \
                                     '       GetPyMessageMap().Insert(message, entry);\r\n' + \
                                     '}\r\n' + \
                                     'virtual Panel *GetPanel() { return this; }\r\n'
                                     )
                cls.add_registration_code('def( "RegMessageMethod", &'+cls_name+'_wrapper::RegMessageMethod\r\n' + \
                                               ', ( bp::arg("message"), bp::arg("method"), bp::arg("numParams")=(int)(0), bp::arg("nameFirstParam")="", bp::arg("typeFirstParam")=int(::vgui::DATATYPE_VOID), bp::arg("nameSecondParam")="", bp::arg("typeSecondParam")=int(::vgui::DATATYPE_VOID) ))' )
                                               
                # Add stubs
                cls.add_wrapper_code('virtual void EnableSBuffer( bool bUseBuffer ) { PyPanel::EnableSBuffer( bUseBuffer ); }')
                cls.add_registration_code('def( "EnableSBuffer", &%(cls_name)s_wrapper::EnableSBuffer, bp::arg("bUseBuffer") )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual bool IsSBufferEnabled() { return PyPanel::IsSBufferEnabled(); }')
                cls.add_registration_code('def( "IsSBufferEnabled", &%(cls_name)s_wrapper::IsSBufferEnabled )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual void FlushSBuffer() { PyPanel::FlushSBuffer(); }')
                cls.add_registration_code('def( "FlushSBuffer", &%(cls_name)s_wrapper::FlushSBuffer )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual void SetFlushedByParent( bool bEnabled ) { PyPanel::SetFlushedByParent( bEnabled ); }')
                cls.add_registration_code('def( "SetFlushedByParent", &%(cls_name)s_wrapper::SetFlushedByParent, bp::arg("bEnabled") )' % {'cls_name' : cls_name})
    
        # Tweak Panels
        # Used by converters + special method added in the wrapper
        # Don't include here
        if not self.novguilib:
            mb.mem_funs('GetPySelf').exclude()
            mb.mem_funs('PyDestroyPanel').exclude()
            
        # Exclude message stuff. Maybe look into wrapping this in a nice way
        mb.mem_funs( 'AddToMap' ).exclude()
        mb.mem_funs( 'ChainToMap' ).exclude()
        mb.mem_funs( 'GetMessageMap' ).exclude()
        mb.mem_funs( 'AddToAnimationMap' ).exclude()
        mb.mem_funs( 'ChainToAnimationMap' ).exclude()
        mb.mem_funs( 'GetAnimMap' ).exclude()
        mb.mem_funs( 'KB_AddToMap' ).exclude()
        mb.mem_funs( 'KB_ChainToMap' ).exclude()
        mb.mem_funs( 'KB_AddBoundKey' ).exclude()
        mb.mem_funs( 'GetKBMap' ).exclude()
        mb.mem_funs( lambda decl: 'GetVar_' in decl.name ).exclude()
        
        mb.classes( lambda decl: 'PanelMessageFunc_' in decl.name ).exclude()
        mb.classes( lambda decl: '_Register' in decl.name ).exclude()
        mb.classes( lambda decl: 'PanelAnimationVar_' in decl.name ).exclude()
        mb.vars( lambda decl: '_register' in decl.name ).exclude()
        mb.vars( lambda decl: 'm_Register' in decl.name ).exclude()
        
        # Don't need the following:
        menu = mb.class_('Menu')
        keybindindcontexthandle = mb.enum('KeyBindingContextHandle_t')
        excludetypes = [
            pointer_t(const_t(declarated_t(menu))),
            pointer_t(declarated_t(menu)),
            reference_t(declarated_t(menu)),
            pointer_t(declarated_t(mb.class_('IPanelAnimationPropertyConverter'))),
            declarated_t(keybindindcontexthandle),
        ]
        mb.calldefs(calldef_withtypes(excludetypes), allow_empty=True).exclude()
예제 #21
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude() 
        
        # By default include all functions starting with "UTIL_". Rest we will do manually
        mb.free_functions( lambda decl: 'UTIL_' in decl.name ).include()

        # Exclude and replace
        mb.free_functions('UTIL_TraceLine').include()
        mb.free_functions('UTIL_TraceHull').include()
        mb.free_functions('UTIL_TraceEntity').include()
        mb.free_functions('UTIL_TraceRay').exclude()
        mb.free_functions('UTIL_PyTraceRay').rename('UTIL_TraceRay')     
        mb.free_functions('UTIL_PyEntitiesInSphere').rename('UTIL_EntitiesInSphere')
        mb.free_functions('UTIL_PyEntitiesInBox').rename('UTIL_EntitiesInBox')
        
        mb.free_functions('UTIL_EntitiesAlongRay').exclude()
        mb.free_functions('UTIL_PyEntitiesAlongRay').rename('UTIL_EntitiesAlongRay')

        # Enums
        mb.enum('ShakeCommand_t').include()
        
        # Call policies
        mb.free_functions('UTIL_PlayerByIndex').call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        
        # Exclude
        # Don't care about the following functions
        mb.free_functions('UTIL_LoadFileForMe').exclude()
        mb.free_functions('UTIL_FreeFile').exclude()
        
        # Exclude for now
        mb.free_functions('UTIL_EntitiesInSphere').exclude()
        mb.free_functions('UTIL_EntitiesInBox').exclude()
        
        # Add
        mb.free_function('StandardFilterRules').include()
        mb.free_function('PassServerEntityFilter').include()
        
        # //--------------------------------------------------------------------------------------------------------------------------------
        # Tracing
        cls = mb.class_('CBaseTrace')
        cls.include()
        cls = mb.class_('CGameTrace')
        cls.include()
        cls.rename('trace_t')
        cls.var('m_pEnt').rename('ent')
        cls.var('m_pEnt').getter_call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        
        cls = mb.class_('PyRay_t')
        cls.include()
        cls.rename('Ray_t')
        cls.vars('m_Start').rename('start')
        cls.vars('m_Delta').rename('delta')
        cls.vars('m_StartOffset').rename('startoffset')
        cls.vars('m_Extents').rename('extents')
        cls.vars('m_IsRay').rename('isray')
        cls.vars('m_IsSwept').rename('isswept')
        
        # //--------------------------------------------------------------------------------------------------------------------------------
        # Trace Filters
        # By default, it's not possible to override TraceFilter methods
        cls = mb.class_('ITraceFilter')
        cls.include()
        cls.calldefs().exclude()
        
        tracefilters = [
            'CTraceFilter',
            'CTraceFilterEntitiesOnly',
            'CTraceFilterWorldOnly',
            'CTraceFilterWorldAndPropsOnly',
            'CTraceFilterHitAll',
            'CTraceFilterSimple',
            'CTraceFilterSkipTwoEntities',
            'CTraceFilterSimpleList',
            'CTraceFilterOnlyNPCsAndPlayer',
            'CTraceFilterNoNPCsOrPlayer',
            'CTraceFilterLOS',
            'CTraceFilterSkipClassname',
            'CTraceFilterSkipTwoClassnames',
            'CTraceFilterSimpleClassnameList',
            'CTraceFilterChain',
            'CPyTraceFilterSimple',
        ]
        for clsname in tracefilters:
            self.SetupTraceFilter(mb, clsname)
        
        mb.class_('CTraceFilterSimple').rename('CTraceFilterSimpleInternal')
        mb.class_('CPyTraceFilterSimple').rename('CTraceFilterSimple')
        
        mb.mem_funs('GetPassEntity').call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
        
        mb.class_('csurface_t').include()
        
        # //--------------------------------------------------------------------------------------------------------------------------------
        # Collision utils
        mb.free_functions('PyIntersectRayWithTriangle').include()
        mb.free_functions('PyIntersectRayWithTriangle').rename('IntersectRayWithTriangle')
        mb.free_functions('ComputeIntersectionBarycentricCoordinates').include()
        mb.free_functions('IntersectRayWithRay').include()
        mb.free_functions('IntersectRayWithSphere').include()
        mb.free_functions('IntersectInfiniteRayWithSphere').include()
        mb.free_functions('IsSphereIntersectingCone').include()
        mb.free_functions('IntersectRayWithPlane').include()
        mb.free_functions('IntersectRayWithAAPlane').include()
        mb.free_functions('IntersectRayWithBox').include()
        mb.class_('BoxTraceInfo_t').include()
        mb.free_functions('IntersectRayWithBox').include()
        mb.free_functions('IntersectRayWithOBB').include()
        mb.free_functions('IsSphereIntersectingSphere').include()
        if self.settings.branch != 'swarm': # IsBoxIntersectingSphere gives a problem
            mb.free_functions('IsBoxIntersectingSphere').include()
        mb.free_functions('IsBoxIntersectingSphereExtents').include()
        mb.free_functions('IsRayIntersectingSphere').include()
        mb.free_functions('IsCircleIntersectingRectangle').include()
        mb.free_functions('IsOBBIntersectingOBB').include()
        mb.free_functions('IsPointInCone').include()
        mb.free_functions('IntersectTriangleWithPlaneBarycentric').include()
        mb.enum('QuadBarycentricRetval_t').include()
        mb.free_functions('PointInQuadToBarycentric').include()
        mb.free_functions('PointInQuadFromBarycentric').include()
        mb.free_functions('TexCoordInQuadFromBarycentric').include()
        mb.free_functions('ComputePointFromBarycentric').include()
        mb.free_functions('IsRayIntersectingOBB').include()
        mb.free_functions('ComputeSeparatingPlane').include()
        mb.free_functions('IsBoxIntersectingTriangle').include()
        #mb.free_functions('CalcClosestPointOnTriangle').include()
        mb.free_functions('OBBHasFullyContainedIntersectionWithQuad').include()
        mb.free_functions('RayHasFullyContainedIntersectionWithQuad').include()
        
        vectorcls = mb.class_('Vector')
        excludetypes = [
            declarated_t(vectorcls),
            reference_t(declarated_t(vectorcls)),
            reference_t(const_t(declarated_t(vectorcls))),
        ]
        vectormatcher =  calldef_withtypes( excludetypes )
        mb.free_functions('IsBoxIntersectingBox', vectormatcher).include() 
        mb.free_functions('IsBoxIntersectingBoxExtents', vectormatcher).include()   
        mb.free_functions('IsBoxIntersectingRay', vectormatcher).include()
        mb.free_functions('IsPointInBox', vectormatcher).include()
        
        # Prediction functions
        mb.free_function('GetSuppressHost').include()
        mb.free_function('GetSuppressHost').call_policies = call_policies.return_value_policy( call_policies.return_by_value )
        
        if self.isserver:
            self.ParseServer(mb)
        else:
            self.ParseClient(mb)
      
        # Finally apply common rules to all includes functions and classes, etc.
        self.ApplyCommonRules(mb)
예제 #22
0
 def inst_arg_type(self, has_const):
     inst_arg_type = declarations.declarated_t(self.declaration.parent)
     if has_const:
         inst_arg_type = declarations.const_t(inst_arg_type)
     inst_arg_type = declarations.reference_t(inst_arg_type)
     return inst_arg_type
예제 #23
0
    def Parse(self, mb):
        if self.settings.branch == 'source2013':
            self.steamsdkversion = (1, 30)

        # Exclude everything by default
        mb.decls().exclude()

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(
            matchers.calldef_matcher_t(
                arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude()  # No definition...
        cls.mem_funs('SetFromSteam2String').exclude()  # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude()  # No definition...

        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()

        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()

        # Accessor class client
        mb.add_registration_code(
            "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);"
        )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()

        if self.steamsdkversion > (1, 11):
            cls.mem_fun('SteamHTTP').exclude()
        if self.steamsdkversion > (1, 15):
            cls.mem_fun('SteamScreenshots').exclude()
        if self.steamsdkversion > (1, 20):
            cls.mem_fun('SteamUnifiedMessages').exclude()

        cls.mem_fun(
            'SteamMatchmakingServers').exclude()  # Full python class wrapper

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()
        if self.steamsdkversion > (1, 16):
            cls.mem_fun('SteamAppList').exclude()
            cls.mem_fun('SteamController').exclude()
            cls.mem_fun('SteamMusic').exclude()
            cls.mem_fun('SteamMusicRemote').exclude()
            cls.mem_fun('SteamUGC').exclude()
            cls.mem_fun('SteamHTMLSurface').exclude()

        cls.mem_funs(
            'SteamApps'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamFriends'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUtils'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamMatchmaking'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamMatchmakingServers'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUser'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUserStats'
        ).call_policies = call_policies.return_internal_reference()

        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;"
        )
        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;"
        )

        self.ParseSteamApps(mb)
        self.ParseSteamFriends(mb)

        # User
        cls = mb.class_('ISteamUser')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'

        cls.mem_fun('DecompressVoice').exclude()
        cls.mem_fun('GetAuthSessionTicket').exclude()
        cls.mem_fun('GetEncryptedAppTicket').exclude()
        cls.mem_fun('GetVoice').exclude()
        cls.mem_fun('InitiateGameConnection').exclude()
        cls.mem_fun('RequestEncryptedAppTicket').exclude()
        cls.mem_fun('BeginAuthSession').exclude()

        mb.free_function('PySteamUser_GetAuthSessionTicket').include()
        mb.free_function('PySteamUser_GetAuthSessionTicket').rename(
            'SteamUser_GetAuthSessionTicket')

        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()
        cls.mem_fun('GetAPICallResult').exclude()

        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)

        #mb.class_('ISteamUtils').mem_funs('GetImageSize').add_transformation( FT.output('pnWidth'), FT.output('pnHeight'))
        #mb.class_('ISteamUtils').mem_funs('GetCSERIPPort').add_transformation( FT.output('unIP'), FT.output('usPort'))

        if self.isserver:
            self.ParseServerOnly(mb)
예제 #24
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'))
예제 #25
0
    def ParsePanels(self, mb):
        # Panels
        cls = mb.class_('DeadPanel')
        cls.include()
        cls.mem_funs('NonZero', allow_empty=True).rename('__nonzero__')
        cls.mem_funs('Bool', allow_empty=True).rename('__bool__')
        
        # For each panel sub class we take some default actions
        for cls_name in self.panel_cls_list:
            cls = mb.class_(cls_name)

            # Include everything by default
            cls.include()
            cls.no_init = False
            
            # Be selective about we need to override
            cls.mem_funs().virtuality = 'not virtual' 

            cls.add_fake_base('PyPanel')
            
            wrapperpaint = self.GetWrapper( cls, 'Paint' )
            wrapperpaintbackground = self.GetWrapper( cls, 'PaintBackground' )
            wrapperinvalidatelayout = self.GetWrapper( cls, 'InvalidateLayout' )
            cls.add_wrapper_code(r'''
    virtual void Paint(  ) {
        if( !IsSBufferEnabled() || ShouldRecordSBuffer( m_PaintCallBuffer ) )
        {
            PY_OVERRIDE_CHECK( %(cls_name)s, Paint )
            PY_OVERRIDE_LOG( %(modulename)s, %(cls_name)s, Paint )
            bp::override func_Paint = this->get_override( "Paint" );
            if( func_Paint.ptr() != Py_None )
                try {
                    func_Paint(  );
                } catch(bp::error_already_set &) {
                    PyErr_Print();
                    this->%(cls_name)s::Paint(  );
                }
            else
                this->%(cls_name)s::Paint(  );
                
            FinishRecordSBuffer( m_PaintCallBuffer );
 
        }
        else if( IsSBufferEnabled() )
        {
            DrawFromSBuffer( m_PaintCallBuffer );
        }
    }
    
    void default_Paint(  ) {
        %(cls_name)s::Paint( );
    }

    virtual void PaintBackground(  ) {
        if( !IsSBufferEnabled() || ShouldRecordSBuffer( m_PaintBackgroundCallBuffer ) )
        {
            PY_OVERRIDE_CHECK( %(cls_name)s, PaintBackground )
            PY_OVERRIDE_LOG( %(modulename)s, %(cls_name)s, PaintBackground )
            bp::override func_PaintBackground = this->get_override( "PaintBackground" );
            if( func_PaintBackground.ptr() != Py_None )
                try {
                    func_PaintBackground(  );
                } catch(bp::error_already_set &) {
                    PyErr_Print();
                    this->%(pb_cls_name)s::PaintBackground(  );
                }
            else
                this->%(pb_cls_name)s::PaintBackground(  );
                
            FinishRecordSBuffer( m_PaintBackgroundCallBuffer );
        }
        else if( IsSBufferEnabled() )
        {
            DrawFromSBuffer( m_PaintBackgroundCallBuffer );
        }
    }
    
    void default_PaintBackground(  ) {
        %(pb_cls_name)s::PaintBackground( );
    }
    
    virtual void InvalidateLayout( bool layoutNow=false, bool reloadScheme=false ) {
        FlushSBuffer();
        
        PY_OVERRIDE_CHECK( %(cls_name)s, InvalidateLayout )
        PY_OVERRIDE_LOG( %(modulename)s, %(cls_name)s, InvalidateLayout )
        bp::override func_InvalidateLayout = this->get_override( "InvalidateLayout" );
        if( func_InvalidateLayout.ptr() != Py_None )
            try {
                func_InvalidateLayout( layoutNow, reloadScheme );
            } catch(bp::error_already_set &) {
                PyErr_Print();
                this->%(il_cls_name)s::InvalidateLayout( layoutNow, reloadScheme );
            }
        else
            this->%(il_cls_name)s::InvalidateLayout( layoutNow, reloadScheme );
    }
    
    void default_InvalidateLayout( bool layoutNow=false, bool reloadScheme=false ) {
        FlushSBuffer();
        %(il_cls_name)s::InvalidateLayout( layoutNow, reloadScheme );
    }
    ''' %   {   'cls_name' : wrapperpaint.wrapped_class_identifier(),
                'pb_cls_name' : wrapperpaintbackground.wrapped_class_identifier(),
                'il_cls_name' : wrapperinvalidatelayout.wrapped_class_identifier(),
                'modulename' : self.module_name,
            })
            
            cls.add_registration_code(r'''
{ //::vgui::%(cls_name)s::Paint

        typedef void ( ::vgui::Panel::*Paint_function_type )(  ) ;
        typedef void ( %(cls_name)s_wrapper::*default_Paint_function_type )(  ) ;
        
        %(cls_name)s_exposer.def( 
            "Paint"
            , Paint_function_type(&::vgui::Panel::Paint)
            , default_Paint_function_type(&%(cls_name)s_wrapper::default_Paint) );

    }
    { //::vgui::%(cls_name)s::PaintBackground

        typedef void ( ::vgui::Panel::*PaintBackground_function_type )(  ) ;
        typedef void ( %(cls_name)s_wrapper::*default_PaintBackground_function_type )(  ) ;
        
        %(cls_name)s_exposer.def( 
            "PaintBackground"
            , PaintBackground_function_type(&::vgui::Panel::PaintBackground)
            , default_PaintBackground_function_type(&%(cls_name)s_wrapper::default_PaintBackground) );
    
    }
    { //::vgui::%(cls_name)s::InvalidateLayout
    
        typedef void ( ::vgui::Panel::*InvalidateLayout_function_type )( bool,bool ) ;
        typedef void ( %(cls_name)s_wrapper::*default_InvalidateLayout_function_type )( bool,bool ) ;
        
        %(cls_name)s_exposer.def( 
            "InvalidateLayout"
            , InvalidateLayout_function_type(&::vgui::Panel::InvalidateLayout)
            , default_InvalidateLayout_function_type(&%(cls_name)s_wrapper::default_InvalidateLayout)
            , ( bp::arg("layoutNow")=(bool)(false), bp::arg("reloadScheme")=(bool)(false) ) );
    
    }
    ''' % {'cls_name' : cls_name}, False)
            
            # By default exclude any subclass. These classes are likely controlled intern by the panel
            if cls.classes(allow_empty=True):
                cls.classes().exclude()
                
            self.AddVGUIConverter(mb, cls_name, self.novguilib, containsabstract=False)
            
            # # Add custom wrappers for functions who take keyvalues as input
            if self.novguilib:
                # No access to source code, so need to add message stuff for python here.
                cls.add_wrapper_code('virtual void OnMessage(const KeyValues *params, VPANEL fromPanel) {\r\n' +
                                     '    if( Panel_DispatchMessage( m_PyMessageMap, params, fromPanel ) )\r\n' +
                                     '        return;\r\n' +
                                     '    Panel::OnMessage(params, fromPanel);\r\n' +
                                     '}\r\n' + \
                                     '\r\n' + \
                                     'void RegMessageMethod( const char *message, boost::python::object method, int numParams=0, \r\n' + \
                                     '       const char *nameFirstParam="", int typeFirstParam=DATATYPE_VOID, \r\n' + \
                                     '       const char *nameSecondParam="", int typeSecondParam=DATATYPE_VOID ) { \r\n' + \
                                     '       py_message_entry_t entry;\r\n' + \
                                     '       entry.method = method;\r\n' + \
                                     '       entry.numParams = numParams;\r\n' + \
                                     '       entry.firstParamName = nameFirstParam;\r\n' + \
                                     '       entry.firstParamSymbol = KeyValuesSystem()->GetSymbolForString(nameFirstParam);\r\n' + \
                                     '       entry.firstParamType = typeFirstParam;\r\n' + \
                                     '       entry.secondParamName = nameSecondParam;\r\n' + \
                                     '       entry.secondParamSymbol = KeyValuesSystem()->GetSymbolForString(nameSecondParam);\r\n' + \
                                     '       entry.secondParamType = typeSecondParam;\r\n' + \
                                     '\r\n' + \
                                     '       GetPyMessageMap().Insert(message, entry);\r\n' + \
                                     '}\r\n' + \
                                     'virtual Panel *GetPanel() { return this; }\r\n'
                                     )
                cls.add_registration_code('def( "RegMessageMethod", &'+cls_name+'_wrapper::RegMessageMethod\r\n' + \
                                               ', ( bp::arg("message"), bp::arg("method"), bp::arg("numParams")=(int)(0), bp::arg("nameFirstParam")="", bp::arg("typeFirstParam")=int(::vgui::DATATYPE_VOID), bp::arg("nameSecondParam")="", bp::arg("typeSecondParam")=int(::vgui::DATATYPE_VOID) ))' )
                                               
                # Add stubs
                cls.add_wrapper_code('virtual void EnableSBuffer( bool bUseBuffer ) { PyPanel::EnableSBuffer( bUseBuffer ); }')
                cls.add_registration_code('def( "EnableSBuffer", &%(cls_name)s_wrapper::EnableSBuffer, bp::arg("bUseBuffer") )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual bool IsSBufferEnabled() { return PyPanel::IsSBufferEnabled(); }')
                cls.add_registration_code('def( "IsSBufferEnabled", &%(cls_name)s_wrapper::IsSBufferEnabled )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual void FlushSBuffer() { PyPanel::FlushSBuffer(); }')
                cls.add_registration_code('def( "FlushSBuffer", &%(cls_name)s_wrapper::FlushSBuffer )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual void SetFlushedByParent( bool bEnabled ) { PyPanel::SetFlushedByParent( bEnabled ); }')
                cls.add_registration_code('def( "SetFlushedByParent", &%(cls_name)s_wrapper::SetFlushedByParent, bp::arg("bEnabled") )' % {'cls_name' : cls_name})
    
        # Tweak Panels
        # Used by converters + special method added in the wrapper
        # Don't include here
        if not self.novguilib:
            mb.mem_funs('GetPySelf').exclude()
            mb.mem_funs('PyDestroyPanel').exclude()
            
        # Exclude message stuff. Maybe look into wrapping this in a nice way
        mb.mem_funs( 'AddToMap' ).exclude()
        mb.mem_funs( 'ChainToMap' ).exclude()
        mb.mem_funs( 'GetMessageMap' ).exclude()
        mb.mem_funs( 'AddToAnimationMap' ).exclude()
        mb.mem_funs( 'ChainToAnimationMap' ).exclude()
        mb.mem_funs( 'GetAnimMap' ).exclude()
        mb.mem_funs( 'KB_AddToMap' ).exclude()
        mb.mem_funs( 'KB_ChainToMap' ).exclude()
        mb.mem_funs( 'KB_AddBoundKey' ).exclude()
        mb.mem_funs( 'GetKBMap' ).exclude()
        mb.mem_funs( lambda decl: 'GetVar_' in decl.name ).exclude()
        
        mb.classes( lambda decl: 'PanelMessageFunc_' in decl.name ).exclude()
        mb.classes( lambda decl: '_Register' in decl.name ).exclude()
        mb.classes( lambda decl: 'PanelAnimationVar_' in decl.name ).exclude()
        mb.vars( lambda decl: '_register' in decl.name ).exclude()
        mb.vars( lambda decl: 'm_Register' in decl.name ).exclude()
        
        # Don't need the following:
        menu = mb.class_('Menu')
        keybindindcontexthandle = mb.enum('KeyBindingContextHandle_t')
        excludetypes = [
            pointer_t(const_t(declarated_t(menu))),
            pointer_t(declarated_t(menu)),
            reference_t(declarated_t(menu)),
            pointer_t(declarated_t(mb.class_('IPanelAnimationPropertyConverter'))),
            declarated_t(keybindindcontexthandle),
        ]
        mb.calldefs(calldef_withtypes(excludetypes), allow_empty=True).exclude()
예제 #26
0
 def __init__( self ):
     resolver_t.__init__( self )
     self.__const_wchar_pointer \
         = declarations.pointer_t( declarations.const_t( declarations.wchar_t() ) )
예제 #27
0
파일: _te.py 프로젝트: detoxhby/lambdawars
    def ParseClient(self, mb):
        # Don't care
        mb.class_('CEffectData').mem_funs().exclude()
        mb.class_('CEffectData').vars('m_hEntity').exclude()
        
        # Registering new effects
        cls = mb.class_('PyClientEffectRegistration')
        cls.include()
        cls.rename('ClientEffectRegistration')
        cls.vars().exclude()
        
        # Functions to do some effects
        mb.free_functions('FX_AddQuad').include()
        
        # fx.h
        mb.free_functions('FX_RicochetSound').include()
        mb.free_functions('FX_AntlionImpact').include()
        mb.free_functions('FX_DebrisFlecks').include()
        mb.free_functions('FX_Tracer').include()
        mb.free_functions('FX_GunshipTracer').include()
        mb.free_functions('FX_StriderTracer').include()
        mb.free_functions('FX_HunterTracer').include()
        mb.free_functions('FX_PlayerTracer').include()
        #mb.free_functions('FX_BulletPass').include()
        mb.free_functions('FX_MetalSpark').include()
        mb.free_functions('FX_MetalScrape').include()
        mb.free_functions('FX_Sparks').include()
        mb.free_functions('FX_ElectricSpark').include()
        mb.free_functions('FX_BugBlood').include()
        mb.free_functions('FX_Blood').include()
        #mb.free_functions('FX_CreateImpactDust').include()
        mb.free_functions('FX_EnergySplash').include()
        mb.free_functions('FX_MicroExplosion').include()
        mb.free_functions('FX_Explosion').include()
        mb.free_functions('FX_ConcussiveExplosion').include()
        mb.free_functions('FX_DustImpact').include()
        mb.free_functions('FX_MuzzleEffect').include()
        mb.free_functions('FX_MuzzleEffectAttached').include()
        mb.free_functions('FX_StriderMuzzleEffect').include()
        mb.free_functions('FX_GunshipMuzzleEffect').include()
        mb.free_functions('FX_Smoke').include()
        mb.free_functions('FX_Dust').include()
        #mb.free_functions('FX_CreateGaussExplosion').include()
        mb.free_functions('FX_GaussTracer').include()
        mb.free_functions('FX_TracerSound').include()

        # Temp Ents
        cls = mb.class_('CTempEnts')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual' 
        cls.calldefs(matchers.access_type_matcher_t( 'protected' ), allow_empty=True).exclude()
        cls.mem_fun('RicochetSprite').exclude() # Exclude because of model_t

        mb.add_registration_code( 'bp::scope().attr( "tempents" ) = boost::ref(tempents);' )
        
        # C_LocalTempEntity is not exposed and shouldn't be needed (deprecated)
        localtempentity = mb.class_('C_LocalTempEntity')
        excludetypes = [
            pointer_t(declarated_t(localtempentity)),
            pointer_t(const_t(declarated_t(localtempentity))),
        ]
        cls.calldefs(calldef_withtypes(excludetypes), allow_empty=True).exclude()
        
        # Add client effects class (you can only add mesh builders to it)
        cls = mb.class_('PyClientSideEffect')
        cls.include()
        cls.rename('ClientSideEffect')
        cls.mem_funs().virtuality = 'not virtual' 
        cls.mem_funs('AddToEffectList').exclude()
        cls.mem_funs('Draw').virtuality = 'virtual'
        
        mb.free_function('AddToClientEffectList').include()
        
        # Mesh builder
        cls = mb.class_('PyMeshVertex')
        cls.include()
        cls.rename('MeshVertex')
        
        cls.var('m_hEnt').exclude()
        cls.mem_funs('GetEnt').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        self.SetupProperty(cls, 'ent', 'GetEnt', 'SetEnt')
                         
        cls = mb.class_('PyMeshBuilder')
        cls.include()
        cls.rename('MeshBuilder')
        cls.mem_funs().virtuality = 'not virtual' 
        
        cls = mb.class_('PyMeshRallyLine')
        cls.include()
        cls.rename('MeshRallyLine')
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs('GetEnt1').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        cls.mem_funs('GetEnt2').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        self.SetupProperty(cls, 'ent1', 'GetEnt1', 'SetEnt1')
        self.SetupProperty(cls, 'ent2', 'GetEnt2', 'SetEnt2')
        
        mb.enum('MaterialPrimitiveType_t').include()
        
        # FX Envelope + strider fx
        cls = mb.class_('C_EnvelopeFX')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual' 
        
        cls = mb.class_('C_StriderFX')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        
        # Constants
        mb.add_registration_code( "bp::scope().attr( \"FTENT_NONE\" ) = (int)FTENT_NONE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SINEWAVE\" ) = (int)FTENT_SINEWAVE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_GRAVITY\" ) = (int)FTENT_GRAVITY;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_ROTATE\" ) = (int)FTENT_ROTATE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SLOWGRAVITY\" ) = (int)FTENT_SLOWGRAVITY;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SMOKETRAIL\" ) = (int)FTENT_SMOKETRAIL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLIDEWORLD\" ) = (int)FTENT_COLLIDEWORLD;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_FLICKER\" ) = (int)FTENT_FLICKER;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_FADEOUT\" ) = (int)FTENT_FADEOUT;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPRANIMATE\" ) = (int)FTENT_SPRANIMATE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_HITSOUND\" ) = (int)FTENT_HITSOUND;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPIRAL\" ) = (int)FTENT_SPIRAL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPRCYCLE\" ) = (int)FTENT_SPRCYCLE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLIDEALL\" ) = (int)FTENT_COLLIDEALL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_PERSIST\" ) = (int)FTENT_PERSIST;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLIDEKILL\" ) = (int)FTENT_COLLIDEKILL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_PLYRATTACHMENT\" ) = (int)FTENT_PLYRATTACHMENT;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPRANIMATELOOP\" ) = (int)FTENT_SPRANIMATELOOP;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SMOKEGROWANDFADE\" ) = (int)FTENT_SMOKEGROWANDFADE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_ATTACHTOTARGET\" ) = (int)FTENT_ATTACHTOTARGET;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_NOMODEL\" ) = (int)FTENT_NOMODEL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_CLIENTCUSTOM\" ) = (int)FTENT_CLIENTCUSTOM;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_WINDBLOWN\" ) = (int)FTENT_WINDBLOWN;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_NEVERDIE\" ) = (int)FTENT_NEVERDIE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_BEOCCLUDED\" ) = (int)FTENT_BEOCCLUDED;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_CHANGERENDERONCOLLIDE\" ) = (int)FTENT_CHANGERENDERONCOLLIDE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLISIONGROUP\" ) = (int)FTENT_COLLISIONGROUP;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_ALIGNTOMOTION\" ) = (int)FTENT_ALIGNTOMOTION;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_CLIENTSIDEPARTICLES\" ) = (int)FTENT_CLIENTSIDEPARTICLES;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_USEFASTCOLLISIONS\" ) = (int)FTENT_USEFASTCOLLISIONS;" )
예제 #28
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
        
        mb.free_function('QAngleToAngularImpulse').include()
        mb.free_function('AngularImpulseToQAngle').include()
        
        # 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.vars('m').exclude()
        
        cls.mem_fun('As3x4', matchers.calldef_matcher_t(return_type=reference_t(declarated_t(mb.class_('matrix3x4_t'))))).exclude()
        cls.mem_fun('GetTranslation', matchers.calldef_matcher_t(return_type=reference_t(declarated_t(mb.class_('Vector'))))).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') )
        
예제 #29
0
 def wrapped_class_type( self ):
     wrapped_cls_type = declarations.declarated_t( self.declaration.parent )
     if declarations.is_const( self.declaration.type ):
         wrapped_cls_type = declarations.const_t( wrapped_cls_type )
     return declarations.reference_t( wrapped_cls_type )
예제 #30
0
 def _get_class_inst_type(self, add_const):
     inst_arg_type = declarations.declarated_t(self.declaration.parent)
     if add_const:
         inst_arg_type = declarations.const_t(inst_arg_type)
     inst_arg_type = declarations.reference_t(inst_arg_type)
     return inst_arg_type
예제 #31
0
    def ParsePanels(self, mb):
        # Panels
        cls = mb.class_('DeadPanel')
        cls.include()
        cls.mem_funs('NonZero', allow_empty=True).rename('__nonzero__')
        cls.mem_funs('Bool', allow_empty=True).rename('__bool__')
        
        # For each panel sub class we take some default actions
        for cls_name in self.panel_cls_list:
            cls = mb.class_(cls_name)

            # Include everything by default
            cls.include()
            cls.no_init = False
            
            # Be selective about we need to override
            cls.mem_funs().virtuality = 'not virtual' 
            
            #if cls_name not in ['AnimationController', 'Frame', 'ScrollBar', 'CBaseMinimap']:
            #    cls.mem_funs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
            
            # By default exclude any subclass. These classes are likely controlled intern by the panel
            if cls.classes(allow_empty=True):
                cls.classes().exclude()
                
            self.AddVGUIConverter(mb, cls_name, self.novguilib, containsabstract=False)
            
            # # Add custom wrappers for functions who take keyvalues as input
            if self.novguilib:
                # No access to source code, so need to add message stuff for python here.
                cls.add_wrapper_code('virtual void OnMessage(const KeyValues *params, VPANEL fromPanel) {\r\n' +
                                     '    if( Panel_DispatchMessage( m_PyMessageMap, params, fromPanel ) )\r\n' +
                                     '        return;\r\n' +
                                     '    Panel::OnMessage(params, fromPanel);\r\n' +
                                     '}\r\n' + \
                                     '\r\n' + \
                                     'void RegMessageMethod( const char *message, boost::python::object method, int numParams=0, \r\n' + \
                                     '       const char *nameFirstParam="", int typeFirstParam=DATATYPE_VOID, \r\n' + \
                                     '       const char *nameSecondParam="", int typeSecondParam=DATATYPE_VOID ) { \r\n' + \
                                     '       py_message_entry_t entry;\r\n' + \
                                     '       entry.method = method;\r\n' + \
                                     '       entry.numParams = numParams;\r\n' + \
                                     '       entry.firstParamName = nameFirstParam;\r\n' + \
                                     '       entry.firstParamSymbol = KeyValuesSystem()->GetSymbolForString(nameFirstParam);\r\n' + \
                                     '       entry.firstParamType = typeFirstParam;\r\n' + \
                                     '       entry.secondParamName = nameSecondParam;\r\n' + \
                                     '       entry.secondParamSymbol = KeyValuesSystem()->GetSymbolForString(nameSecondParam);\r\n' + \
                                     '       entry.secondParamType = typeSecondParam;\r\n' + \
                                     '\r\n' + \
                                     '       GetPyMessageMap().Insert(message, entry);\r\n' + \
                                     '}\r\n' + \
                                     'virtual Panel *GetPanel() { return this; }\r\n'
                                     )
                cls.add_registration_code('def( "RegMessageMethod", &'+cls_name+'_wrapper::RegMessageMethod\r\n' + \
                                               ', ( bp::arg("message"), bp::arg("method"), bp::arg("numParams")=(int)(0), bp::arg("nameFirstParam")="", bp::arg("typeFirstParam")=int(::vgui::DATATYPE_VOID), bp::arg("nameSecondParam")="", bp::arg("typeSecondParam")=int(::vgui::DATATYPE_VOID) ))' )
                                               
                # Add stubs
                cls.add_wrapper_code('virtual void EnableSBuffer( bool bUseBuffer ) { PyPanel::EnableSBuffer( bUseBuffer ); }')
                cls.add_registration_code('def( "EnableSBuffer", &%(cls_name)s_wrapper::EnableSBuffer, bp::arg("bUseBuffer") )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual bool IsSBufferEnabled() { return PyPanel::IsSBufferEnabled(); }')
                cls.add_registration_code('def( "IsSBufferEnabled", &%(cls_name)s_wrapper::IsSBufferEnabled )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual void FlushSBuffer() { PyPanel::FlushSBuffer(); }')
                cls.add_registration_code('def( "FlushSBuffer", &%(cls_name)s_wrapper::FlushSBuffer )' % {'cls_name' : cls_name})
                cls.add_wrapper_code('virtual void SetFlushedByParent( bool bEnabled ) { PyPanel::SetFlushedByParent( bEnabled ); }')
                cls.add_registration_code('def( "SetFlushedByParent", &%(cls_name)s_wrapper::SetFlushedByParent, bp::arg("bEnabled") )' % {'cls_name' : cls_name})
    
        # Tweak Panels
        # Used by converters + special method added in the wrapper
        # Don't include here
        if not self.novguilib:
            mb.mem_funs('GetPySelf').exclude()
            mb.mem_funs('PyDestroyPanel').exclude()
            
        # Exclude message stuff. Maybe look into wrapping this in a nice way
        mb.mem_funs( 'AddToMap' ).exclude()
        mb.mem_funs( 'ChainToMap' ).exclude()
        mb.mem_funs( 'GetMessageMap' ).exclude()
        mb.mem_funs( 'AddToAnimationMap' ).exclude()
        mb.mem_funs( 'ChainToAnimationMap' ).exclude()
        mb.mem_funs( 'GetAnimMap' ).exclude()
        mb.mem_funs( 'KB_AddToMap' ).exclude()
        mb.mem_funs( 'KB_ChainToMap' ).exclude()
        mb.mem_funs( 'KB_AddBoundKey' ).exclude()
        mb.mem_funs( 'GetKBMap' ).exclude()
        mb.mem_funs( lambda decl: 'GetVar_' in decl.name ).exclude()
        
        mb.classes( lambda decl: 'PanelMessageFunc_' in decl.name ).exclude()
        mb.classes( lambda decl: '_Register' in decl.name ).exclude()
        mb.classes( lambda decl: 'PanelAnimationVar_' in decl.name ).exclude()
        mb.vars( lambda decl: '_register' in decl.name ).exclude()
        mb.vars( lambda decl: 'm_Register' in decl.name ).exclude()
        
        # Don't need the following:
        menu = mb.class_('Menu')
        keybindindcontexthandle = mb.enum('KeyBindingContextHandle_t')
        excludetypes = [
            pointer_t(const_t(declarated_t(menu))),
            pointer_t(declarated_t(menu)),
            reference_t(declarated_t(menu)),
            pointer_t(declarated_t(mb.class_('IPanelAnimationPropertyConverter'))),
            declarated_t(keybindindcontexthandle),
        ]
        mb.calldefs(calldef_withtypes(excludetypes), allow_empty=True).exclude()
예제 #32
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(
            matchers.calldef_matcher_t(
                arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude()  # No definition...
        cls.mem_funs('SetFromSteam2String').exclude()  # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude()  # No definition...

        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()

        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()

        # Accessor class for all
        mb.add_registration_code(
            "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);"
        )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()
        cls.mem_fun('SteamApps').exclude()
        cls.mem_fun('SteamMatchmakingServers').exclude()

        cls.mem_fun('SteamHTTP').exclude()
        cls.mem_fun('SteamScreenshots').exclude()
        cls.mem_fun('SteamUnifiedMessages').exclude()

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()

        cls.mem_funs(
            'SteamFriends'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUtils'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamMatchmaking'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUser'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUserStats'
        ).call_policies = call_policies.return_internal_reference()

        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;"
        )
        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;"
        )

        # Friends
        cls = mb.class_('ISteamFriends')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetFriendGamePlayed').exclude()

        mb.enum('EFriendRelationship').include()
        mb.enum('EPersonaState').include()
        mb.add_registration_code(
            "bp::scope().attr( \"k_cchPersonaNameMax\" ) = (int)k_cchPersonaNameMax;"
        )

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

        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()

        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)
예제 #33
0
    def Parse(self, mb):
        if self.settings.branch == 'source2013':
            self.steamsdkversion = (1, 30)
    
        # Exclude everything by default
        mb.decls().exclude()  

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(matchers.calldef_matcher_t(arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude() # No definition...
        cls.mem_funs('SetFromSteam2String').exclude() # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude() # No definition...
        
        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()
        
        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()
        
        # Accessor class client
        mb.add_registration_code( "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);" )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()
        
        if self.steamsdkversion > (1, 11):
            cls.mem_fun('SteamHTTP').exclude()
        if self.steamsdkversion > (1, 15):
            cls.mem_fun('SteamScreenshots').exclude()
        if self.steamsdkversion > (1, 20):
            cls.mem_fun('SteamUnifiedMessages').exclude()
            
        cls.mem_fun('SteamMatchmakingServers').exclude() # Full python class wrapper

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()
        if self.steamsdkversion > (1, 16):
            cls.mem_fun('SteamAppList').exclude()
            cls.mem_fun('SteamController').exclude()
            cls.mem_fun('SteamMusic').exclude()
            cls.mem_fun('SteamMusicRemote').exclude()
            cls.mem_fun('SteamUGC').exclude() 
            cls.mem_fun('SteamHTMLSurface').exclude()
            
        cls.mem_funs('SteamApps').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamFriends').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUtils').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamMatchmaking').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamMatchmakingServers').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUser').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUserStats').call_policies = call_policies.return_internal_reference()
        
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;" )
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;" )
        
        self.ParseSteamApps(mb)
        self.ParseSteamFriends(mb)
        
        # User
        cls = mb.class_('ISteamUser')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'
        
        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()
        
        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)
        
        #mb.class_('ISteamUtils').mem_funs('GetImageSize').add_transformation( FT.output('pnWidth'), FT.output('pnHeight'))
        #mb.class_('ISteamUtils').mem_funs('GetCSERIPPort').add_transformation( FT.output('unIP'), FT.output('usPort'))
        
        if self.isserver:
            self.ParseServerOnly(mb)
예제 #34
0
 def __init__(self):
     resolver_t.__init__(self)
     self.__const_wchar_pointer \
         = declarations.pointer_t( declarations.const_t( declarations.wchar_t() ) )
예제 #35
0
 def wrapped_class_type(self):
     wrapped_cls_type = declarations.declarated_t(self.declaration.parent)
     if declarations.is_const(self.declaration.type):
         wrapped_cls_type = declarations.const_t(wrapped_cls_type)
     return declarations.reference_t(wrapped_cls_type)
예제 #36
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()  

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(matchers.calldef_matcher_t(arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude()      # No definition...
        cls.mem_funs('SetFromSteam2String').exclude()      # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude()      # No definition...
        
        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()
        
        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()
        
        # Accessor class for all
        mb.add_registration_code( "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);" )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()
        cls.mem_fun('SteamApps').exclude()
        cls.mem_fun('SteamMatchmakingServers').exclude()
        
        cls.mem_fun('SteamHTTP').exclude()
        cls.mem_fun('SteamScreenshots').exclude()
        cls.mem_fun('SteamUnifiedMessages').exclude()

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()
        
        cls.mem_funs('SteamFriends').call_policies = call_policies.return_internal_reference() 
        cls.mem_funs('SteamUtils').call_policies = call_policies.return_internal_reference() 
        cls.mem_funs('SteamMatchmaking').call_policies = call_policies.return_internal_reference() 
        cls.mem_funs('SteamUser').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUserStats').call_policies = call_policies.return_internal_reference()
        
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;" )
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;" )
        
        # Friends
        cls = mb.class_('ISteamFriends')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetFriendGamePlayed').exclude()
        
        mb.enum('EFriendRelationship').include()
        mb.enum('EPersonaState').include()
        mb.add_registration_code( "bp::scope().attr( \"k_cchPersonaNameMax\" ) = (int)k_cchPersonaNameMax;" )
        
        # User
        cls = mb.class_('ISteamUser')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        
        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()
        
        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)
        
        #mb.class_('ISteamUtils').mem_funs('GetImageSize').add_transformation( FT.output('pnWidth'), FT.output('pnHeight'))
        #mb.class_('ISteamUtils').mem_funs('GetCSERIPPort').add_transformation( FT.output('unIP'), FT.output('usPort'))
        
예제 #37
0
    def ParseClient(self, mb):
        # Don't care
        mb.class_('CEffectData').mem_funs().exclude()
        mb.class_('CEffectData').vars('m_hEntity').exclude()
        
        # Registering new effects
        cls = mb.class_('PyClientEffectRegistration')
        cls.include()
        cls.rename('ClientEffectRegistration')
        cls.vars().exclude()
        
        # Functions to do some effects
        mb.free_functions('FX_AddQuad').include()
        
        # fx.h
        mb.free_functions('FX_RicochetSound').include()
        mb.free_functions('FX_AntlionImpact').include()
        mb.free_functions('FX_DebrisFlecks').include()
        mb.free_functions('FX_Tracer').include()
        mb.free_functions('FX_GunshipTracer').include()
        mb.free_functions('FX_StriderTracer').include()
        mb.free_functions('FX_HunterTracer').include()
        mb.free_functions('FX_PlayerTracer').include()
        #mb.free_functions('FX_BulletPass').include()
        mb.free_functions('FX_MetalSpark').include()
        mb.free_functions('FX_MetalScrape').include()
        mb.free_functions('FX_Sparks').include()
        mb.free_functions('FX_ElectricSpark').include()
        mb.free_functions('FX_BugBlood').include()
        mb.free_functions('FX_Blood').include()
        #mb.free_functions('FX_CreateImpactDust').include()
        mb.free_functions('FX_EnergySplash').include()
        mb.free_functions('FX_MicroExplosion').include()
        mb.free_functions('FX_Explosion').include()
        mb.free_functions('FX_ConcussiveExplosion').include()
        mb.free_functions('FX_DustImpact').include()
        mb.free_functions('FX_MuzzleEffect').include()
        mb.free_functions('FX_MuzzleEffectAttached').include()
        mb.free_functions('FX_StriderMuzzleEffect').include()
        mb.free_functions('FX_GunshipMuzzleEffect').include()
        mb.free_functions('FX_Smoke').include()
        mb.free_functions('FX_Dust').include()
        #mb.free_functions('FX_CreateGaussExplosion').include()
        mb.free_functions('FX_GaussTracer').include()
        mb.free_functions('FX_TracerSound').include()

        # Temp Ents
        cls = mb.class_('CTempEnts')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual' 
        cls.calldefs(matchers.access_type_matcher_t( 'protected' ), allow_empty=True).exclude()
        cls.mem_fun('RicochetSprite').exclude() # Exclude because of model_t

        mb.add_registration_code( 'bp::scope().attr( "tempents" ) = boost::ref(tempents);' )
        
        # C_LocalTempEntity is not exposed and shouldn't be needed (deprecated)
        localtempentity = mb.class_('C_LocalTempEntity')
        excludetypes = [
            pointer_t(declarated_t(localtempentity)),
            pointer_t(const_t(declarated_t(localtempentity))),
        ]
        cls.calldefs(calldef_withtypes(excludetypes), allow_empty=True).exclude()
        
        # Add client effects class (you can only add mesh builders to it)
        cls = mb.class_('PyClientSideEffect')
        cls.include()
        cls.rename('ClientSideEffect')
        cls.mem_funs().virtuality = 'not virtual' 
        cls.mem_funs('AddToEffectList').exclude()
        cls.mem_funs('Draw').virtuality = 'virtual'
        
        mb.free_function('AddToClientEffectList').include()
        
        # Mesh builder
        cls = mb.class_('PyMeshVertex')
        cls.include()
        cls.rename('MeshVertex')
        
        cls.var('m_hEnt').exclude()
        cls.mem_funs('GetEnt').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        self.SetupProperty(cls, 'ent', 'GetEnt', 'SetEnt')
                         
        cls = mb.class_('PyMeshBuilder')
        cls.include()
        cls.rename('MeshBuilder')
        cls.mem_funs().virtuality = 'not virtual' 
        
        cls = mb.class_('PyMeshRallyLine')
        cls.include()
        cls.rename('MeshRallyLine')
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_funs('GetEnt1').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        cls.mem_funs('GetEnt2').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        self.SetupProperty(cls, 'ent1', 'GetEnt1', 'SetEnt1')
        self.SetupProperty(cls, 'ent2', 'GetEnt2', 'SetEnt2')
        
        mb.enum('MaterialPrimitiveType_t').include()
        
        # FX Envelope + strider fx
        cls = mb.class_('C_EnvelopeFX')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual' 
        
        #cls = mb.class_('C_StriderFX')
        #cls.include()
        #cls.mem_funs().virtuality = 'not virtual' 
        
        # Constants
        mb.add_registration_code( "bp::scope().attr( \"FTENT_NONE\" ) = (int)FTENT_NONE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SINEWAVE\" ) = (int)FTENT_SINEWAVE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_GRAVITY\" ) = (int)FTENT_GRAVITY;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_ROTATE\" ) = (int)FTENT_ROTATE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SLOWGRAVITY\" ) = (int)FTENT_SLOWGRAVITY;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SMOKETRAIL\" ) = (int)FTENT_SMOKETRAIL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLIDEWORLD\" ) = (int)FTENT_COLLIDEWORLD;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_FLICKER\" ) = (int)FTENT_FLICKER;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_FADEOUT\" ) = (int)FTENT_FADEOUT;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPRANIMATE\" ) = (int)FTENT_SPRANIMATE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_HITSOUND\" ) = (int)FTENT_HITSOUND;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPIRAL\" ) = (int)FTENT_SPIRAL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPRCYCLE\" ) = (int)FTENT_SPRCYCLE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLIDEALL\" ) = (int)FTENT_COLLIDEALL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_PERSIST\" ) = (int)FTENT_PERSIST;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLIDEKILL\" ) = (int)FTENT_COLLIDEKILL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_PLYRATTACHMENT\" ) = (int)FTENT_PLYRATTACHMENT;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SPRANIMATELOOP\" ) = (int)FTENT_SPRANIMATELOOP;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_SMOKEGROWANDFADE\" ) = (int)FTENT_SMOKEGROWANDFADE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_ATTACHTOTARGET\" ) = (int)FTENT_ATTACHTOTARGET;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_NOMODEL\" ) = (int)FTENT_NOMODEL;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_CLIENTCUSTOM\" ) = (int)FTENT_CLIENTCUSTOM;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_WINDBLOWN\" ) = (int)FTENT_WINDBLOWN;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_NEVERDIE\" ) = (int)FTENT_NEVERDIE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_BEOCCLUDED\" ) = (int)FTENT_BEOCCLUDED;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_CHANGERENDERONCOLLIDE\" ) = (int)FTENT_CHANGERENDERONCOLLIDE;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_COLLISIONGROUP\" ) = (int)FTENT_COLLISIONGROUP;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_ALIGNTOMOTION\" ) = (int)FTENT_ALIGNTOMOTION;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_CLIENTSIDEPARTICLES\" ) = (int)FTENT_CLIENTSIDEPARTICLES;" )
        mb.add_registration_code( "bp::scope().attr( \"FTENT_USEFASTCOLLISIONS\" ) = (int)FTENT_USEFASTCOLLISIONS;" )
예제 #38
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude() 
        
        # By default include all functions starting with "UTIL_". Rest we will do manually
        mb.free_functions( lambda decl: 'UTIL_' in decl.name ).include()

        # Exclude and replace
        mb.free_functions('UTIL_TraceLine').include()
        mb.free_functions('UTIL_TraceHull').include()
        mb.free_functions('UTIL_TraceEntity').include()
        mb.free_functions('UTIL_TraceRay').exclude()
        mb.free_functions('UTIL_PyTraceRay').rename('UTIL_TraceRay')     
        mb.free_functions('UTIL_PyEntitiesInSphere').rename('UTIL_EntitiesInSphere')
        mb.free_functions('UTIL_PyEntitiesInBox').rename('UTIL_EntitiesInBox')
        
        mb.free_functions('UTIL_EntitiesAlongRay').exclude()
        mb.free_functions('UTIL_PyEntitiesAlongRay').rename('UTIL_EntitiesAlongRay')

        # Enums
        mb.enum('ShakeCommand_t').include()
        
        # Call policies
        mb.free_functions('UTIL_PlayerByIndex').call_policies = call_policies.return_value_policy( call_policies.return_by_value ) 
        
        # Exclude
        # Don't care about the following functions
        mb.free_functions('UTIL_LoadFileForMe').exclude()
        mb.free_functions('UTIL_FreeFile').exclude()
        
        # Exclude for now
        mb.free_functions('UTIL_EntitiesInSphere').exclude()
        mb.free_functions('UTIL_EntitiesInBox').exclude()
        
        # Add
        mb.free_function('StandardFilterRules').include()
        mb.free_function('PassServerEntityFilter').include()
        
        # //--------------------------------------------------------------------------------------------------------------------------------
        # Tracing
        cls = mb.class_('CBaseTrace')
        cls.include()
        cls = mb.class_('CGameTrace')
        cls.include()
        cls.rename('trace_t')
        cls.var('m_pEnt').rename('ent')
        cls.var('m_pEnt').getter_call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        
        cls = mb.class_('PyRay_t')
        cls.include()
        cls.rename('Ray_t')
        cls.vars('m_Start').rename('start')
        cls.vars('m_Delta').rename('delta')
        cls.vars('m_StartOffset').rename('startoffset')
        cls.vars('m_Extents').rename('extents')
        cls.vars('m_IsRay').rename('isray')
        cls.vars('m_IsSwept').rename('isswept')
        
        # //--------------------------------------------------------------------------------------------------------------------------------
        # Trace Filters
        # By default, it's not possible to override TraceFilter methods
        cls = mb.class_('ITraceFilter')
        cls.include()
        cls.calldefs().exclude()
        
        tracefilters = [
            'CTraceFilter',
            'CTraceFilterEntitiesOnly',
            'CTraceFilterWorldOnly',
            'CTraceFilterWorldAndPropsOnly',
            'CTraceFilterHitAll',
            'CTraceFilterSimple',
            'CTraceFilterSkipTwoEntities',
            'CTraceFilterSimpleList',
            'CTraceFilterOnlyNPCsAndPlayer',
            'CTraceFilterNoNPCsOrPlayer',
            'CTraceFilterLOS',
            'CTraceFilterSkipClassname',
            'CTraceFilterSkipTwoClassnames',
            'CTraceFilterSimpleClassnameList',
            'CTraceFilterChain',
            'CPyTraceFilterSimple',
        ]
        for clsname in tracefilters:
            self.SetupTraceFilter(mb, clsname)
        
        mb.class_('CTraceFilterSimple').rename('CTraceFilterSimpleInternal')
        mb.class_('CPyTraceFilterSimple').rename('CTraceFilterSimple')
        
        mb.mem_funs('GetPassEntity').call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
        
        mb.class_('csurface_t').include()
        
        # //--------------------------------------------------------------------------------------------------------------------------------
        # Collision utils
        mb.free_functions('PyIntersectRayWithTriangle').include()
        mb.free_functions('PyIntersectRayWithTriangle').rename('IntersectRayWithTriangle')
        mb.free_functions('ComputeIntersectionBarycentricCoordinates').include()
        mb.free_functions('IntersectRayWithRay').include()
        mb.free_functions('IntersectRayWithSphere').include()
        mb.free_functions('IntersectInfiniteRayWithSphere').include()
        mb.free_functions('IsSphereIntersectingCone').include()
        mb.free_functions('IntersectRayWithPlane').include()
        mb.free_functions('IntersectRayWithAAPlane').include()
        mb.free_functions('IntersectRayWithBox').include()
        mb.class_('BoxTraceInfo_t').include()
        mb.free_functions('IntersectRayWithBox').include()
        mb.free_functions('IntersectRayWithOBB').include()
        mb.free_functions('IsSphereIntersectingSphere').include()
        if self.settings.branch != 'swarm': # IsBoxIntersectingSphere gives a problem
            mb.free_functions('IsBoxIntersectingSphere').include()
        mb.free_functions('IsBoxIntersectingSphereExtents').include()
        mb.free_functions('IsRayIntersectingSphere').include()
        mb.free_functions('IsCircleIntersectingRectangle').include()
        mb.free_functions('IsOBBIntersectingOBB').include()
        mb.free_functions('IsPointInCone').include()
        mb.free_functions('IntersectTriangleWithPlaneBarycentric').include()
        mb.enum('QuadBarycentricRetval_t').include()
        mb.free_functions('PointInQuadToBarycentric').include()
        mb.free_functions('PointInQuadFromBarycentric').include()
        mb.free_functions('TexCoordInQuadFromBarycentric').include()
        mb.free_functions('ComputePointFromBarycentric').include()
        mb.free_functions('IsRayIntersectingOBB').include()
        mb.free_functions('ComputeSeparatingPlane').include()
        mb.free_functions('IsBoxIntersectingTriangle').include()
        #mb.free_functions('CalcClosestPointOnTriangle').include()
        mb.free_functions('OBBHasFullyContainedIntersectionWithQuad').include()
        mb.free_functions('RayHasFullyContainedIntersectionWithQuad').include()
        
        vectorcls = mb.class_('Vector')
        excludetypes = [
            declarated_t(vectorcls),
            reference_t(declarated_t(vectorcls)),
            reference_t(const_t(declarated_t(vectorcls))),
        ]
        vectormatcher =  calldef_withtypes( excludetypes )
        mb.free_functions('IsBoxIntersectingBox', vectormatcher).include() 
        mb.free_functions('IsBoxIntersectingBoxExtents', vectormatcher).include()   
        mb.free_functions('IsBoxIntersectingRay', vectormatcher).include()
        mb.free_functions('IsPointInBox', vectormatcher).include()
        
        # Prediction functions
        mb.free_function('GetSuppressHost').include()
        mb.free_function('GetSuppressHost').call_policies = call_policies.return_value_policy( call_policies.return_by_value )
        
        if self.isserver:
            self.ParseServer(mb)
        else:
            self.ParseClient(mb)
      
        # Finally apply common rules to all includes functions and classes, etc.
        self.ApplyCommonRules(mb)