| 89 | { |
| 90 | |
| 91 | void ObjectTransformWidget::create( const Box3f& box, const AffineXf3f& worldXf, std::shared_ptr<ITransformControls> controls ) |
| 92 | { |
| 93 | if ( controlsRoot_ ) |
| 94 | reset(); |
| 95 | |
| 96 | boxDiagonal_ = box.size(); |
| 97 | controls_ = controls; |
| 98 | if ( !controls_ ) |
| 99 | { |
| 100 | auto thisControls = std::make_shared<TransformControls>(); |
| 101 | TransformControls::VisualParams params; |
| 102 | params.update( box ); |
| 103 | thisControls->setVisualParams( params ); |
| 104 | controls_ = thisControls; |
| 105 | } |
| 106 | // make x - arrow |
| 107 | controlsRoot_ = std::make_shared<Object>(); |
| 108 | controlsRoot_->setName( "TransformWidgetRoot" ); |
| 109 | controlsRoot_->setAncillary( true ); |
| 110 | |
| 111 | controls_->setCenter( box.center() ); |
| 112 | controls_->init( controlsRoot_ ); |
| 113 | |
| 114 | SceneRoot::get().addChild( controlsRoot_ ); |
| 115 | setControlsXf_( worldXf, true ); |
| 116 | |
| 117 | setTransformMode( ControlBit::FullMask ); |
| 118 | |
| 119 | // 10 group to imitate plugins behavior |
| 120 | connect( &getViewerInstance(), 10, boost::signals2::at_front ); |
| 121 | xfValidatorConnection_ = controlsRoot_->worldXfChangedSignal.connect( [&] () |
| 122 | { |
| 123 | if ( !approvedChange_ && picked_ ) |
| 124 | stopModify_(); |
| 125 | } ); |
| 126 | } |
| 127 | |
| 128 | void ObjectTransformWidget::reset() |
| 129 | { |
nothing calls this directly
no test coverage detected