本文整理汇总了Python中pyplusplus.function_transformers.output函数的典型用法代码示例。如果您正苦于以下问题:Python output函数的具体用法?Python output怎么用?Python output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Parse
def Parse(self, mb):
# Exclude everything by default
mb.decls().exclude()
# Include message functions and rename them
mb.free_function('SrcPyMsg').include()
mb.free_function('SrcPyWarning').include()
mb.free_function('SrcPyDevMsg').include()
mb.free_function('SrcPyMsg').rename('Msg')
mb.free_function('SrcPyWarning').rename('PrintWarning')
mb.free_function('SrcPyDevMsg').rename('DevMsg')
# Include classes for redirecting output (replace stdout and stderr)
mb.class_('SrcPyStdOut').include()
mb.class_('SrcPyStdErr').include()
# Debug logging
mb.free_function('PyCOM_TimestampedLog').include()
mb.free_function('PyCOM_TimestampedLog').rename('COM_TimestampedLog')
# Tick and per frame method register functions
mb.free_function('RegisterTickMethod').include()
mb.free_function('UnregisterTickMethod').include()
mb.free_function('GetRegisteredTickMethods').include()
mb.free_function('IsTickMethodRegistered').include()
mb.free_function('RegisterPerFrameMethod').include()
mb.free_function('UnregisterPerFrameMethod').include()
mb.free_function('GetRegisteredPerFrameMethods').include()
mb.free_function('IsPerFrameMethodRegistered').include()
# Color classes
cls = mb.class_('Color')
cls.include()
cls.mem_funs('GetColor').add_transformation( FT.output('_r'), FT.output('_g'), FT.output('_b'), FT.output('_a') )
cls.mem_opers('=').exclude() # Breaks debug mode and don't really need it
cls = mb.class_('color32_s')
cls.include()
cls.rename('color32')
cls.mem_funs(allow_empty=True).exclude()
if self.settings.branch == 'swarm':
# Used by GetRenderColor in Swarm branch
cls = mb.class_('color24')
cls.include()
# Global Vars Class
mb.class_('CGlobalVarsBase').include()
mb.class_('CGlobalVars').include()
mb.vars('pSaveData').exclude()
# Add converters
mb.add_registration_code( "bp::to_python_converter<\n\tstring_t,\n\tstring_t_to_python_str>();")
mb.add_registration_code( "python_str_to_string_t();" )
mb.add_registration_code( "wchar_t_to_python_str();" )
mb.add_registration_code( "ptr_wchar_t_to_python_str();" )
mb.add_registration_code( "python_str_to_wchar_t();" )
mb.add_registration_code( "#if PY_VERSION_HEX < 0x03000000\n\tpython_unicode_to_ptr_const_wchar_t();\n\t#endif \\ PY_VERSION_HEX" )
示例2: Parse
def Parse(self, mb):
# Exclude everything by default
mb.decls().exclude()
mb.class_('kbutton_t').include()
if self.settings.branch == 'swarm':
mb.class_('kbutton_t').mem_funs('GetPerUser').exclude()
# Include input class
cls = mb.class_('CInput')
cls.include()
cls.mem_funs().virtuality = 'not virtual'
if self.settings.branch == 'swarm':
#mb.mem_funs('FindKey').exclude() # FIXME
mb.mem_funs('FindKey').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
else:
mb.mem_funs('FindKey').call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
mb.mem_funs('GetUserCmd').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) # Can't exclude due being abstract
mb.mem_funs( 'CAM_OrthographicSize' ).add_transformation( FT.output('w'), FT.output('h') )
mb.add_declaration_code( "CInput *wrap_Input()\r\n{\r\n\treturn (CInput *)::input;\r\n}\r\n" )
mb.add_registration_code( 'bp::def( "input", wrap_Input, bp::return_value_policy<bp::reference_existing_object>() );' )
# ButtonCode.
mb.enums('ButtonCode_t').include()
# Remove any protected function
mb.calldefs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
示例3: wrap_viewerbase
def wrap_viewerbase(self):
vb = self.mb.class_("ViewerBase")
vb.constructors().exclude()
vb.noncopyable = True
vb.no_init = True
vb.member_function("getWindows").add_transformation(FT.output("windows"))
vb.member_function("getViews").add_transformation(FT.output("views"))
示例4: ParseClient
def ParseClient(self, mb):
# Free functions that don't start with 'UTIL_'
mb.free_functions('ScreenHeight').include()
mb.free_functions('ScreenWidth').include()
mb.free_functions('GetVectorInScreenSpace').include()
mb.free_functions('GetTargetInScreenSpace').include()
# Main view
mb.free_function('MainViewOrigin').include()
mb.free_function('MainViewAngles').include()
mb.free_function('MainViewForward').include()
mb.free_function('MainViewRight').include()
mb.free_function('MainViewUp').include()
mb.free_function('MainWorldToViewMatrix').include()
# Call policies and excludes
if self.settings.branch == 'swarm':
mb.free_function('UTIL_GetLocalizedKeyString').exclude()
mb.free_function('UTIL_MessageText').exclude()
mb.free_functions('UTIL_EntityFromUserMessageEHandle').call_policies = call_policies.return_value_policy( call_policies.return_by_value )
mb.free_functions('UTIL_PlayerByUserId').call_policies = call_policies.return_value_policy( call_policies.return_by_value )
# Transformations
mb.free_functions( 'GetVectorInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
mb.free_functions( 'GetTargetInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
示例5: ParseISurface
def ParseISurface(self, mb):
cls = mb.class_('CWrapSurface')
cls.include()
cls.rename('ISurface')
mb.free_function('wrapsurface').include()
mb.free_function( 'wrapsurface' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
mb.free_function( 'wrapsurface' ).rename('surface')
mb.enumeration('CursorCode').include()
mb.enumeration('FontDrawType_t').include()
if self.settings.branch == 'swarm':
mb.class_('FontVertex_t').include()
else:
mb.class_('Vertex_t').include()
mb.class_('IntRect').include()
cls.member_functions( 'DrawGetTextPos' ).add_transformation( FT.output('x'), FT.output('y') )
cls.member_functions( 'DrawGetTextureSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
cls.member_functions( 'GetScreenSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
cls.member_functions( 'GetCharABCwide' ).add_transformation( FT.output('a'), FT.output('b'), FT.output('c') )
cls.member_functions( 'GetWorkspaceBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
cls.member_functions( 'GetAbsoluteWindowBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
cls.member_functions( 'GetProportionalBase' ).add_transformation( FT.output('width'), FT.output('height') )
cls.member_functions( 'SurfaceGetCursorPos' ).add_transformation( FT.output('x'), FT.output('y') )
cls.member_functions( 'CreateHTMLWindow' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
cls.member_functions( 'DrawGetTextureMatInfoFactory' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
cls.member_functions( 'GetIconImageForFullPath' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
示例6: ScrollBar
def ScrollBar(self, mb):
mb.mem_funs( 'GetButton' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
mb.mem_funs( 'GetSlider' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
mb.mem_funs( 'GetRange' ).add_transformation( FT.output('min'), FT.output('max') )
# ScrollBarSlider
mb.mem_funs( 'GetNobPos' ).add_transformation( FT.output('min'), FT.output('max') )
示例7: customize
def customize( self, mb ):
mb.class_("Derived2").member_functions("eval_c").exclude()
mb.class_( 'BB' ).include()
do_smth = mb.mem_fun( '::override_bug::AA::do_smth' )
do_smth.add_transformation( FT.output(0), alias='do_smth_a' )
do_smth = mb.mem_fun( '::override_bug::BB::do_smth' )
do_smth.add_transformation( FT.output(0), FT.output(1), alias='do_smth_b' )
mb.class_( 'XX' ).mem_fun( 'do_smth' ).exclude()
示例8: wrap_TriviewControl
def wrap_TriviewControl(self):
tvc = self.mb.class_('TriviewControl')
tvc.include()
# getFocusLocation passes int refs as args for return.
gfl = tvc.member_function('getFocusLocation')
gfl.add_transformation(
FT.output('cx'),
FT.output('cy'),
FT.output('cz') )
fn = tvc.member_function('getTriViewColorDispType')
fn.add_transformation(FT.output('mytype'))
示例9: wrap
def wrap(self):
mb = self.mb
# Wrap everything in the "osg" namespace
osgViewer = mb.namespace("osgViewer")
osgViewer.include()
mb.free_functions(lambda f: f.name.startswith("osgViewer")).include()
wrap_call_policies(self.mb)
# self.wrap_all_osg_referenced_noderive(osgViewer)
self.wrap_all_osg_referenced(osgViewer)
# Avoid infinite recursion runtime error by making some classes
# non-overridable
for cls_name in ["GraphicsWindowEmbedded", "Viewer", ]:
expose_nonoverridable_ref_ptr_class(osgViewer.class_(cls_name))
for cls in mb.classes(lambda c: c.name.endswith("Handler")):
cls.member_functions("handle", allow_empty=True).exclude()
cls.noncopyable = True
self.wrap_viewerbase()
self.wrap_view()
self.wrap_keystone()
self.wrap_screencapturehandler()
# Handles all remaining W1009 warnings.
# execution error W1009: The function takes as argument...
osgViewer.class_("GraphicsWindow").member_function(
"getWindowRectangle").add_transformation(
FT.output("x"),
FT.output("y"),
FT.output("width"),
FT.output("height"))
osgViewer.class_("GraphicsWindow").member_function(
"getSwapGroup").add_transformation(
FT.output("on"),
FT.output("group"),
FT.output("barrier"))
osgViewer.class_("View").member_function(
"getCameraContainingPosition").exclude()
# .add_transformation(FT.output("local_x"), FT.output("local_y"))
osgViewer.class_("DepthPartitionSettings").member_function(
"getDepthRange").add_transformation(
# FT.output("view"),
FT.output("zNear"),
FT.output("zFar"))
hide_nonpublic(mb)
self.mb.build_code_creator(module_name='_osgViewer')
self.mb.split_module(os.path.join(os.path.abspath('.'), 'generated_code'))
# Create a file to indicate completion of wrapping script
open(os.path.join(os.path.abspath('.'), 'generated_code', 'generate_module.stamp'), "w").close()
示例10: ManualTransformations
def ManualTransformations ( mb ):
global_ns = mb.global_ns
main_ns = global_ns # global_ns.namespace( )
def create_output( size ):
return [ ft.output( i ) for i in range( size ) ]
x = main_ns.mem_fun('::Opcode::PlanesCollider::PlanesAABBOverlap')
x.add_transformation(ft.output('out_clip_mask'))
x.documentation = docit ("","Point center, Point extents, , udword in_clip_mask", "out_clip_mask")
x = main_ns.mem_fun('::IceMaths::IndexedTriangle::GetVRefs')
x.add_transformation(ft.output('vref0'),ft.output('vref1'),ft.output('vref2'))
x.documentation = docit ("","ubyte edgenb", "vref0, vref1, vref2")
x = main_ns.mem_fun('::IceCore::Container::FindNext')
x.add_transformation(ft.inout('entry'))
x.documentation = docit ("","container, entry", "entry, mode")
x = main_ns.mem_fun('::IceCore::Container::FindPrev')
x.add_transformation(ft.inout('entry'))
x.documentation = docit ("","container, entry", "entry, mode")
x = main_ns.free_function('::IceCore::Compute3DCoords')
x.add_transformation(ft.output('u'),ft.output('v'),ft.output('w'))
x.documentation = docit ("","i, nbu, nbu_nbv", "u,v,w")
x = main_ns.free_function('::IceCore::Compute2DCoords')
x.add_transformation(ft.output('u'),ft.output('v'))
x.documentation = docit ("","i, nbu", "u,v")
x = main_ns.free_function('::IceCore::Swap')
x.add_transformation(ft.inout('x'),ft.inout('y'))
x.documentation = docit ("","x,y", "x,y")
x = main_ns.free_function('::IceCore::SetLeastNBits')
x.add_transformation(ft.inout('x'))
x.documentation = docit ("","x, n", "x")
x = main_ns.free_function('::IceCore::ZeroLeastSetBit')
x.add_transformation(ft.inout('n'))
x.documentation = docit ("","n", "n")
x = main_ns.free_function('::IceCore::SpreadBits')
x.add_transformation(ft.inout('n'))
x.documentation = docit ("","n", "n")
x = main_ns.free_function('::IceCore::ReverseBits')
x.add_transformation(ft.inout('n'))
x.documentation = docit ("","n", "n")
x = main_ns.mem_fun('::IceMaths::AABB::ComputeOutline')
x.add_transformation(ft.inout('num'))
x = main_ns.mem_fun('::IceMaths::AABB::ComputeBoxArea')
x.add_transformation(ft.inout('num'))
示例11: wrap_quaternion
def wrap_quaternion(self):
quat = self.mb.class_("Quat")
have_getRotate = False # Just wrap one version
for fn in quat.member_functions("getRotate"):
if len(fn.arguments) != 2: # ignore 4-argument versions
fn.exclude()
elif have_getRotate: # only accept the very first 2-argument version
fn.exclude()
else:
# Only expose this one version of getRotate
fn.add_transformation(FT.output("angle"), FT.output("vec"))
# avoid ugly alias
fn.transformations[-1].alias = fn.alias
have_getRotate = True
示例12: Parse
def Parse(self, mb):
# Exclude everything, then add what we need
# Otherwise we get very big source code and dll's
mb.decls().exclude()
mb.free_function('NavMeshAvailable').include()
mb.free_function('NavMeshTestHasArea').include()
mb.free_function('NavMeshGetPathDistance').include()
mb.free_function('NavMeshGetPositionNearestNavArea').include()
mb.free_function('CreateNavArea').include()
mb.free_function('CreateNavAreaByCorners').include()
mb.free_function('DestroyNavArea').include()
mb.free_function('RandomNavAreaPosition').include()
mb.free_function('RandomNavAreaPositionWithin').include()
mb.free_function('DestroyAllNavAreas').include()
mb.free_function('GetActiveNavMesh').include()
mb.free_function('GetEditingCursor').include()
mb.free_function('GetNavAreaAt').include()
mb.free_function('GetNavAreasAtBB').include()
mb.free_function('SplitAreasAtBB').include()
mb.free_function('SetAreasBlocked').include()
mb.free_function('IsAreaBlocked').include()
mb.free_function('IsBBCoveredByNavAreas').include()
mb.free_function('TryMergeSurrounding').include()
mb.free_function('GetHidingSpotsInRadius').include()
mb.free_function('CreateHidingSpot').include()
mb.free_function('CreateHidingSpot').add_transformation( FT.output('navareaid') )
mb.free_function('DestroyHidingSpot').include()
mb.free_function('DestroyHidingSpotByID').include()
示例13: wrap_LocationSimple
def wrap_LocationSimple(self):
cls = self.mb.class_('LocationSimple')
cls.include()
# TODO - use only the float version of getCoord,
# ...and push arguments to return value.
for fn in cls.member_functions('getCoord'):
arg_t = fn.argument_types[0]
if (arg_t.decl_string == "int &"):
# fn.exclude() # don't want the int one
fn_alias = 'getCoordInt'
else:
# want the float one
fn_alias = 'getCoord'
fn.add_transformation(
FT.output('xx'),
FT.output('yy'),
FT.output('zz'),
alias = fn_alias )
示例14: wrap_view
def wrap_view(self):
cls = self.mb.namespace("osgViewer").class_("View")
for ctor in cls.constructors():
ctor.allow_implicit_conversion = False
cls.constructors(arg_types=[None, None]).exclude()
cls.member_functions("computeIntersections").exclude()
# RuntimeWarning: to-Python converter for class osg::ref_ptr<struct View_wrapper> already registered; second conversion method ignored.
expose_nonoverridable_ref_ptr_class(cls)
inner = cls.class_("StereoSlaveCallback")
inner.member_function("updateSlave").exclude() # link error
# 1>..\..\..\..\src\modules\osgViewer\generated_code\View.pypp.cpp(171) : error C2039: 'StereoSlaveCallback_wrapper' : is not a member of 'View_wrapper'
expose_nonoverridable_ref_ptr_class(inner)
# Move output arguments to return value tuple
if False: # TODO - transformation does not seem to work with protected destructor classes
gccp = cls.member_function("getCameraContainingPosition")
gccp.add_transformation(FT.output('local_x'), FT.output('local_y'),)
# Avoid premature destruction of manipulator
# WEIRD movie maker crashes when I use (2, 1) here but not (1, 2)
# BUT also crashes when osg.Camera.setFinalDrawCallback() uses (1, 2) but not (2, 1).
# Whatever
cls.member_function("setCameraManipulator").call_policies = with_custodian_and_ward(1, 2) # not crash
示例15: test
def test(self):
mb = module_builder.module_builder_t(
[ module_builder.create_text_fc( self.CLASS_DEF ) ]
, gccxml_path=autoconfig.gccxml.executable )
mb.namespace( name='::tester' ).include()
x = mb.class_( 'x' )
x.add_registration_code( '//hello world reg' )
x.add_declaration_code( '//hello world decl' )
nested = x.class_( 'x_nested' )
nested.add_declaration_code( '//hello nested decl' )
nested.add_registration_code( '//hello nested reg', False )
mb.calldefs( 'check_overload' ).use_overload_macro = True
mb.calldefs( 'get_opaque' ).call_policies \
= module_builder.call_policies.return_value_policy( module_builder.call_policies.return_opaque_pointer )
mb.class_( 'op_struct' ).exclude()
mb.mem_fun( 'get_rate' ).call_policies \
= module_builder.call_policies.return_value_policy( module_builder.call_policies.return_pointee_value )
mb.mem_fun( 'get_size' ).add_transformation( ft.output(0) )
mb.build_code_creator('x_class_multi')
mb.split_module( autoconfig.build_dir
, [ mb.class_( '::tester::x' ) ]
, on_unused_file_found=lambda fpath: fpath
, use_files_sum_repository=True)