Skip to content

Commit

Permalink
Harmonize naming in vtkBoneWidget.
Browse files Browse the repository at this point in the history
Changing AxesVisibility to ShowAxes to be on par with the ShowParenthood
methods.
Propagating the change to vtkArmatureWidget as well.

Issue#13621
  • Loading branch information
vovythevov committed Nov 1, 2012
1 parent 27ccd15 commit b770c79
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 40 deletions.
4 changes: 2 additions & 2 deletions Libs/VTK/Widgets/Testing/vtkArmatureWidgetTest.cxx
Expand Up @@ -93,12 +93,12 @@ class ArmatureTestKeyPressInteractorStyle : public vtkInteractorStyleTrackballCa
}
else if (key == "Tab")
{
int state = Armature->GetAxesVisibility() + 1;
int state = Armature->GetShowAxes() + 1;
if (state > vtkBoneWidget::ShowPoseTransform)
{
state = 0;
}
Armature->SetAxesVisibility(state);
Armature->SetShowAxes(state);
}
}

Expand Down
Expand Up @@ -287,12 +287,12 @@ class Test1KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera
}
else if (key == "Tab")
{
int state = Armature->GetAxesVisibility() + 1;
int state = Armature->GetShowAxes() + 1;
if (state > vtkBoneWidget::ShowPoseTransform)
{
state = 0;
}
Armature->SetAxesVisibility(state);
Armature->SetShowAxes(state);
}
}

Expand Down Expand Up @@ -373,23 +373,23 @@ rotationAxis -0.866354 0 0.49943*/

vtkBoneWidget* thumb = armature->CreateBone(forearm, 20.0, 4.0, 0.0);
armature->AddBone(thumb, forearm);
thumb->SetAxesVisibility(vtkBoneWidget::ShowPoseTransform);
thumb->SetShowAxes(vtkBoneWidget::ShowPoseTransform);

vtkBoneWidget* indexFinger = armature->CreateBone(forearm, 22.0, 2.0, 0.0);
armature->AddBone(indexFinger, forearm);
indexFinger->SetAxesVisibility(vtkBoneWidget::ShowPoseTransform);
indexFinger->SetShowAxes(vtkBoneWidget::ShowPoseTransform);

vtkBoneWidget* middleFinger = armature->CreateBone(forearm, 22.0, 1.0, 0.0);
armature->AddBone(middleFinger, forearm);
middleFinger->SetAxesVisibility(vtkBoneWidget::ShowPoseTransform);
middleFinger->SetShowAxes(vtkBoneWidget::ShowPoseTransform);

vtkBoneWidget* ringFinger = armature->CreateBone(forearm, 22.0, -1.0, 0.0);
armature->AddBone(ringFinger, forearm);
ringFinger->SetAxesVisibility(vtkBoneWidget::ShowPoseTransform);
ringFinger->SetShowAxes(vtkBoneWidget::ShowPoseTransform);

vtkBoneWidget* littleFinger = armature->CreateBone(forearm, 22.0, -2.0, 0.0);
armature->AddBone(littleFinger, forearm);
littleFinger->SetAxesVisibility(vtkBoneWidget::ShowPoseTransform);
littleFinger->SetShowAxes(vtkBoneWidget::ShowPoseTransform);

//armature->SetWidgetState(vtkArmatureWidget::Pose);

Expand Down
10 changes: 5 additions & 5 deletions Libs/VTK/Widgets/vtkArmatureWidget.cxx
Expand Up @@ -185,7 +185,7 @@ vtkArmatureWidget::vtkArmatureWidget()
// Init bones properties
this->BonesRepresentationType = vtkArmatureWidget::None;
this->WidgetState = vtkArmatureWidget::Rest;
this->AxesVisibility = vtkBoneWidget::Hidden;
this->ShowAxes = vtkBoneWidget::Hidden;
this->ShowParenthood = true;
}

Expand Down Expand Up @@ -418,18 +418,18 @@ void vtkArmatureWidget::SetWidgetState(int state)
}

//----------------------------------------------------------------------------
void vtkArmatureWidget::SetAxesVisibility(int axesVisibility)
void vtkArmatureWidget::SetShowAxes(int show)
{
if (axesVisibility == this->AxesVisibility)
if (show == this->ShowAxes)
{
return;
}

this->AxesVisibility = axesVisibility;
this->ShowAxes = show;
for (NodeIteratorType it = this->Bones->begin();
it != this->Bones->end(); ++it)
{
(*it)->Bone->SetAxesVisibility(this->AxesVisibility);
(*it)->Bone->SetShowAxes(this->ShowAxes);
}
}

Expand Down
8 changes: 4 additions & 4 deletions Libs/VTK/Widgets/vtkArmatureWidget.h
Expand Up @@ -203,9 +203,9 @@ class VTK_BENDER_WIDGETS_EXPORT vtkArmatureWidget : public vtkAbstractWidget

// Description
// Set/get if the debug axes are visible or not.
// @sa vtkBoneWidget::AxesVisibilityType
void SetAxesVisibility (int AxesVisibility);
vtkGetMacro(AxesVisibility, int);
// @sa vtkBoneWidget::ShowAxesType
void SetShowAxes (int show);
vtkGetMacro(ShowAxes, int);

// Description
// Show/Hide the a line between the bones and their
Expand Down Expand Up @@ -234,7 +234,7 @@ class VTK_BENDER_WIDGETS_EXPORT vtkArmatureWidget : public vtkAbstractWidget
// Bone Properties
int BonesRepresentationType;
int WidgetState;
int AxesVisibility;
int ShowAxes;
int ShowParenthood;

// Add all the necessaries observers to a bone
Expand Down
24 changes: 12 additions & 12 deletions Libs/VTK/Widgets/vtkBoneWidget.cxx
Expand Up @@ -206,7 +206,7 @@ vtkBoneWidget::vtkBoneWidget()
InitializeVector3(this->InteractionWorldTailPose);

// Debug axes init.
this->AxesVisibility = vtkBoneWidget::Hidden;
this->ShowAxes = vtkBoneWidget::Hidden;
this->AxesActor = vtkAxesActor::New();
this->AxesActor->SetAxisLabels(0);
this->AxesSize = 0.4;
Expand All @@ -216,7 +216,7 @@ vtkBoneWidget::vtkBoneWidget()

this->ShouldInitializePoseMode = true;

this->UpdateAxesVisibility();
this->UpdateShowAxes();
this->UpdateParenthoodLinkVisibility();
}

Expand Down Expand Up @@ -306,7 +306,7 @@ void vtkBoneWidget::SetEnabled(int enabling)
{
this->CurrentRenderer->RemoveActor(this->AxesActor);
}
this->UpdateAxesVisibility();
this->UpdateShowAxes();
}
}

Expand Down Expand Up @@ -861,15 +861,15 @@ void vtkBoneWidget::SetLocalTailRest(double tail[3])
}

//----------------------------------------------------------------------------
void vtkBoneWidget::SetAxesVisibility(int visibility)
void vtkBoneWidget::SetShowAxes(int show)
{
if (this->AxesVisibility == visibility)
if (this->ShowAxes == show)
{
return;
}

this->AxesVisibility = visibility;
this->UpdateAxesVisibility();
this->ShowAxes = show;
this->UpdateShowAxes();
this->Modified();
}

Expand Down Expand Up @@ -1221,11 +1221,11 @@ void vtkBoneWidget::RebuildAxes()
vtkSmartPointer<vtkTransform>::New();
transform->Translate(this->GetCurrentWorldTail());

if (this->AxesVisibility == vtkBoneWidget::ShowRestTransform)
if (this->ShowAxes == vtkBoneWidget::ShowRestTransform)
{
transform->Concatenate(this->CreateWorldToBoneRestRotation());
}
else if (this->AxesVisibility == vtkBoneWidget::ShowPoseTransform)
else if (this->ShowAxes == vtkBoneWidget::ShowPoseTransform)
{
transform->Concatenate(this->CreateWorldToBonePoseRotation());
}
Expand All @@ -1234,9 +1234,9 @@ void vtkBoneWidget::RebuildAxes()
}

//----------------------------------------------------------------------------
void vtkBoneWidget::UpdateAxesVisibility()
void vtkBoneWidget::UpdateShowAxes()
{
if (this->AxesVisibility == vtkBoneWidget::Hidden
if (this->ShowAxes == vtkBoneWidget::Hidden
|| this->WidgetState == vtkBoneWidget::PlaceHead
|| this->WidgetState == vtkBoneWidget::PlaceTail
|| this->Enabled == 0)
Expand Down Expand Up @@ -1987,7 +1987,7 @@ void vtkBoneWidget::PrintSelf(ostream& os, vtkIndent indent)

os << indent << "Axes:" << "\n";
os << indent << " Axes Actor: "<< this->AxesActor << "\n";
os << indent << " Axes Visibility: "<< this->AxesVisibility << "\n";
os << indent << " Show Axes: "<< this->ShowAxes << "\n";
os << indent << " Axes Size: "<< this->AxesSize << "\n";

os << indent << "Parent link: "<< "\n";
Expand Down
23 changes: 13 additions & 10 deletions Libs/VTK/Widgets/vtkBoneWidget.h
Expand Up @@ -319,23 +319,26 @@ class VTK_BENDER_WIDGETS_EXPORT vtkBoneWidget : public vtkAbstractWidget
// ShowRestTransform: The debug axes will output the rest transform axes.
// ShowPoseTransform: The debug axes will output the pose transform axes.
// @sa GetAxesActor().
vtkGetMacro(AxesVisibility, int);
void SetAxesVisibility (int axesVisibility);
vtkGetMacro(ShowAxes, int);
void SetShowAxes(int show);

// Description:
// Hidden: Hide the axes.
// ShowRestTransform: The debug axes will output the RestTransform axes.
// ShowPoseTransform: The debug axes will output the pose transform axes.
//BTX
enum AxesVisibilityType {Hidden = 0,
ShowRestTransform,
ShowPoseTransform,
};
enum ShowAxesType
{
Hidden = 0,
ShowRestTransform,
ShowPoseTransform,
};
//ETX

// Description:
// Get the Axes actor. This is meant for the user to modify the rendering
// properties of the actor. The other properties must be left unchanged.
// @sa GetAxesVisibility() SetAxesVisibility()
// @sa GetShowAxes() SetShowAxes()
vtkAxesActor* GetAxesActor() { return this->AxesActor; };

// Debug functions
Expand Down Expand Up @@ -473,16 +476,16 @@ class VTK_BENDER_WIDGETS_EXPORT vtkBoneWidget : public vtkAbstractWidget

// Axes variables:
// For an easier debug and understanding.
int AxesVisibility;
int ShowAxes;
vtkAxesActor* AxesActor;
double AxesSize;

// Helper methods to change the axes orientation and origin
// with respect to the AxesVisibility variable and the bone's transforms.
// with respect to the ShowAxes variable and the bone's transforms.
// Note: RebuildParentageLink() is yo be called when the visibility of
// the axes may be subject to change. This will call RebuildAxes().
void RebuildAxes();
void UpdateAxesVisibility();
void UpdateShowAxes();

// Debug:
// Usefull when debugging multiple bones
Expand Down

0 comments on commit b770c79

Please sign in to comment.