Merge pull request #10738 from qewer33/transform-fixes
Gui: Transform dragger fixes for PR #10706
This commit is contained in:
@@ -49,8 +49,6 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Quantity.h>
|
||||
#include "Gui/ViewParams.h"
|
||||
#include "App/Color.h"
|
||||
|
||||
#include "SoFCCSysDragger.h"
|
||||
#include "MainWindow.h"
|
||||
@@ -287,6 +285,7 @@ void TDragger::dragStart()
|
||||
|
||||
translationIncrementCount.setValue(0);
|
||||
}
|
||||
|
||||
void TDragger::drag()
|
||||
{
|
||||
projector.setViewVolume(this->getViewVolume());
|
||||
@@ -553,6 +552,7 @@ void TPlanarDragger::dragStart()
|
||||
translationIncrementXCount.setValue(0);
|
||||
translationIncrementYCount.setValue(0);
|
||||
}
|
||||
|
||||
void TPlanarDragger::drag()
|
||||
{
|
||||
projector.setViewVolume(this->getViewVolume());
|
||||
@@ -952,6 +952,7 @@ int RDragger::roundIncrement(const float &radiansIn)
|
||||
return rCount;
|
||||
}
|
||||
|
||||
|
||||
SO_KIT_SOURCE(SoFCCSysDragger)
|
||||
|
||||
void SoFCCSysDragger::initClass()
|
||||
@@ -1056,40 +1057,11 @@ SoFCCSysDragger::SoFCCSysDragger()
|
||||
SO_KIT_INIT_INSTANCE();
|
||||
|
||||
// Colors
|
||||
|
||||
SoBaseColor *color;
|
||||
App::Color stdColor;
|
||||
auto viewParams = Gui::ViewParams::instance();
|
||||
// Translator
|
||||
color = SO_GET_ANY_PART(this, "xTranslatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisXColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
color = SO_GET_ANY_PART(this, "yTranslatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisYColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
color = SO_GET_ANY_PART(this, "zTranslatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisZColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
// Planar Translator
|
||||
color = SO_GET_ANY_PART(this, "xyPlanarTranslatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisZColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
color = SO_GET_ANY_PART(this, "yzPlanarTranslatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisXColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
color = SO_GET_ANY_PART(this, "zxPlanarTranslatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisYColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
// Rotator
|
||||
color = SO_GET_ANY_PART(this, "xRotatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisXAltColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
color = SO_GET_ANY_PART(this, "yRotatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisYAltColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
color = SO_GET_ANY_PART(this, "zRotatorColor", SoBaseColor);
|
||||
stdColor.setPackedValue(viewParams->getAxisZAltColor());
|
||||
color->rgb.setValue(stdColor.r, stdColor.g, stdColor.b);
|
||||
setAxisColors(
|
||||
SbColor(1.0, 0, 0).getPackedValue(0.0f),
|
||||
SbColor(0, 1.0, 0).getPackedValue(0.0f),
|
||||
SbColor(0, 0, 1.0).getPackedValue(0.0f)
|
||||
);
|
||||
|
||||
// Increments
|
||||
|
||||
@@ -1468,7 +1440,42 @@ void SoFCCSysDragger::clearIncrementCounts()
|
||||
rotationIncrementCountZ.setValue(0);
|
||||
}
|
||||
|
||||
// Visiblity API Functions
|
||||
void SoFCCSysDragger::setAxisColors(unsigned long x, unsigned long y, unsigned long z) {
|
||||
SbColor colorX;
|
||||
SbColor colorY;
|
||||
SbColor colorZ;
|
||||
|
||||
float t = 0.0f;
|
||||
colorX.setPackedValue(x, t);
|
||||
colorY.setPackedValue(y, t);
|
||||
colorZ.setPackedValue(z, t);
|
||||
|
||||
SoBaseColor* color;
|
||||
|
||||
// Translator
|
||||
color = SO_GET_ANY_PART(this, "xTranslatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorX[0], colorX[1], colorX[2]);
|
||||
color = SO_GET_ANY_PART(this, "yTranslatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorY[0], colorY[1], colorY[2]);
|
||||
color = SO_GET_ANY_PART(this, "zTranslatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorZ[0], colorZ[1], colorZ[2]);
|
||||
// Planar Translator
|
||||
color = SO_GET_ANY_PART(this, "xyPlanarTranslatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorZ[0], colorZ[1], colorZ[2]);
|
||||
color = SO_GET_ANY_PART(this, "yzPlanarTranslatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorX[0], colorX[1], colorX[2]);
|
||||
color = SO_GET_ANY_PART(this, "zxPlanarTranslatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorY[0], colorY[1], colorY[2]);
|
||||
// Rotator
|
||||
color = SO_GET_ANY_PART(this, "xRotatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorX[0], colorX[1], colorX[2]);
|
||||
color = SO_GET_ANY_PART(this, "yRotatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorY[0], colorY[1], colorY[2]);
|
||||
color = SO_GET_ANY_PART(this, "zRotatorColor", SoBaseColor);
|
||||
color->rgb.setValue(colorZ[0], colorZ[1], colorZ[2]);
|
||||
}
|
||||
|
||||
// Visibility API Functions
|
||||
|
||||
// Translator
|
||||
void SoFCCSysDragger::showTranslationX()
|
||||
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
* 'translationIncrementYCount' multiplied with
|
||||
* 'translationIncrement' for a full double
|
||||
* precision vector scalar.
|
||||
*
|
||||
*
|
||||
* @author qewer33
|
||||
*/
|
||||
class TPlanarDragger : public SoDragger
|
||||
@@ -278,6 +278,8 @@ public:
|
||||
SoIdleSensor idleSensor; //!< might be overkill, but want to make sure of performance.
|
||||
void setUpAutoScale(SoCamera *cameraIn); //!< used to setup the auto scaling of dragger.
|
||||
|
||||
void setAxisColors(unsigned long x, unsigned long y, unsigned long z); //!< set the axis colors.
|
||||
|
||||
//! @name Visibility Functions
|
||||
//@{
|
||||
void showTranslationX(); //!< show the x translation dragger.
|
||||
|
||||
@@ -64,11 +64,8 @@ public:
|
||||
FC_VIEW_PARAM(ShowSelectionBoundingBox,bool,Bool,false) \
|
||||
FC_VIEW_PARAM(PropertyViewTimer, unsigned long, Unsigned, 100) \
|
||||
FC_VIEW_PARAM(AxisXColor,unsigned long,Unsigned,0xCC333300) \
|
||||
FC_VIEW_PARAM(AxisXAltColor,unsigned long,Unsigned,0xCC4C4C00) \
|
||||
FC_VIEW_PARAM(AxisYColor,unsigned long,Unsigned,0x33CC3300) \
|
||||
FC_VIEW_PARAM(AxisYAltColor,unsigned long,Unsigned,0x4CCC4C00) \
|
||||
FC_VIEW_PARAM(AxisZColor,unsigned long,Unsigned,0x3333CC00) \
|
||||
FC_VIEW_PARAM(AxisZAltColor,unsigned long,Unsigned,0x4C4CCC00) \
|
||||
|
||||
|
||||
#undef FC_VIEW_PARAM
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <App/GeoFeature.h>
|
||||
#include <Base/Placement.h>
|
||||
#include "Gui/ViewParams.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "BitmapFactory.h"
|
||||
@@ -137,6 +138,11 @@ bool ViewProviderDragger::setEdit(int ModNum)
|
||||
|
||||
assert(!csysDragger);
|
||||
csysDragger = new SoFCCSysDragger();
|
||||
csysDragger->setAxisColors(
|
||||
Gui::ViewParams::instance()->getAxisXColor(),
|
||||
Gui::ViewParams::instance()->getAxisYColor(),
|
||||
Gui::ViewParams::instance()->getAxisZColor()
|
||||
);
|
||||
csysDragger->draggerSize.setValue(0.05f);
|
||||
csysDragger->translation.setValue(tempTransform->translation.getValue());
|
||||
csysDragger->rotation.setValue(tempTransform->rotation.getValue());
|
||||
|
||||
Reference in New Issue
Block a user