fix container box representation ( fix it )

This commit is contained in:
AndreaRigoni
2026-04-17 09:36:10 +00:00
parent 197beba19b
commit 1288fc3a41

View File

@@ -65,6 +65,7 @@ ContainerBox::ContainerBox(ContainerBox::Content *content)
this->InstallPipe(); this->InstallPipe();
d->m_UpdateSignal = Object::connect( d->m_UpdateSignal = Object::connect(
this->m_model.get(), &uLib::Object::Updated, this, &ContainerBox::Update); this->m_model.get(), &uLib::Object::Updated, this, &ContainerBox::Update);
this->Update();
} }
ContainerBox::~ContainerBox() { delete d; } ContainerBox::~ContainerBox() { delete d; }
@@ -81,13 +82,18 @@ void ContainerBox::Update() {
vtkProp3D *prop = vtkProp3D::SafeDownCast(this->GetProp()); vtkProp3D *prop = vtkProp3D::SafeDownCast(this->GetProp());
if (prop) { if (prop) {
// Apply the full volume matrix (TRS * m_LocalT) // Apply the TRS matrix to the assembly
vtkNew<vtkMatrix4x4> m; vtkNew<vtkMatrix4x4> m;
Matrix4fToVtk(this->m_model->GetMatrix(), m); Matrix4fToVtk(this->m_model->GetMatrix(), m);
prop->SetUserMatrix(m); prop->SetUserMatrix(m);
prop->Modified(); prop->Modified();
} }
// Apply the local shape transformation (Size/Origin) to the cube actor
vtkNew<vtkMatrix4x4> localM;
Matrix4fToVtk(this->m_model->GetLocalMatrix(), localM);
d->m_Cube->SetUserMatrix(localM);
// Delegate rest of update (appearance, render, etc) // Delegate rest of update (appearance, render, etc)
ConnectionBlock blocker(d->m_UpdateSignal); ConnectionBlock blocker(d->m_UpdateSignal);
this->Prop3D::Update(); this->Prop3D::Update();
@@ -121,11 +127,11 @@ void ContainerBox::InstallPipe() {
Content *c = this->m_model; Content *c = this->m_model;
// CUBE // CUBE
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New(); vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New();
vtkSmartPointer<vtkPolyDataMapper> mapper = // cube->SetBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);
vtkSmartPointer<vtkPolyDataMapper>::New();
cube->SetBounds(0, 1, 0, 1, 0, 1);
mapper->SetInputConnection(cube->GetOutputPort()); mapper->SetInputConnection(cube->GetOutputPort());
mapper->Update(); mapper->Update();
d->m_Cube->SetMapper(mapper); d->m_Cube->SetMapper(mapper);