
Thu, 04/03/2025 - 16:44
Forums:
could have sworn this worked before upgrading to 7.9.0...
I've got a problem with AIS_Manipulator::HasActiveMode() never returning true...
Implementing AIS_Manipulator as:
void Ccanvas::showManipulator(CCutShape *selection) { if (m_Manipulator->IsAttached()) m_Manipulator->Detach(); AIS_Manipulator::OptionsForAttach anOptions; anOptions.SetAdjustPosition(true); anOptions.SetAdjustSize(false); anOptions.SetEnableModes(true); // m_Manipulator->SetModeActivationOnDetection(true); m_Manipulator->Attach (selection, anOptions); //done internally //m_Manipulator->EnableMode(AIS_MM_Translation); //m_Manipulator->EnableMode(AIS_MM_Rotation); _context->Display(m_Manipulator, true); }
then corresponding calls in MouseEvent/MouseMove:
void Ccanvas::mousePressEvent(QMouseEvent* event) { if (event->button() == Qt::LeftButton) { // Save the current mouse coordinate in min. m_mouseLDown.viewx = x; m_mouseLDown.viewy = y; _view->Convert(m_mouseLDown.viewx, m_mouseLDown.viewy, m_mouseLDown.canvasx, m_mouseLDown.canvasy, m_mouseLDown.canvasz); if (m_Manipulator->HasActiveMode()) { m_Manipulator->StartTransform (x, y, _view); } update(); } } //-------------------------------------------------------------------------------------- void Ccanvas::mouseMoveEvent(QMouseEvent* event) { double x = event->position().x(); double y = event->position().y(); if (m_Manipulator->HasActiveMode()) { m_Manipulator->Transform(x, y, _view); _view->Redraw(); } update(); }
Chasing into the source code, I can see [myCurrentMode] is set perpetually to AIS_MM_None, and I can't find where its set to anything else?
Can anyone sanity check this for me, sure I must be doing something stupid here?
Fri, 04/04/2025 - 07:15
If you are using
AIS_ViewController
then it is better relying on its logic handling dragging events. For this you need just enableAIS_Manipulator::SetModeActivationOnDetection(true)
automatic detection mechanism and remove anyAIS_Manipulator::StartTransform()
/AIS_Manipulator::Transform()
from your code. All you need is just attaching manipulator and handle detaching:Fri, 04/04/2025 - 19:43
Oh, it gets much stranger than that!
Neither code would work - just completely unresponsive. I had a bit of a Eureka moment: turning off automatic highlights cripples the manipulator!
Is there any workaround for this - I don't particularly want automatic hilighting because its messy, but I do want a manipulator?
The SetModeActivationOnDetection() mode is painful: I ended up moving and rotating my shape all over the place by accident, just by being in the wrong place at the wrong time!
Sat, 04/05/2025 - 23:33
Same here
Sun, 04/06/2025 - 10:26
I don't quite understand what is exactly wrong with
SetModeActivationOnDetection()
and how not using it may avoid issues withAIS_Manipulator
. Do you see some bugs or want another behavior of manipulator (which one?)?Sun, 04/06/2025 - 11:25
There are two issues here:
1. The manipulator just doesn't work unless automatic highlights are enabled. This, for me, is a bug
2. Automatic Detection is incredibly "trigger happy" : it's too easy to perform unwanted translations just by navigating around. I, personally, don't class this as a bug specifically, but it's just not useful for my particular application (especially where my objects are small in comparison to the manipulator)
Sun, 04/06/2025 - 13:02
Manipulator is just another interactive object that implements presentation and selection mechanisms. Only through detection mechanism object may understand that mouse is currently over rotation/translation/scaling part to activate it. And only by dynamic highlighting user might understand what has been activated. Without visual feedback (like in case of a common touchscreen, where dynamic highlighting is usually impossible) user is much easier to miss and do something unexpected.
In which scenarios you experience unwanted translations and how they could be avoided (are there any suggestions to improve dragging logic?)? Note that
AIS_ViewController
implements aborting mechanism to revert undesired or accidental changes. When user starts dragging object holding left mouse button, he may click right button to put object back - the similar behavior could be found in other applications like Inkscape.Mon, 04/07/2025 - 10:44
For me a middle-ground approach would be best: let the Automatic Detection routines handle the translation and logic: just activated via mouse button click/drag, as opposed to trigger-happy random mouse scrolling. This way it'd just work like any other 3D cad manipulator. blender is a good example (quite possibly the first time I've ever said that, probably the last :)).
Mon, 04/07/2025 - 13:22
Sorry, In still don't get from your description what is exactly wrong right now. Could you try formulating the changes in current API or in behavior that would make it better for your problem? Or maybe some step by step description of actions at application level with reaction from AIS level...