24 #include <Inventor/manips/SoTransformerManip.h>
27 #include "../controller/RotateTranslateOperation.h"
31 if (
ScenePtr scene = this->scene.lock())
33 this->manipulatorMode = mode;
35 for (
SceneObjectPtr object : scene->getSelectionManager()->getAllSelected())
37 object->applyManipulator();
43 void scene3D::SceneManipulatorManager::manipulatorStartCallback(
void* userdata, SoDragger* dragger)
45 std::pair<SceneObject*, Scene*>*
data = (std::pair<SceneObject*, Scene*>*) userdata;
49 for (
SceneObjectPtr sceneobject : scene->sceneSelectionManager->getAllSelected())
51 sceneobject->pushHistory();
53 if (sceneobject !=
object)
55 sceneobject->trackThisTransformation(object->manipNode);
58 sceneobject->isManipulated =
true;
62 void scene3D::SceneManipulatorManager::manipulatorValueChangedCallback(
void* userdata, SoDragger* dragger)
64 std::pair<SceneObject*, Scene*>*
data = (std::pair<SceneObject*, Scene*>*) userdata;
65 SceneObject*
object =
data->first;
66 Scene* scene =
data->second;
70 std::vector<std::string> changed;
71 changed.push_back(object->getObjectId());
76 void scene3D::SceneManipulatorManager::manipulatorFinishCallback(
void* userdata, SoDragger* dragger)
78 Scene* scene = (Scene*)userdata;
82 std::shared_ptr<std::vector<controller::OperationPtr> > operations(
new std::vector<controller::OperationPtr>());
84 for (
SceneObjectPtr sceneobject : scene->sceneSelectionManager->getAllSelected())
89 controller->getScene(), sceneobject->getObjectId(),
90 sceneobject->getHistoryRotation(), sceneobject->getRotation(),
91 sceneobject->getHistoryTranslation(), sceneobject->getTranslation()));
93 operations->push_back(operation);
95 sceneobject->untrackTransformations();
96 sceneobject->isManipulated =
false;
112 SoTransformerManip* manip =
new SoTransformerManip;
113 SoSeparator* nullSep =
new SoSeparator;
116 manip->getDragger()->setPart(
"scale1", nullSep);
117 manip->getDragger()->setPart(
"scale2", nullSep);
118 manip->getDragger()->setPart(
"scale3", nullSep);
119 manip->getDragger()->setPart(
"scale4", nullSep);
120 manip->getDragger()->setPart(
"scale5", nullSep);
121 manip->getDragger()->setPart(
"scale6", nullSep);
122 manip->getDragger()->setPart(
"scale7", nullSep);
123 manip->getDragger()->setPart(
"scale8", nullSep);
132 manip->getDragger()->setPart(
"translator1", nullSep);
133 manip->getDragger()->setPart(
"translator2", nullSep);
134 manip->getDragger()->setPart(
"translator3", nullSep);
135 manip->getDragger()->setPart(
"translator4", nullSep);
136 manip->getDragger()->setPart(
"translator5", nullSep);
137 manip->getDragger()->setPart(
"translator6", nullSep);
144 manip->getDragger()->setPart(
"rotator1", nullSep);
145 manip->getDragger()->setPart(
"rotator2", nullSep);
146 manip->getDragger()->setPart(
"rotator3", nullSep);
147 manip->getDragger()->setPart(
"rotator4", nullSep);
148 manip->getDragger()->setPart(
"rotator5", nullSep);
149 manip->getDragger()->setPart(
"rotator6", nullSep);
153 if (
ScenePtr scene = this->scene.lock())
155 manip->getDragger()->addStartCallback(manipulatorStartCallback,
new std::pair<SceneObject*, Scene*>(
object.get(), scene.get()));
156 manip->getDragger()->addValueChangedCallback(manipulatorValueChangedCallback,
new std::pair<SceneObject*, Scene*>(
object.get(), scene.get()));
157 manip->getDragger()->addFinishCallback(manipulatorFinishCallback, scene.get());
160 object->addManipulator(manip);
165 object->applyManipulator();
170 return this->manipulatorMode;