本文整理汇总了Python中pygccxml.declarations.const_t函数的典型用法代码示例。如果您正苦于以下问题:Python const_t函数的具体用法?Python const_t怎么用?Python const_t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了const_t函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: ApplyCommonRules
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()
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:33,代码来源:basesource.py
示例2: __read_cv_qualified_type
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
开发者ID:iMichka,项目名称:pygccxml,代码行数:12,代码来源:scanner.py
示例3: ParseEditablePanel
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)
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:14,代码来源:_vguicontrols.py
示例4: __init__
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 )
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:10,代码来源:controllers.py
示例5: __call__
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
开发者ID:alekob,项目名称:tce,代码行数:13,代码来源:call_policies_resolver.py
示例6: wrap_all_osg_referenced_noderive
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()
开发者ID:cmbruns,项目名称:osgpyplusplus,代码行数:15,代码来源:wrap_helpers.py
示例7: customize
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()
开发者ID:asford,项目名称:pyplusplus,代码行数:48,代码来源:operators_tester.py
示例8: customize
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()
开发者ID:venkatarajasekhar,项目名称:tortuga,代码行数:42,代码来源:operators_tester.py
示例9: ParseClient
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')
#.........这里部分代码省略.........
开发者ID:detoxhby,项目名称:lambdawars,代码行数:101,代码来源:_te.py
示例10: Parse
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)
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:99,代码来源:_steam.py
示例11: __init__
def __init__( self ):
resolver_t.__init__( self )
self.__const_wchar_pointer \
= declarations.pointer_t( declarations.const_t( declarations.wchar_t() ) )
开发者ID:alekob,项目名称:tce,代码行数:4,代码来源:call_policies_resolver.py
示例12: wrapped_class_type
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 )
开发者ID:CTrauma,项目名称:pypp11,代码行数:5,代码来源:member_variable.py
示例13: inst_arg_type
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
开发者ID:CTrauma,项目名称:pypp11,代码行数:6,代码来源:member_variable.py
示例14: Parse
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'))
开发者ID:detoxhby,项目名称:lambdawars,代码行数:82,代码来源:_steam.py
示例15: ParsePanels
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'))),
#.........这里部分代码省略.........
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:101,代码来源:_vguicontrols.py
示例16: Parse
#.........这里部分代码省略.........
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)
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:101,代码来源:_utils.py
示例17: ParsePanels
#.........这里部分代码省略.........
, 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()
|
请发表评论