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

@@ -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)