add vtk Properties
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
|
||||
#include "uLibVtkInterface.h"
|
||||
#include "vtkHandlerWidget.h"
|
||||
#include "Core/Property.h"
|
||||
|
||||
|
||||
|
||||
@@ -197,7 +198,12 @@ public:
|
||||
|
||||
|
||||
|
||||
Puppet::Puppet() : d(new PuppetData) { }
|
||||
Puppet::Puppet() : Object(), d(new PuppetData) {
|
||||
ULIB_ACTIVATE_PROPERTIES(*this);
|
||||
for (auto* p : this->GetProperties()) {
|
||||
uLib::Object::connect(p, &uLib::PropertyBase::Updated, this, &Puppet::Update);
|
||||
}
|
||||
}
|
||||
|
||||
Puppet::~Puppet()
|
||||
{
|
||||
@@ -442,6 +448,12 @@ bool Puppet::IsSelected() const
|
||||
|
||||
void Puppet::Update()
|
||||
{
|
||||
vtkProp3DCollection *props = d->m_Assembly->GetParts();
|
||||
props->InitTraversal();
|
||||
for (int i = 0; i < props->GetNumberOfItems(); ++i) {
|
||||
d->ApplyAppearance(props->GetNextProp3D());
|
||||
}
|
||||
|
||||
if (d->m_Selected) {
|
||||
d->UpdateHighlight();
|
||||
}
|
||||
@@ -462,5 +474,19 @@ void Puppet::ConnectInteractor(vtkRenderWindowInteractor *interactor)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void Puppet::serialize(Archive & ar, const unsigned int version) {
|
||||
ar & boost::serialization::make_hrp("ColorR", d->m_Color[0]);
|
||||
ar & boost::serialization::make_hrp("ColorG", d->m_Color[1]);
|
||||
ar & boost::serialization::make_hrp("ColorB", d->m_Color[2]);
|
||||
ar & boost::serialization::make_hrp("Opacity", d->m_Opacity);
|
||||
ar & boost::serialization::make_hrp("Representation", d->m_Representation);
|
||||
}
|
||||
|
||||
void Puppet::save_override(Archive::xml_oarchive & ar, const unsigned int v) { serialize(ar, v); }
|
||||
void Puppet::save_override(Archive::hrt_oarchive & ar, const unsigned int v) { serialize(ar, v); }
|
||||
void Puppet::save_override(Archive::log_archive & ar, const unsigned int v) { serialize(ar, v); }
|
||||
void Puppet::save_override(Archive::text_oarchive & ar, const unsigned int v) { serialize(ar, v); }
|
||||
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
|
||||
Reference in New Issue
Block a user