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();
d->m_UpdateSignal = Object::connect(
this->m_model.get(), &uLib::Object::Updated, this, &ContainerBox::Update);
this->Update();
}
ContainerBox::~ContainerBox() { delete d; }
@@ -81,13 +82,18 @@ void ContainerBox::Update() {
vtkProp3D *prop = vtkProp3D::SafeDownCast(this->GetProp());
if (prop) {
// Apply the full volume matrix (TRS * m_LocalT)
// Apply the TRS matrix to the assembly
vtkNew<vtkMatrix4x4> m;
Matrix4fToVtk(this->m_model->GetMatrix(), m);
prop->SetUserMatrix(m);
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)
ConnectionBlock blocker(d->m_UpdateSignal);
this->Prop3D::Update();
@@ -121,11 +127,11 @@ void ContainerBox::InstallPipe() {
Content *c = this->m_model;
// CUBE
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New();
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
cube->SetBounds(0, 1, 0, 1, 0, 1);
// cube->SetBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);
mapper->SetInputConnection(cube->GetOutputPort());
mapper->Update();
d->m_Cube->SetMapper(mapper);