void bindObjectParameter() { RunTimeTypedClass<ObjectParameter>() .def( "__init__", make_constructor( &objectParameterConstructor, default_call_policies(), ( boost::python::arg_( "name" ), boost::python::arg_( "description" ), boost::python::arg_( "defaultValue" ), boost::python::arg_( "type" ), boost::python::arg_( "presets" ) = boost::python::tuple(), boost::python::arg_( "presetsOnly" ) = false, boost::python::arg_( "userData" ) = object() ) ) ) .def( "__init__", make_constructor( &objectParameterConstructor2, default_call_policies(), ( boost::python::arg_( "name" ), boost::python::arg_( "description" ), boost::python::arg_( "defaultValue" ), boost::python::arg_( "types" ), boost::python::arg_( "presets" ) = boost::python::tuple(), boost::python::arg_( "presetsOnly" ) = false, boost::python::arg_( "userData" ) = object() ) ) ) .def( "validTypes", &validTypes ) .IECOREPYTHON_DEFPARAMETERWRAPPERFNS( ObjectParameter ) ; }
void bindTypedTransformationMatrixData() { RunTimeTypedClass<TypedData< TransformationMatrix< T > > >() .def( "__init__", make_constructor( &construct< TypedData< TransformationMatrix< T > > > ), "Construct with no specified value." ) .def( "__init__", make_constructor( &constructWithValue< TypedData< TransformationMatrix< T > > > ), "Construct with the specified value." ) .add_property( "value", &getValue< TypedData< TransformationMatrix< T > > >, &setValue< TypedData< TransformationMatrix< T > > >, "The value contained by the object.") .def("__cmp__", &cmp< TypedData< TransformationMatrix< T > > > ) .def( "hasBase", &TypedData< TransformationMatrix< T > >::hasBase ).staticmethod( "hasBase" ) ; }
template <class classT> void visit(classT& c) const { c .def("__init__",make_constructor(&Image_indexing_suite::init1)) .def("__init__",make_constructor(&Image_indexing_suite::init2)) .def("__init__",make_constructor(&Image_indexing_suite::init3)) .add_property("W",&IM::W) .add_property("H",&IM::H) .add_property("C",&IM::C) .def("tileC",&IM::tileC) .def_pickle(Image_pickle_suite()) .add_property("__array_interface__", &Image_indexing_suite::array_interface); }
static RunTimeTypedClass<T> bindSimpleData() { TypedDataFromType<T>(); RunTimeTypedClass<T> result; result.def( "__init__", make_constructor( &ConstructHelper<T>::construct ), "Construct with no specified value." ); result.def( "__init__", make_constructor( &constructWithValue<T> ), "Construct with the specified value." ); result.def( "__str__", &str<T> ); result.def( "__repr__", &repr<T> ); result.def( "hasBase", &T::hasBase ).staticmethod( "hasBase" ); result.add_property( "value", &getValue<T>, &setValue<T>, "The value contained by the object."); return result; }
void bindUndoContext() { class_<UndoContext, UndoContextPtr, boost::noncopyable> cls( "_UndoContext", no_init ); // Must bind enum before constructor, because we need to // use an enum value for a default value. scope s( cls ); enum_<UndoContext::State>( "State" ) .value( "Invalid", UndoContext::Invalid ) .value( "Enabled", UndoContext::Enabled ) .value( "Disabled", UndoContext::Disabled ) ; cls.def( "__init__", make_constructor( construct, default_call_policies(), ( boost::python::arg_( "script" ), boost::python::arg_( "state" ) = UndoContext::Enabled, boost::python::arg_( "mergeGroup" ) = "" ) ) ); }
void bindLinkedScene() { IECore::CompoundDataPtr (*linkAttributeData)( const SceneInterface *scene) = &LinkedScene::linkAttributeData; IECore::CompoundDataPtr (*retimedLinkAttributeData)( const SceneInterface *scene, double time) = &LinkedScene::linkAttributeData; RunTimeTypedClass<LinkedScene>() .def( "__init__", make_constructor( &constructor ), "Opens a linked scene file for read or write." ) .def( "__init__", make_constructor( &constructor2 ), "Creates a linked scene to expand links in the given scene file." ) .def( "writeLink", &LinkedScene::writeLink ) .def( "linkAttributeData", linkAttributeData ) .def( "linkAttributeData", retimedLinkAttributeData ).staticmethod( "linkAttributeData" ) .def_readonly("linkAttribute", &LinkedScene::linkAttribute ) .def_readonly("fileNameLinkAttribute", &LinkedScene::fileNameLinkAttribute ) .def_readonly("rootLinkAttribute", &LinkedScene::rootLinkAttribute ) .def_readonly("timeLinkAttribute", &LinkedScene::timeLinkAttribute ) ; }
void bindCompoundFrameList() { RunTimeTypedClass<CompoundFrameList>() .def( init<>() ) .def( "__init__", make_constructor( &constructFromList ) ) .add_property( "frameLists", getFrameLists, setFrameLists ) .def( "__repr__", repr< CompoundFrameList > ) ; }
static void extension_def(Class& cl) { cl .def("__init__", make_constructor(&container_from_object)) .def("append", &base_append) .def("extend", &base_extend) ; }
void bindPathMatcher() { class_<PathMatcher>( "PathMatcher" ) .def( "__init__", make_constructor( constructFromObject ) ) .def( "__init__", make_constructor( constructFromVectorData ) ) .def( init<const PathMatcher &>() ) .def( "init", &initWrapper ) .def( "addPath", (bool (PathMatcher::*)( const std::string & ))&PathMatcher::addPath ) .def( "addPath", &addPathInternedStringVectorData ) .def( "removePath", (bool (PathMatcher::*)( const std::string & ))&PathMatcher::removePath ) .def( "removePath", &removePathInternedStringVectorData ) .def( "clear", &PathMatcher::clear ) .def( "paths", &paths ) .def( "match", (unsigned (PathMatcher ::*)( const std::string & ) const)&PathMatcher::match ) .def( "match", &matchInternedStringVectorData ) .def( self == self ) .def( self != self ) ; }
void mr_dyck_init(bool pn,FILE *rconstraints) { sig_elt s_sig[1] = {{vnc_pos,setif_sort}}; assert(state == mr_dyck_raw); pn_reach = pn; mr_dyckregion = newregion(); mr_all_nodes = new_mr_dyck_node_list(mr_dyckregion); mr_k_hash = make_hash_table(mr_dyckregion, 32, ptr_hash, ptr_eq); mr_o_hash = make_hash_table(mr_dyckregion, 32, ptr_hash, ptr_eq); mr_c_hash = make_hash_table(mr_dyckregion, 32, ptr_hash, ptr_eq); mr_seen_indices = make_hash_table(mr_dyckregion,32,ptr_hash,ptr_eq); mr_s_constructor = make_constructor("s",setif_sort,s_sig,1); mr_p_constructor = make_constructor("p",setif_sort,s_sig,1); mr_n_constructor = make_constructor("n",setif_sort,s_sig,1); mr_start_constructor = make_constructor("start",setif_sort,s_sig,1); #ifdef DEBUG_ERRONEOUS_EDGES mr_erroneous_sources = new_mr_dyck_node_list(mr_dyckregion); #endif #ifdef MINIMIZE_CONSTRAINTS if (rconstraints) { char buf[100]; region scratch = newregion(); relevant_constraints = new_relevant_constraint_list(scratch); printf("Reading relevant constraints\n"); while (fgets(buf,100,rconstraints)) { INT_PTR next_relevant = atoi(buf); assert(next_relevant); // printf("%d\n",next_relevant); relevant_constraint_list_cons(next_relevant, relevant_constraints); } fclose(rconstraints); } #endif state = mr_dyck_inited; }
static void extension_def(Class& cl) { cl .def("__init__", make_constructor(&container_from_object)) .def("append", &base_append) .def("extend", &base_extend) .def("__value_type__", &get_value_type) .staticmethod("__value_type__") ; }
void bindShader() { RunTimeTypedClass<Shader>() .def( init<>() ) .def( init<optional<const std::string &, const std::string &, const CompoundDataMap &> >() ) .def( "__init__", make_constructor( &construct, default_call_policies(), ( boost::python::arg_( "name" )="defaultsurface", boost::python::arg_( "type" )="surface", boost::python::arg_( "parameters" )=0 ) ) ) .add_property( "name", make_function( &Shader::getName, return_value_policy<copy_const_reference>() ), &Shader::setName ) .add_property( "type", make_function( &Shader::getType, return_value_policy<copy_const_reference>() ), &Shader::setType ) .add_property( "parameters", ¶metersData ) ; }
void bindLight() { RunTimeTypedClass<Light>() .def( init<>() ) .def( init<optional<const std::string &, const std::string &, const CompoundDataMap &> >() ) .def( "__init__", make_constructor( &construct, default_call_policies(), ( boost::python::arg_( "name" )="distantlight", boost::python::arg_( "handle" )="", boost::python::arg_( "parameters" )=0 ) ) ) .add_property( "name", make_function( &Light::getName, return_value_policy<copy_const_reference>() ), &Light::setName ) .add_property( "handle", make_function( &Light::getHandle, return_value_policy<copy_const_reference>() ), &Light::setHandle ) .add_property( "parameters", (CompoundDataPtr (Light::*)() )( &Light::parametersData ) ) ; }
static RunTimeTypedClass<GeometricTypedData<T > > bindSimpleGeometricData() { typedef TypedData<T> ParentClass; typedef GeometricTypedData<T> ThisClass; RunTimeTypedClass<ParentClass>(); RunTimeTypedClass<ThisClass> result = bindSimpleData<ThisClass>(); result.def( "__init__", make_constructor( &constructWithValueAndInterpretation<ThisClass> ), "Construct with the specified value and interpretation." ); result.def("getInterpretation", &ThisClass::getInterpretation, "Returns the geometric interpretation of this data."); result.def("setInterpretation", &ThisClass::setInterpretation, "Sets the geometric interpretation of this data."); return result; }
void bindChannelMaskPlug() { IECorePython::RunTimeTypedClass<ChannelMaskPlug>() .def( "__init__", make_constructor( constructChannelMask, default_call_policies(), ( boost::python::arg_( "name" )=Gaffer::GraphComponent::defaultName<ChannelMaskPlug>(), boost::python::arg_( "direction" )=Gaffer::Plug::In, boost::python::arg_( "defaultValue" ), boost::python::arg_( "flags" )=Gaffer::Plug::Default ) ) ) .def( "maskChannels", &maskChannelList ) .def( "removeDuplicateIndices", &removeDuplicates ).staticmethod("removeDuplicateIndices") .def( "channelIndex", &ChannelMaskPlug::channelIndex ).staticmethod("channelIndex") ; }
static constructor get_constructor(int index, mr_edge_kind kind) { hash_table built_constructors = NULL; constructor result = NULL; char name[512]; sig_elt c_sig[1] = {{vnc_pos,setif_sort}}; // Add this index to the list of seen indices if (!hash_table_lookup(mr_seen_indices, (void *)(INT_PTR) index, NULL)) { hash_table_insert(mr_seen_indices, (void *)(INT_PTR) index, (void *)(INT_PTR)index); } switch (kind) { case mr_o: built_constructors = mr_o_hash; snprintf(name, 512, "(_%ld", (long) index); break; case mr_c: built_constructors = mr_c_hash; snprintf(name, 512, ")_%ld", (long) index); break; case mr_k: built_constructors = mr_k_hash; snprintf(name, 512, "K_%ld", (long) index); break; } assert(built_constructors); // Check the hash to see if the constructor has been built yet // If not, build the constructor if (!hash_table_lookup(built_constructors, (void *)(INT_PTR)index, (hash_data *)&result)) { result = make_constructor(name,setif_sort,c_sig,1); // Hash it so that it can be be retrieved later hash_table_insert(built_constructors,(void *)(INT_PTR)index, result); } assert(hash_table_lookup(built_constructors,(void *)(INT_PTR)index, NULL)); assert(result); return result; }
void PyValue::do_export() { class_<Value>("Value") .def("__init__", make_constructor(create)) .def_readwrite("reference", &Value::reference) .def_readwrite("filename", &Value::filename) .def_readwrite("encoder", &Value::encoder) .def_readwrite("checksum", &Value::checksum) .def_readwrite("uncertainty", &Value::uncertainty) .add_property("value", get, set) .add_property("data_type", &Value::type) // Other .def("__str__", &toStr<Value>) .def("__repr__", &toStr<Value>) ; to_python_converter<std::vector<Value>, vector_transmogrify<Value>>(); vector_transmogrify<Value>::register_from_python(); to_python_converter<boost::optional<Value>, option_transmogrify<Value>>(); }
void bindMessageHandler() { def( "msg", (void (*)( MessageHandler::Level, const std::string &, const std::string &))&msg ); object mh = RefCountedClass<MessageHandler, RefCounted, MessageHandlerWrapPtr>( "MessageHandler" ) .def( init<>() ) .def( "handle", pure_virtual( &MessageHandler::handle ) ) .def( "setDefaultHandler", &MessageHandler::setDefaultHandler ) .staticmethod( "setDefaultHandler" ) .def( "getDefaultHandler", &getDefaultHandler ) .staticmethod( "getDefaultHandler" ) .def( "currentHandler", ¤tHandler ) .staticmethod( "currentHandler" ) .def( "output", (void (*)( MessageHandler::Level, const std::string &, const std::string &))&MessageHandler::output ) .staticmethod( "output" ) .def( "levelAsString", MessageHandler::levelAsString ) .staticmethod( "levelAsString" ) .def( "stringAsLevel", MessageHandler::stringAsLevel ) .staticmethod( "stringAsLevel" ) ; RefCountedClass<NullMessageHandler, MessageHandler>( "NullMessageHandler" ) . def( init<>() ) ; RefCountedClass<OStreamMessageHandler, MessageHandler>( "OStreamMessageHandler" ) .def( "cErrHandler", &OStreamMessageHandler::cErrHandler ) .staticmethod( "cErrHandler" ) .def( "cOutHandler", &OStreamMessageHandler::cOutHandler ) .staticmethod( "cOutHandler" ) ; RefCountedClass<CompoundMessageHandler, MessageHandler>( "CompoundMessageHandler" ) .def( init<>() ) .def( "addHandler", &addHandler ) .def( "removeHandler", &removeHandler ) ; RefCountedClass<FilteredMessageHandler, MessageHandler>( "FilteredMessageHandler" ) ; RefCountedClass<LevelFilteredMessageHandler, FilteredMessageHandler>( "LevelFilteredMessageHandler" ) .def( "__init__", make_constructor( &levelFilteredMessageHandlerConstructor ) ) .def( "setLevel", &LevelFilteredMessageHandler::setLevel ) .def( "getLevel", &LevelFilteredMessageHandler::getLevel ) .def( "defaultLevel", &LevelFilteredMessageHandler::defaultLevel ).staticmethod( "defaultLevel" ) ; scope mhS( mh ); enum_<MessageHandler::Level>( "Level" ) .value( "Error", MessageHandler::Error ) .value( "Warning", MessageHandler::Warning ) .value( "Info", MessageHandler::Info ) .value( "Debug", MessageHandler::Debug ) .value( "Invalid", MessageHandler::Invalid ) ; class_<MessageHandler::Scope, boost::noncopyable>( "_Scope", init<MessageHandler *>() ) ; }
//----------------------------------------------------------------------------- DECLARE_SP_MODULE(_bitbuffers) { export_bf_write(_bitbuffers); export_bf_read(_bitbuffers); } //----------------------------------------------------------------------------- // Expose bf_write. //----------------------------------------------------------------------------- void export_bf_write(scope _bitbuffers) { class_<bf_write>("BitBufferWrite", init<void*, int, optional<int> >()) .def("__init__", make_constructor(&BitBufferWriteExt::__init__) ) .def("seek_to_bit", &bf_write::SeekToBit, "Seeks to a specific position." ) .def("write_one_bit", &bf_write::WriteOneBit ) .def("write_one_bit_no_check", &bf_write::WriteOneBitNoCheck )
//----------------------------------------------------------------------------- DECLARE_SP_MODULE(_bitbuffers) { export_bf_write(_bitbuffers); export_bf_read(_bitbuffers); } //----------------------------------------------------------------------------- // Expose bf_write. //----------------------------------------------------------------------------- void export_bf_write(scope _bitbuffers) { class_<bf_write>("BitBufferWrite", no_init) .def("__init__", make_constructor(&BitBufferWriteExt::__init__, default_call_policies()) ) .def("seek_to_bit", &bf_write::SeekToBit, "Seeks to a specific position." ) .def("write_one_bit", &bf_write::WriteOneBit ) .def("write_one_bit_no_check", &bf_write::WriteOneBitNoCheck )
raw_constructor_dispatcher(F f) : f(make_constructor(f)) {}
//--------------------------------------------------------------------------------- DECLARE_SP_MODULE(_keyvalues) { export_keyvalues(_keyvalues); export_keyvalues_types(_keyvalues); export_keyvalues_iter(_keyvalues); } //--------------------------------------------------------------------------------- // Exports KeyValues. //--------------------------------------------------------------------------------- void export_keyvalues(scope _keyvalues) { class_<KeyValues, boost::shared_ptr<KeyValues>, boost::noncopyable>("KeyValues", no_init) .def("__init__", make_constructor(&KeyValuesExt::__init__1)) .def("__init__", make_constructor(&KeyValuesExt::__init__2)) .def("__init__", make_constructor(&KeyValuesExt::__init__3)) .def("__init__", make_constructor(&KeyValuesExt::__init__4)) .def("__init__", make_constructor(&KeyValuesExt::__init__5)) .add_property("name", &KeyValues::GetName, &KeyValues::SetName, "Returns the name of the keyvalues object." ) .add_property("name_symbol", &KeyValues::GetNameSymbol, "Gets the name as a unique integer." )
void export_player_wrapper(scope _players) { class_<PlayerMixin, bases<CBaseEntityWrapper>, boost::noncopyable> _PlayerMixin("PlayerMixin", no_init); _PlayerMixin.def("__init__", make_constructor( &PlayerMixin::__init__, default_call_policies(), args("entity_index") ) ); _PlayerMixin.add_property( "speed", &PlayerMixin::GetSpeed, &PlayerMixin::SetSpeed, "Get/set the player's speed.\n\n" ":rtype: float"); _PlayerMixin.add_property( "is_ducked", &PlayerMixin::GetIsDucked, &PlayerMixin::SetIsDucked, "Return whether the player is ducked.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "is_ducking", &PlayerMixin::GetIsDucking, &PlayerMixin::SetIsDucking, "Return whether the player is duckeding.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "flags", &PlayerMixin::GetFlags, &PlayerMixin::SetFlags, "Get/set the player's flags.\n\n" ":rtype: int"); _PlayerMixin.add_property( "last_weapon", &PlayerMixin::GetLastWeapon, &PlayerMixin::SetLastWeapon, "Get/set the player's last weapon.\n\n" ":rtype: int"); _PlayerMixin.add_property( "observer_target", &PlayerMixin::GetObserverTarget, &PlayerMixin::SetObserverTarget, "Get/set the player's observer target.\n\n" ":rtype: int"); _PlayerMixin.add_property( "deaths", &PlayerMixin::GetDeaths, &PlayerMixin::SetDeaths, "Get/set the player's death count.\n\n" ":rtype: int"); _PlayerMixin.add_property( "kills", &PlayerMixin::GetKills, &PlayerMixin::SetKills, "Get/set the player's kill count.\n\n" ":rtype: int"); _PlayerMixin.add_property( "observer_mode", &PlayerMixin::GetObserverMode, &PlayerMixin::SetObserverMode, "Get/set the player's observer mode.\n\n" ":rtype: int"); _PlayerMixin.add_property( "life_state", &PlayerMixin::GetLifeState, &PlayerMixin::SetLifeState, "Get/set the player's life state.\n\n" ":rtype: int"); _PlayerMixin.add_property( "place", &PlayerMixin::GetPlace, &PlayerMixin::SetPlace, "Get/set the player's current place.\n\n" ":rtype: str"); _PlayerMixin.add_property( "dead", &PlayerMixin::GetDead, &PlayerMixin::SetDead, "Return whether the player is dead.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "fall_velocity", &PlayerMixin::GetFallVelocity, &PlayerMixin::SetFallVelocity, "Get/set the player's fall velocity.\n\n" ":rtype: float"); _PlayerMixin.add_property( "buttons", &PlayerMixin::GetButtons, &PlayerMixin::SetButtons, "Get/set the player's currently pressed buttons.\n\n" ":rtype: float"); _PlayerMixin.add_property( "hidden_huds", &PlayerMixin::GetHiddenHUDs, &PlayerMixin::SetHiddenHUDs, "Get/set the player's hidden HUDs.\n\n" ":rtype: int"); _PlayerMixin.add_property( "draw_view_model", &PlayerMixin::GetDrawViewModel, &PlayerMixin::SetDrawViewModel, "Get/set the player's draw view model.\n\n" ":rtype: int"); _PlayerMixin.add_property( "fov", &PlayerMixin::GetFOV, &PlayerMixin::SetFOV, "Get/set the player's field of view (FOV).\n\n" ":rtype: int"); _PlayerMixin.add_property( "fov_start", &PlayerMixin::GetFOVStart, &PlayerMixin::SetFOVStart, "Get/set the player's field of view (FOV) start.\n\n" ":rtype: int"); _PlayerMixin.add_property( "fov_time", &PlayerMixin::GetFOVTime, &PlayerMixin::SetFOVTime, "Get/set the player's field of view (FOV) time.\n\n" ":rtype: float"); _PlayerMixin.add_property( "default_fov", &PlayerMixin::GetDefaultFOV, &PlayerMixin::SetDefaultFOV, "Get/set the player's default field of view (FOV).\n\n" ":rtype: int"); _PlayerMixin.add_property( "default_fov", &PlayerMixin::GetDefaultFOV, &PlayerMixin::SetDefaultFOV, "Get/set the player's default field of view (FOV).\n\n" ":rtype: int"); _PlayerMixin.add_property( "fov_rate", &PlayerMixin::GetFOVRate, &PlayerMixin::SetFOVRate, "Get/set the player's field of view (FOV) rate.\n\n" ":rtype: float"); _PlayerMixin.add_property( "gun_offset", &PlayerMixin::GetGunOffset, &PlayerMixin::SetGunOffset, "Get/set the player's gun offset.\n\n" ":rtype: Vector"); _PlayerMixin.add_property( "last_hitgroup", &PlayerMixin::GetLastHitgroup, &PlayerMixin::SetLastHitgroup, "Get/set the player's last hitgroup.\n\n" ":rtype: int"); _PlayerMixin.add_property( "active_weapon_handle", &PlayerMixin::GetActiveWeaponHandle, &PlayerMixin::SetActiveWeaponHandle, "Get/set the player's active weapon_handle.\n\n" ":rtype: int"); _PlayerMixin.add_property( "relationship", &PlayerMixin::GetRelationship, &PlayerMixin::SetRelationship, "Get/set the player's relationship.\n\n" ":rtype: str"); _PlayerMixin.add_property( "phys_damage_scale", &PlayerMixin::GetPhysDamageScale, &PlayerMixin::SetPhysDamageScale, "Get/set the player's physical damage scale.\n\n" ":rtype: float"); _PlayerMixin.add_property( "eye_angle", &PlayerMixin::GetEyeAngle, &PlayerMixin::SetEyeAngle, "Get/set the player's eye angle.\n\n" ":rtype: QAngle"); _PlayerMixin.add_property( "view_vector", &PlayerMixin::GetViewVector, &PlayerMixin::SetViewVector, "Get/set the player's view vector.\n\n" ":rtype: Vector"); _PlayerMixin.add_property( "view_angle", &PlayerMixin::GetViewAngle, &PlayerMixin::SetViewAngle, "Get/set the player's view angle.\n\n" ":rtype: QAngle"); _PlayerMixin.add_property( "view_offset", &PlayerMixin::GetViewOffset, &PlayerMixin::SetViewOffset, "Get/set the player's view offset.\n\n" ":rtype: Vector"); // Game specific _PlayerMixin.add_property( "stamina", &PlayerMixin::GetStamina, &PlayerMixin::SetStamina, "Get/set the player's stamina.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: float"); _PlayerMixin.add_property( "shots_fired", &PlayerMixin::GetShotsFired, &PlayerMixin::SetShotsFired, "Get/set the the number of shots fired by the player.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: int"); _PlayerMixin.add_property( "armor", &PlayerMixin::GetArmor, &PlayerMixin::SetArmor, "Get/set the player's armor.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: int"); _PlayerMixin.add_property( "has_defuser", &PlayerMixin::GetHasDefuser, &PlayerMixin::SetHasDefuser, "Get/set whether the player has a defuser.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "has_helmet", &PlayerMixin::GetHasHelmet, &PlayerMixin::SetHasHelmet, "Get/set whether the player has a helmet.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "in_bomb_zone", &PlayerMixin::GetIsInBombZone, &PlayerMixin::SetIsInBombZone, "Get/set whether the player is in a bomb zone.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "in_buy_zone", &PlayerMixin::GetIsInBuyZone, &PlayerMixin::SetIsInBuyZone, "Get/set whether the player is in a buy zone.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "in_rescue_zone", &PlayerMixin::GetIsInHostageRescueZone, &PlayerMixin::SetIsInHostageRescueZone, "Get/set whether the player is in a hostage rescue zone.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "is_defusing", &PlayerMixin::GetIsDefusing, &PlayerMixin::SetIsDefusing, "Get/set whether the player is currently defusing the bomb.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "nightvision_on", &PlayerMixin::GetNightvisionOn, &PlayerMixin::SetNightvisionOn, "Get/set whether the player is currently using nightvision.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: bool"); _PlayerMixin.add_property( "flash_duration", &PlayerMixin::GetFlashDuration, &PlayerMixin::SetFlashDuration, "Get/set the player's flash duration.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: int"); _PlayerMixin.add_property( "flash_alpha", &PlayerMixin::GetFlashAlpha, &PlayerMixin::SetFlashAlpha, "Get/set the player's flash alpha.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: int"); _PlayerMixin.add_property( "cash", &PlayerMixin::GetCash, &PlayerMixin::SetCash, "Get/set the player's cash.\n\n" ".. note:: Only available in CS:GO and CS:S.\n\n" ":rtype: int"); _PlayerMixin.add_property( "player_class", &PlayerMixin::GetPlayerClass, &PlayerMixin::SetPlayerClass, "Get/set the player's player class.\n\n" ":rtype: int"); _PlayerMixin.add_property( "player_state", &PlayerMixin::GetPlayerState, &PlayerMixin::SetPlayerState, "Get/set the player's player state.\n\n" ":rtype: int"); _PlayerMixin.add_property( "ragdoll", &PlayerMixin::GetRagdoll, &PlayerMixin::SetRagdoll, "Get/set the player's ragdoll.\n\n" ":rtype: int"); _PlayerMixin.add_property( "active_devices", &PlayerMixin::GetActiveDevices, &PlayerMixin::SetActiveDevices, "Get/set the player's active devices.\n\n" ".. note:: Only available in HL2.\n\n" ":rtype: int"); _PlayerMixin.add_property( "suit_power_load", &PlayerMixin::GetSuitPowerLoad, &PlayerMixin::SetSuitPowerLoad, "Get/set the player's suit power load.\n\n" ".. note:: Only available in HL2.\n\n" ":rtype: float"); _PlayerMixin.add_property( "desired_player_class", &PlayerMixin::GetDesiredPlayerClass, &PlayerMixin::SetDesiredPlayerClass, "Get/set the player's desired player class.\n\n" ".. note:: Only available in TF2.\n\n" ":rtype: int"); _PlayerMixin ADD_MEM_TOOLS(PlayerMixin); }
//----------------------------------------------------------------------------- // Exports studiohdr_t. //----------------------------------------------------------------------------- void export_model_header(scope _studio) { class_<studiohdr_t, boost::shared_ptr<studiohdr_t>, boost::noncopyable> ModelHeader("ModelHeader", no_init); // Initializer... ModelHeader.def("__init__", make_constructor(&ModelHeaderExt::__init__, default_call_policies(), args("model_name") ) ); // Properties... ModelHeader.def_readwrite("id", &studiohdr_t::id); // Looks like a pointer? ModelHeader.def_readwrite("version", &studiohdr_t::version); ModelHeader.def_readwrite("checksum", &studiohdr_t::checksum); ModelHeader.add_property("name", &studiohdr_t::pszName); ModelHeader.add_property("eye_position", make_getter(&studiohdr_t::eyeposition, reference_existing_object_policy())); ModelHeader.add_property("illumination_center", make_getter(&studiohdr_t::illumposition, reference_existing_object_policy())); ModelHeader.add_property("hull_min", make_getter(&studiohdr_t::hull_min, reference_existing_object_policy())); ModelHeader.add_property("hull_max", make_getter(&studiohdr_t::hull_max, reference_existing_object_policy())); ModelHeader.add_property("view_min", make_getter(&studiohdr_t::view_bbmin, reference_existing_object_policy())); ModelHeader.add_property("view_max", make_getter(&studiohdr_t::view_bbmax, reference_existing_object_policy())); ModelHeader.def_readwrite("flags", &studiohdr_t::flags); ModelHeader.def_readwrite("bones_count", &studiohdr_t::numbones); ModelHeader.def_readwrite("bones_offset", &studiohdr_t::boneindex); ModelHeader.def_readwrite("bone_controllers_count", &studiohdr_t::numbonecontrollers); ModelHeader.def_readwrite("bone_controllers_offset", &studiohdr_t::bonecontrollerindex); ModelHeader.def_readwrite("hitbox_sets_count", &studiohdr_t::numhitboxsets); ModelHeader.def_readwrite("hitbox_sets_offset", &studiohdr_t::hitboxsetindex); ModelHeader.def_readwrite("local_animations_count", &studiohdr_t::numlocalanim); ModelHeader.def_readwrite("animations_offset", &studiohdr_t::localanimindex); ModelHeader.def_readwrite("attachments_count", &studiohdr_t::numlocalattachments); ModelHeader.def_readwrite("local_sequences_count", &studiohdr_t::numlocalseq); ModelHeader.def_readwrite("local_sequence_offset", &studiohdr_t::localseqindex); ModelHeader.def_readwrite("mass", &studiohdr_t::mass); ModelHeader.def_readwrite("contents", &studiohdr_t::contents); // Methods... ModelHeader.def("get_bone", &studiohdr_t::pBone, reference_existing_object_policy()); // ModelHeader.def("remap_sequence_bone", &studiohdr_t::RemapSeqBone); // ModelHeader.def("remap_animation_bone", &studiohdr_t::RemapAnimBone); ModelHeader.def("get_bone_controller", &studiohdr_t::pBonecontroller, reference_existing_object_policy()); ModelHeader.def("get_hitbox_set", &studiohdr_t::pHitboxSet, reference_existing_object_policy()); ModelHeader.def("get_local_animation", &studiohdr_t::pLocalAnimdesc, reference_existing_object_policy()); // ModelHeader.def("has_sequences_available", &studiohdr_t::SequencesAvailable); // ModelHeader.def("get_animation", &studiohdr_t::pAnimdesc, reference_existing_object_policy()); // ModelHeader.def("get_sequences_count", &studiohdr_t::GetNumSeq); // ModelHeader.def("get_sequence", &studiohdr_t::pSeqdesc, reference_existing_object_policy()); // ModelHeader.def("get_activity_list_version", &studiohdr_t::GetActivityListVersion); // ModelHeader.def("set_activity_list_version", &studiohdr_t::SetActivityListVersion); ModelHeader.def("get_attachment", &studiohdr_t::pLocalAttachment, reference_existing_object_policy()); // Special methods... ModelHeader.def("__len__", make_getter(&studiohdr_t::length)); // Add memory tools... ModelHeader ADD_MEM_TOOLS(studiohdr_t); }
//----------------------------------------------------------------------------- // Exports CBaseEntity. //----------------------------------------------------------------------------- void export_base_entity(scope _entity) { class_<CBaseEntityWrapper, boost::shared_ptr<CBaseEntityWrapper>, bases<IServerEntity>, boost::noncopyable> BaseEntity("BaseEntity", no_init); // Initializers... BaseEntity.def("__init__", make_constructor( &CBaseEntityWrapper::__init__, default_call_policies(), args("entity_index") ) ); // Properties... BaseEntity.add_property("server_class", make_function(&CBaseEntityWrapper::GetServerClass, reference_existing_object_policy()), "The ServerClass instance of this entity (read-only)." ); BaseEntity.add_property("datamap", make_function(&CBaseEntityWrapper::GetDataDescMap, reference_existing_object_policy()), "The DataMap instance of this entity (read-only)." ); BaseEntity.add_property("edict", make_function(&CBaseEntityWrapper::GetEdict, reference_existing_object_policy())); BaseEntity.add_property("index", &CBaseEntityWrapper::GetIndex); BaseEntity.add_property("pointer", make_function(&CBaseEntityWrapper::GetPointer)); BaseEntity.add_property("inthandle", &CBaseEntityWrapper::GetIntHandle); // Methods... BaseEntity.def("get_key_value_string", &CBaseEntityWrapper::GetKeyValueString, "Returns the value of the given field name.", args("field_name") ); BaseEntity.def("get_key_value_int", &CBaseEntityWrapper::GetKeyValueInt, "Returns the value of the given field name.", args("field_name") ); BaseEntity.def("get_key_value_float", &CBaseEntityWrapper::GetKeyValueFloat, "Returns the value of the given field name.", args("field_name") ); BaseEntity.def("get_key_value_vector", &CBaseEntityWrapper::GetKeyValueVector, "Returns the value of the given field name.", args("field_name") ); BaseEntity.def("get_key_value_bool", &CBaseEntityWrapper::GetKeyValueBool, "Returns the value of the given field name.", args("field_name") ); BaseEntity.def("get_key_value_color", &CBaseEntityWrapper::GetKeyValueColor, "Returns the value of the given field name.", args("field_name") ); BaseEntity.def("set_key_value_int", &CBaseEntityWrapper::SetKeyValue<int>, "Sets a field to the given value.", args("field_name", "value") ); BaseEntity.def("set_key_value_float", &CBaseEntityWrapper::SetKeyValue<float>, "Sets a field to the given value.", args("field_name", "value") ); BaseEntity.def("set_key_value_string", &CBaseEntityWrapper::SetKeyValue<const char *>, "Sets a field to the given value.", args("field_name", "value") ); BaseEntity.def("set_key_value_vector", &CBaseEntityWrapper::SetKeyValue<Vector>, "Sets a field to the given value.", args("field_name", "value") ); BaseEntity.def("set_key_value_bool", &CBaseEntityWrapper::SetKeyValue<bool>, "Sets a field to the given value.", args("field_name", "value") ); BaseEntity.def("set_key_value_color", &CBaseEntityWrapper::SetKeyValueColor, "Sets a field to the given value.", args("field_name", "value") ); BaseEntity.def("is_player", &CBaseEntityWrapper::IsPlayer, "Return True if the entity is a player." ); // Add memory tools... BaseEntity ADD_MEM_TOOLS(CBaseEntityWrapper); }