//-----------------------------------------------------------------------------
// Expose DVariant.
//-----------------------------------------------------------------------------
void export_send_prop_variant(scope _props)
{
	class_<DVariant, DVariant *> SendPropVariant("SendPropVariant");

	// Properties...
	SendPropVariant.def_readonly("type", &DVariant::m_Type);

	// Methods...
	SendPropVariant.def("to_string", &DVariant::ToString);

	// Getter methods...
	SendPropVariant.def("get_float", &SendPropVariantExt::get_typed_value<DPT_Float, float, &DVariant::m_Float>);
	SendPropVariant.def("get_int", &SendPropVariantExt::get_int);
	SendPropVariant.def("get_string", &SendPropVariantExt::get_string);
	SendPropVariant.def("get_data", &SendPropVariantExt::get_data, manage_new_object_policy());
	SendPropVariant.def("get_vector", &SendPropVariantExt::get_vector, manage_new_object_policy());

	// Setter methods...
	SendPropVariant.def("set_float", &SendPropVariantExt::get_typed_value<DPT_Float, float, &DVariant::m_Float>);
	SendPropVariant.def("set_string", &SendPropVariantExt::set_string);
	SendPropVariant.def("set_int", &SendPropVariantExt::set_int);
	SendPropVariant.def("set_data", &SendPropVariantExt::set_data);
	SendPropVariant.def("set_vector", &SendPropVariantExt::set_vector);

	// CS:GO specific methods...
	SendPropVariant.NOT_IMPLEMENTED("get_int64");
	SendPropVariant.NOT_IMPLEMENTED("set_int64");

	// Engine specific stuff...
	export_engine_specific_send_prop_variant(_props, SendPropVariant);

	// Add memory tools...
	SendPropVariant ADD_MEM_TOOLS(DVariant);
}
Beispiel #2
0
//-----------------------------------------------------------------------------
// Exports mstudiobone_t.
//-----------------------------------------------------------------------------
void export_bone(scope _studio)
{
    class_<mstudiobone_t, mstudiobone_t *, boost::noncopyable> ModelBone("ModelBone");

    // Properties...
    ModelBone.add_property("name", &ModelBoneExt::get_name);
    ModelBone.def_readwrite("parent", &mstudiobone_t::parent);

    ModelBone.add_property("position", make_getter(&mstudiobone_t::pos, reference_existing_object_policy()));
    ModelBone.add_property("quaternion", make_getter(&mstudiobone_t::quat, reference_existing_object_policy()));
    ModelBone.add_property("radiant_euler", make_getter(&mstudiobone_t::rot, reference_existing_object_policy()));
    ModelBone.add_property("position_scale", make_getter(&mstudiobone_t::posscale, reference_existing_object_policy()));
    ModelBone.add_property("radiant_euler_scale", make_getter(&mstudiobone_t::rotscale, reference_existing_object_policy()));

    ModelBone.add_property("position_to_bone", make_getter(&mstudiobone_t::poseToBone, reference_existing_object_policy())); // TODO: Export matrix3x4_t...

    ModelBone.add_property("alignment", make_getter(&mstudiobone_t::qAlignment, reference_existing_object_policy()));
    ModelBone.add_property("surface_name", &ModelBoneExt::get_surface_name);

    ModelBone.def_readwrite("flags", &mstudiobone_t::flags);
    ModelBone.def_readwrite("procedural_type", &mstudiobone_t::proctype);
    ModelBone.def_readwrite("physics_bone", &mstudiobone_t::physicsbone);
    ModelBone.def_readwrite("flags", &mstudiobone_t::flags);
    ModelBone.def_readwrite("contents", &mstudiobone_t::contents);

    // Methods...
    ModelBone.def("get_procedure", &ModelBoneExt::get_procedure, manage_new_object_policy());

    // Add memory tools...
    ModelBone ADD_MEM_TOOLS(mstudiobone_t);
}
//-----------------------------------------------------------------------------
// Exports IPhysics.
//-----------------------------------------------------------------------------
void export_physics(scope _physics)
{
	class_<IPhysicsWrapper, boost::noncopyable> Physics("Physics", no_init);

	Physics.def(
		"get_active_environment_by_index",
		&IPhysicsWrapper::GetActiveEnvironmentByIndex,
		manage_new_object_policy()
	);

	//Physics ADD_MEM_TOOLS_WRAPPER(IPhysicsWrapper, IPhysics);

	_physics.attr("physics") = object(ptr(Wrap<IPhysicsWrapper>(physics)));
}
//-----------------------------------------------------------------------------
// Exports IPhysicsEnvironment.
//-----------------------------------------------------------------------------
void export_physics_environment(scope _physics)
{
	class_<IPhysicsEnvironmentWrapper, boost::noncopyable> PhysicsEnvironment("PhysicsEnvironment", no_init);

	PhysicsEnvironment.add_property(
		"gravity",
		make_function(&IPhysicsEnvironmentWrapper::GetGravity, manage_new_object_policy()),
		&IPhysicsEnvironmentWrapper::SetGravity
	);

	PhysicsEnvironment.add_property(
		"air_density",
		&IPhysicsEnvironmentWrapper::GetAirDensity,
		&IPhysicsEnvironmentWrapper::SetAirDensity
	);

	PhysicsEnvironment.def(
		"get_active_object_by_index",
		&IPhysicsEnvironmentWrapper::GetActiveObjectByIndex,
		manage_new_object_policy()
	);

	//PhysicsEnvironment ADD_MEM_TOOLS_WRAPPER(IPhysicsEnvironmentWrapper, IPhysicsEnvironment);
}
//-----------------------------------------------------------------------------
// Expose SendProp.
//-----------------------------------------------------------------------------
void export_send_prop(scope _props)
{
	class_<SendProp, SendProp *, boost::noncopyable> SendProp_("SendProp", no_init);
	
	// Properties...
	SendProp_.def_readonly("type", &SendProp::m_Type);
	SendProp_.def_readonly("bits", &SendProp::m_nBits);
	SendProp_.def_readonly("low_value", &SendProp::m_fLowValue);
	SendProp_.def_readonly("high_value", &SendProp::m_fHighValue);
	SendProp_.def_readonly("array_prop", &SendProp::m_pArrayProp);
	SendProp_.def_readonly("length", &SendProp::m_nElements);
	SendProp_.def_readonly("element_stride", &SendProp::m_ElementStride);
	SendProp_.def_readonly("exclude_data_table_name", &SendProp::m_pExcludeDTName);
	SendProp_.def_readonly("parent_array_prop_name", &SendProp::m_pParentArrayPropName);
	SendProp_.add_property("name", &SendProp::GetName);
	SendProp_.def_readonly("high_low_mul", &SendProp::m_fHighLowMul);
	SendProp_.add_property("flags", &SendProp::GetFlags);
	
	SendProp_.add_property("data_table",
		make_function(
			&SendProp::GetDataTable,
			reference_existing_object_policy()
		)
	);
	
	SendProp_.add_property("offset", &SendProp::GetOffset);
	
	// CS:GO specific properties...
	SendProp_.NOT_IMPLEMENTED_ATTR("priority");
	
	// Methods...

	SendProp_.def("is_signed", &SendProp::IsSigned);
	SendProp_.def("is_exclude_prop", &SendProp::IsExcludeProp);
	SendProp_.def("is_inside_array", &SendProp::IsInsideArray);

	SendProp_.def("get_proxy_function", &SendPropSharedExt::get_proxy_function, manage_new_object_policy());

	// CS:GO specific methods...
	SendProp_.NOT_IMPLEMENTED("get_priority");
	
	// Engine specific stuff...
	export_engine_specific_send_prop(_props, SendProp_);
	
	// Add memory tools...
	SendProp_ ADD_MEM_TOOLS(SendProp);
}