View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013610BenderArmatures modulepublic2012-10-26 17:342013-04-02 14:28
ReporterJulien Finet 
Assigned Tojohan andruejol 
PrioritylowSeverityminorReproducibilitysometimes
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version1.0Fixed in Version0.1 
Summary0013610: vtkBoneWidget invokes un-necessary Interaction events
DescriptionFor each mouse move (not necessarily when the buttons are down), the bone widget fires InteractionEvent event.
It shouldn't fire InteractionEvent as there is no interaction happening.
It also adds performance issue.
Steps To ReproduceOnly tested using the Armature module:
 - Create a bone
 - Move the mouse over the 3D view
-> it invokes InteractionEvents.
Additional InformationIt is fired from vtkBoneWidget::MoveAction, in the Rest pose conditional block.
TagsNo tags attached.
Attached Files

 Relationships
child of 0013671closedJulien Finet Task 1.1) Develop an application for specifying rigging for a voxelized anatomical model. 

  Notes
(0031353)
johan andruejol (developer)
2012-10-30 17:05

Fixed in a squashed commit, see: https://github.com/vovythevov/Bender/commit/4514ec4b38495de335763a5b01d6e9864caf8d51 [^]
(0031368)
Julien Finet (administrator)
2012-11-01 11:12

Issue is fixed, InteractionEvent is not fired anytime the mouse is moved.
However, StartInteractionEvent/EndInteractionEvent are fired only when the head and tail are clicked, not when the line is clicked. This can lead to problems in the future.

Side note: The name "vtkBoneWidget::AddPointAction" doesn't fit the behavior of the function.
(0031375)
johan andruejol (developer)
2012-11-01 15:53

See https://github.com/vovythevov/Bender/commit/f1ce8ebd31ff0da0e4ab74a96152aed5150b2bef [^]
(0031377)
Julien Finet (administrator)
2012-11-01 16:55

I believe vtkBoneWidget::StartSelectAction can be factorized a bit more:
There is code duplication in the following:
    if (state == vtkBoneRepresentation::OnHead)
      {
      self->SetWidgetSelectedState(vtkBoneWidget::HeadSelected);
      self->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
      }
    else if (state == vtkBoneRepresentation::OnTail)
      {
      self->SetWidgetSelectedState(vtkBoneWidget::TailSelected);
      self->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
      }
    else if (state == vtkBoneRepresentation::OnLine)
      {
      if (self->WidgetState == vtkBoneWidget::Rest)
        {
        self->SetWidgetSelectedState(vtkBoneWidget::LineSelected);
        self->WidgetRep->StartWidgetInteraction(e);
        self->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
        }

      self->InvokeEvent(vtkCommand::StartInteractionEvent,NULL);
      }
Maybe self->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL); can be called within SetWidgetSelectedState.

And wouldn't it be cool if vtkBoneRepresentation::OnHead, vtkBoneRepresentation::OnTail, vtkBoneRepresentation::OnLine and vtkBoneRepresentation::Outside were the same than vtkBoneWidget::HeadSelected, vtkBoneWidget::TailSelected, vtkBoneWidget::LineSelected and vtkBoneWidget::NoneSelected? It would make the code in vtkBoneWidget::StartSelectAction() be more like that:
 ...
 int modifier =
   self->Interactor->GetShiftKey() | self->Interactor->GetControlKey();
 int state = self->WidgetRep->ComputeInteractionState(X,Y,modifier);
 self->SetWidgetSelectedState(state);
 ...
//(be careful with the abort flag).
...

and

vtkBoneWidget::SetWidgetSelectedState(int selectionState)
{
  ...
  this->BoneSelected = selectionState;
  this->GetBoneRepresentation(selectionState)->Highlight(selectionState != NoSelected);
  if (selectionState == NoSelected)
    {
    return;
    }
  self->GrabFocus(self->EventCallbackCommand);
  // Explain here why it is different than for head and tail
  // and why we don't do it in Pose state
  if (selectionState == Line && widgetState == Rest)
    {
    self->WidgetRep->StartWidgetInteraction(e);
    }
  this->InvokeEvent(LeftButtonPressEvent);
  // Make sure that the order of the calls (LeftButtonPressEvent, StartInteractionEvent) is the
  // same between Head selected, Tail selected and Line selected.
  if (selectionState == Line)
    {
    self->InvokeEvent(vtkCommand::StartInteractionEvent,NULL);
    }
}
(0031702)
Julien Finet (administrator)
2012-11-25 10:53

Some cleanup work has happened in 13610-cleanup-bone-widget-interaction:
https://github.com/finetjul/bender/commits/13610-cleanup-bone-widget-interaction [^]

Note that it can't be merged as-is. The duplication of invocation of StartInteractionEvent/EndInteractionEvent should be fixed before.
(by getting rid of vtkBoneWidgetCallback ?)

Btw, this->HeadWidgetCallback and this->TailWidgetCallback are doing the same, only 1 can be used on both widgets.
(0031747)
johan andruejol (developer)
2012-11-28 13:44

https://github.com/vovythevov/Bender/commit/c3fbd1a3153529f4c6402afc0ff996ef4ff6d2c5 [^]
(0031792)
Julien Finet (administrator)
2012-11-30 20:12

13610-cleanup-bone-widget-interaction now contains the most up-to-date code:
https://github.com/finetjul/bender/commits/13610-cleanup-bone-widget-interaction [^]

Johan, can you please try the topic on your machine and let me know if there is some problems with it ? Thanks

 Issue History
Date Modified Username Field Change
2012-10-26 17:34 Julien Finet New Issue
2012-10-26 17:34 Julien Finet Status new => assigned
2012-10-26 17:34 Julien Finet Assigned To => johan andruejol
2012-10-30 17:05 johan andruejol Note Added: 0031353
2012-10-30 17:11 johan andruejol Status assigned => resolved
2012-10-30 17:11 johan andruejol Resolution open => fixed
2012-11-01 11:12 Julien Finet Note Added: 0031368
2012-11-01 11:12 Julien Finet Status resolved => assigned
2012-11-01 15:53 johan andruejol Note Added: 0031375
2012-11-01 15:54 johan andruejol Status assigned => resolved
2012-11-01 16:55 Julien Finet Note Added: 0031377
2012-11-01 16:55 Julien Finet Status resolved => assigned
2012-11-09 13:37 Julien Finet Relationship added child of 0013671
2012-11-09 15:49 Julien Finet Priority high => low
2012-11-25 10:53 Julien Finet Note Added: 0031702
2012-11-28 13:44 johan andruejol Note Added: 0031747
2012-11-30 20:12 Julien Finet Note Added: 0031792
2012-12-06 08:33 johan andruejol Status assigned => resolved
2013-01-17 17:53 Julien Finet Fixed in Version => 0.1
2013-02-14 14:38 Julien Finet Status resolved => closed
2013-02-14 14:44 Julien Finet Category vtkBoneWidgets => Armatures module
2013-04-02 14:28 Julien Finet Target Version => 1.0


Copyright © 2000 - 2018 MantisBT Team