add min max def to properties
This commit is contained in:
@@ -86,13 +86,13 @@ public:
|
||||
m_ShowBoundingBox(false),
|
||||
m_ShowScaleMeasures(false),
|
||||
m_Representation(Puppet::Surface),
|
||||
m_Opacity(-1.0),
|
||||
m_Opacity(1.0),
|
||||
m_Selectable(true),
|
||||
m_Selected(false),
|
||||
m_Visibility(true),
|
||||
m_Dragable(true)
|
||||
{
|
||||
m_Color[0] = m_Color[1] = m_Color[2] = -1.0;
|
||||
m_Color = Vector3d(-1, -1, -1);
|
||||
}
|
||||
|
||||
~PuppetData() {
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
bool m_ShowBoundingBox;
|
||||
bool m_ShowScaleMeasures;
|
||||
int m_Representation;
|
||||
double m_Color[3];
|
||||
Vector3d m_Color;
|
||||
double m_Opacity;
|
||||
|
||||
bool m_Selectable;
|
||||
@@ -137,8 +137,9 @@ public:
|
||||
actor->GetProperty()->SetEdgeVisibility(0);
|
||||
}
|
||||
}
|
||||
if (m_Color[0] != -1.0) {
|
||||
actor->GetProperty()->SetColor(m_Color);
|
||||
if (m_Color.x() != -1.0) {
|
||||
double c[3] = {m_Color.x(), m_Color.y(), m_Color.z()};
|
||||
actor->GetProperty()->SetColor(c);
|
||||
}
|
||||
|
||||
if (m_Opacity != -1.0) {
|
||||
@@ -280,8 +281,11 @@ void Puppet::SetProp(vtkProp *prop)
|
||||
pd->m_Representation = vp->GetRepresentation();
|
||||
if (pd->m_Opacity < 0)
|
||||
pd->m_Opacity = vp->GetOpacity();
|
||||
if (pd->m_Color[0] < 0)
|
||||
vp->GetColor(pd->m_Color);
|
||||
if (pd->m_Color.x() < 0) {
|
||||
double c[3];
|
||||
vp->GetColor(c);
|
||||
pd->m_Color = Vector3d(c[0], c[1], c[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -622,10 +626,8 @@ struct AppearanceProxy {
|
||||
PuppetData* pd;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int version) {
|
||||
ar & boost::serialization::make_hrp("ColorR", pd->m_Color[0]);
|
||||
ar & boost::serialization::make_hrp("ColorG", pd->m_Color[1]);
|
||||
ar & boost::serialization::make_hrp("ColorB", pd->m_Color[2]);
|
||||
ar & boost::serialization::make_hrp("Opacity", pd->m_Opacity);
|
||||
ar & boost::serialization::make_hrp("Color", pd->m_Color, "color");
|
||||
ar & boost::serialization::make_hrp("Opacity", pd->m_Opacity).range(0.0, 1.0).set_default(1.0);
|
||||
ar & boost::serialization::make_hrp_enum("Representation", pd->m_Representation, {"Points", "Wireframe", "Surface", "SurfaceWithEdges", "Volume", "Outline", "Slice"});
|
||||
ar & boost::serialization::make_hrp("Visibility", pd->m_Visibility);
|
||||
ar & boost::serialization::make_hrp("Pickable", pd->m_Selectable);
|
||||
|
||||
@@ -177,6 +177,9 @@ public:
|
||||
void save_override(const boost::serialization::hrp<T> &t) {
|
||||
if (m_Puppet) {
|
||||
uLib::Property<T>* p = new uLib::Property<T>(m_Puppet, t.name(), &const_cast<boost::serialization::hrp<T>&>(t).value(), t.units() ? t.units() : "", GetCurrentGroup());
|
||||
if (t.has_range()) p->SetRange(t.min_val(), t.max_val());
|
||||
if (t.has_default()) p->SetDefault(t.default_val());
|
||||
|
||||
m_Puppet->RegisterDisplayProperty(p);
|
||||
Vtk::Puppet* puppet = m_Puppet;
|
||||
uLib::Object::connect(p, &uLib::PropertyBase::Updated, [puppet](){ puppet->Update(); });
|
||||
|
||||
Reference in New Issue
Block a user