14412Fermer14414
bearbecueLe 07/12/2010 à 17:37
//----------------------------------------------------------------------------

// void	CBaseObject::CloneObjects(const TArray<CBaseObject*> &objects, TArray<CBaseObject*> &cloned)
// {
// 	cloned.Clear();
// }

//----------------------------------------------------------------------------
// FIXME: move this elsewhere, or just plainly remove it once we handle pairs in HBOs

KR_BASE_OBJECT_HANDLER_BEGIN(CBaseObjectStringPair)
	KR_BASE_OBJECT_HANDLER_FIELD_PROPERTY(String0, CBaseField::Description(""))
	KR_BASE_OBJECT_HANDLER_FIELD_PROPERTY(String1, CBaseField::Description(""))
KR_BASE_OBJECT_HANDLER_END

CBaseObjectStringPair::CBaseObjectStringPair()
:	KR_BASE_OBJECT_CONSTRUCT(CBaseObjectStringPair)
{
}

//----------------------------------------------------------------------------

HBO_CLASS_DECLARE(CClassName)
	[
		HBO::Properties::Description("Some class")
	]
	.Field(HBO_FIELDNAME(Material), &CClassName::m_MaterialName)	// directly bound to the data
	[
	]
.Category("Metrics")
	.Field(HBO_FIELDNAME(Radius), &CClassName::m_Radius)	// directly bound to the data
	[
		HBO::Properties::ValueConstraint(0.0f, 1.0f),		// ValueConstraint() can take a const _Type &min, const _Type &max
		HBO::Properties::DefaultValue(0.5f),
		HBO::Properties::Description("object radius"),
		HBO::Properties::OnModified(&CClassName::OnRadiusModified)	// etc...
	]
	.Field(HBO_FIELDNAME(Volume), &CClassName::_SetVolumeImpl, &CClassName::_GetVolumeImpl)	// bound to a getter/setter, can be virtual
	[
		HBO::Properties::Description("object volume"),
		HBO::Properties::Constraint(&CClassName::IsValueValidForVolume),	// ValueConstraint() can also take a bool (*)(const _Type &v, _Type &outValidV) (returns false if 'v' had to be transformed to be made valid
		HBO::Properties::VisibleInEditor(&CClassName::IsVolumeVisibleInEditor)
	]
	.Field(HBO_FIELDNAME(Surface), &CClassName::_SetSurfaceImpl, &CClassName::_GetSurfaceImpl)
	[
		HBO::Properties::Description("object surface (no shit!)"),
	]
.DefaultCategory()	// reverts back to the default category. equivalent to '.Category("default")'
	.Field(HBO_FIELDNAME(Visible), &CClassName::IsVisible)	// only bound to a single getter, this will be read-only
	[
	]

// TODO: add the ability to chain custom properties that inherit from a common class that provides a few virtual methods to allow the user-code to be inserted
// within the HBO pipeline...

//----------------------------------------------------------------------------

KR_BASE_OBJECT_CLASS_DECLARE(CClassName)											[ HBO::Properties::Description("Some class") ]
.Category("Metrics")
	.Field(HBO_FIELDNAME(Radius), &CClassName::m_Radius)							[ HBO::Properties::Constraint(0.0f, 1.0f), HBO::Properties::DefaultValue(0.5f), HBO::Properties::Description("object radius"), HBO::Properties::OnModified(&CClassName::OnRadiusModified) ]
	.Field(HBO_FIELDNAME(Volume), &CClassName::SetVolume, &CClassName::GetVolume)	[ HBO::Properties::Description("object radius"), HBO::Properties::Constraint(&CClassName::IsValueValidForVolume), HBO::Properties::VisibleInEditor(&CClassName::IsVolumeVisibleInEditor) ]
.DefaultCategory()
	.Field(HBO_FIELDNAME(Visible), &CClassName::IsVisible)

//----------------------------------------------------------------------------
// a field descriptor contains:


EDIT: mon beau presse papier tout moche sans pre tsss