Commit c9abddc1 authored by Jan Möbius's avatar Jan Möbius
Browse files

Dennis:

Autoresize-translation-node-manipulator-only-once-af

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5560 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b8310404
......@@ -115,7 +115,8 @@ TranslationManipulatorNode( BaseNode* _parent, const std::string& _name )
any_top_over_(false),
origin_over_(false),
outer_ring_over_(false),
auto_size_(false)
auto_size_(TranslationManipulatorNode::Never),
auto_size_length_(1.0)
{
localTransformation_.identity();
axis_ = gluNewQuadric();
......@@ -1648,7 +1649,7 @@ double TranslationManipulatorNode::get_screen_length (GLState& _state, Vec3d& _p
void TranslationManipulatorNode::updateSize (GLState& _state)
{
if (auto_size_)
if (auto_size_ != TranslationManipulatorNode::Never)
{
Vec3d point = localTransformation_.transform_point(Vec3d (0.0, 0.0, 0.0));
......@@ -1656,16 +1657,14 @@ void TranslationManipulatorNode::updateSize (GLState& _state)
_state.get_viewport (tmp, tmp, width, height);
double length = get_screen_length (_state, point) * (width + height) * 0.02;
auto_size_length_ = get_screen_length (_state, point) * (width + height) * 0.02;
manipulator_radius_ = set_manipulator_radius_ * length;
manipulator_height_ = set_manipulator_height_ * length;
}
else
{
manipulator_radius_ = set_manipulator_radius_;
manipulator_height_ = set_manipulator_height_;
if (auto_size_ == TranslationManipulatorNode::Once)
auto_size_ = TranslationManipulatorNode::Never;
}
manipulator_radius_ = set_manipulator_radius_ * auto_size_length_;
manipulator_height_ = set_manipulator_height_ * auto_size_length_;
}
//=============================================================================
......
......@@ -76,6 +76,12 @@ public:
ROTATIONMODE
};
enum AutoSizeMode {
Never,
Once,
Always
};
/// Default constructor.
TranslationManipulatorNode( BaseNode* _parent=0,
const std::string& _name="<TranslationTranslationManipulatorNode>" );
......@@ -118,11 +124,11 @@ public:
/// get cylindersize
double size() const { return set_manipulator_height_; }
/// set auto size
void set_autosize (bool _enable) { auto_size_ = _enable; }
/// set auto size mode
void set_autosize (AutoSizeMode _mode) { auto_size_ = _mode; }
/// get autosize
bool autosize () const { return auto_size_; }
/// get autosize mode
AutoSizeMode autosize () const { return auto_size_; }
void rotate (double _angle, Vec3d _axis)
{
......@@ -245,7 +251,8 @@ private:
GLMatrixd localTransformation_;
bool auto_size_;
AutoSizeMode auto_size_;
double auto_size_length_;
};
......
......@@ -399,7 +399,7 @@ void MovePlugin::placeManip(QMouseEvent * _event)
object->manipulatorNode()->loadIdentity();
object->manipulatorNode()->set_center(hitPoint);
object->manipulatorNode()->set_draw_cylinder(true);
object->manipulatorNode()->set_autosize(true);
object->manipulatorNode()->set_autosize(QtTranslationManipulatorNode::Once);
object->manipulatorNode()->set_size(manip_size_ * manip_size_modifier_);
object->manipulatorNode()->show();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment