refactor: update Puppet transform logic to support AffineTransform world matrices and improve selection highlighting

This commit is contained in:
AndreaRigoni
2026-03-30 15:24:37 +00:00
parent 46c39bc26e
commit 22d0041942
24 changed files with 469 additions and 331 deletions

View File

@@ -36,6 +36,8 @@ printf("..:: Testing " #name " ::..\n");
#define TEST1(val) _fail += (val)==0
#define TEST0(val) _fail += (val)!=0
#define ASSERT_EQUAL(a,b) if((a)!=(b)) { printf("Assertion failed: " #a " != " #b " at line %d\n", __LINE__); _fail++; }
#define ASSERT_NOT_NULL(ptr) if((ptr)==NULL) { printf("Assertion failed: " #ptr " is NULL at line %d\n", __LINE__); _fail++; }
#define END_TESTING return _fail;

View File

@@ -35,8 +35,7 @@ Assembly::Assembly(uLib::Assembly *content)
m_ChildContext(nullptr),
m_BBoxActor(nullptr),
m_VtkAsm(nullptr),
m_InUpdate(false),
m_BlockUpdate(false) {
m_InUpdate(false) {
this->InstallPipe();
if (m_Content) {
Object::connect(m_Content, &uLib::Assembly::Updated,
@@ -54,6 +53,7 @@ Assembly::~Assembly() {
void Assembly::InstallPipe() {
// 1. Create the VTK library assembly that groups everything
m_VtkAsm = ::vtkAssembly::New();
m_VtkAsm->PickableOff();
this->SetProp(m_VtkAsm);
// 2. Create the bounding-box wireframe actor
@@ -78,10 +78,10 @@ void Assembly::InstallPipe() {
// 3. Build a child-objects context (auto-creates puppets for each child)
if (m_Content) {
m_ChildContext = new vtkObjectsContext(m_Content);
// The vtkObjectsContext's own prop is already a ::vtkAssembly;
// nest it inside ours so everything moves together.
if (auto *childProp = vtkProp3D::SafeDownCast(m_ChildContext->GetProp()))
// Link the children context's assembly into our group assembly
if (auto* childProp = vtkProp3D::SafeDownCast(m_ChildContext->GetProp())) {
m_VtkAsm->AddPart(childProp);
}
}
// 4. Apply initial transform
@@ -93,7 +93,6 @@ void Assembly::InstallPipe() {
void Assembly::contentUpdate() {
if (m_InUpdate) return;
m_InUpdate = true;
m_BlockUpdate = false;
this->UpdateTransform();
this->UpdateBoundingBox();
if (m_ChildContext)

View File

@@ -66,7 +66,6 @@ private:
vtkActor *m_BBoxActor;
::vtkAssembly *m_VtkAsm; // VTK library assembly — NOT this class
bool m_InUpdate; // re-entrancy guard
bool m_BlockUpdate; // block feedback from contentUpdate→Update
};
} // namespace Vtk

View File

@@ -29,7 +29,6 @@
#include "Math/ContainerBox.h"
#include "uLibVtkInterface.h"
#include "vtkPolydata.h"
#include <boost/signals2/connection.hpp>
class vtkActor;