fixed most ( still units error )
This commit is contained in:
@@ -92,13 +92,12 @@ void Assembly::InstallPipe() {
|
||||
void Assembly::contentUpdate() {
|
||||
if (m_InUpdate) return;
|
||||
m_InUpdate = true;
|
||||
|
||||
m_BlockUpdate = false;
|
||||
this->UpdateTransform();
|
||||
this->UpdateBoundingBox();
|
||||
if (m_ChildContext)
|
||||
m_ChildContext->Update();
|
||||
|
||||
m_BlockUpdate = true;
|
||||
Puppet::Update();
|
||||
m_InUpdate = false;
|
||||
}
|
||||
@@ -106,25 +105,29 @@ void Assembly::contentUpdate() {
|
||||
// ------------------------------------------------------------------ //
|
||||
void Assembly::Update() {
|
||||
if (m_InUpdate) return;
|
||||
if (!m_Content || !m_VtkAsm) return;
|
||||
m_InUpdate = true;
|
||||
this->contentUpdate();
|
||||
m_InUpdate = false;
|
||||
}
|
||||
|
||||
if (m_BlockUpdate) {
|
||||
m_BlockUpdate = false;
|
||||
return;
|
||||
}
|
||||
void Assembly::SyncFromVtk() {
|
||||
if (m_InUpdate) return;
|
||||
if (!m_Content || !m_VtkAsm) return;
|
||||
|
||||
m_InUpdate = true;
|
||||
|
||||
// Pull VTK transform back into the uLib model
|
||||
vtkMatrix4x4* vmat = m_VtkAsm->GetUserMatrix();
|
||||
if (vmat) {
|
||||
Matrix4f transform = VtkToMatrix4f(vmat);
|
||||
m_Content->SetMatrix(transform);
|
||||
}
|
||||
double pos[3], ori[3], scale[3];
|
||||
m_VtkAsm->GetPosition(pos);
|
||||
m_VtkAsm->GetOrientation(ori);
|
||||
m_VtkAsm->GetScale(scale);
|
||||
|
||||
m_Content->SetPosition(Vector3f(pos[0], pos[1], pos[2]));
|
||||
m_Content->SetOrientation(Vector3f(ori[0], ori[1], ori[2]) * CLHEP::degree);
|
||||
m_Content->SetScale(Vector3f(scale[0], scale[1], scale[2]));
|
||||
|
||||
this->UpdateBoundingBox();
|
||||
if (m_ChildContext)
|
||||
m_ChildContext->Update();
|
||||
m_ChildContext->SyncFromVtk();
|
||||
|
||||
m_Content->Updated(); // Notify change in model
|
||||
|
||||
@@ -135,10 +138,7 @@ void Assembly::Update() {
|
||||
void Assembly::UpdateTransform() {
|
||||
if (!m_Content || !m_VtkAsm) return;
|
||||
|
||||
Matrix4f mat = m_Content->GetMatrix();
|
||||
vtkNew<vtkMatrix4x4> vmat;
|
||||
Matrix4fToVtk(mat, vmat);
|
||||
m_VtkAsm->SetUserMatrix(vmat);
|
||||
this->ApplyTransform(m_VtkAsm);
|
||||
m_VtkAsm->Modified();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user