diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index 56f84ae3d9..6880ff9249 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -635,6 +635,21 @@ void Placement::on_resetButton_clicked() onPlacementChanged(0); } +void Placement::bindObject() +{ + if (!selectionObjects.empty()) { + App::DocumentObject* obj = selectionObjects.front().getObject(); + + ui->xPos->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Base.x"))); + ui->yPos->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Base.y"))); + ui->zPos->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Base.z"))); + + ui->yawAngle ->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Rotation.Yaw"))); + ui->pitchAngle->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Rotation.Pitch"))); + ui->rollAngle ->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Rotation.Roll"))); + } +} + void Placement::directionActivated(int index) { if (ui->directionActivated(this, index)) { @@ -840,6 +855,11 @@ TaskPlacement::~TaskPlacement() // automatically deleted in the sub-class } +void TaskPlacement::bindObject() +{ + widget->bindObject(); +} + void TaskPlacement::open() { widget->open(); diff --git a/src/Gui/Placement.h b/src/Gui/Placement.h index d7122d8aff..87be33bb88 100644 --- a/src/Gui/Placement.h +++ b/src/Gui/Placement.h @@ -51,6 +51,7 @@ public: void accept(); void reject(); + void bindObject(); Base::Vector3d getDirection() const; void setPlacement(const Base::Placement&); Base::Placement getPlacement() const; @@ -134,6 +135,7 @@ public: public: void setPropertyName(const QString&); void setPlacement(const Base::Placement&); + void bindObject(); bool accept(); bool reject(); void clicked(int id); diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 0351c919c9..621e766637 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -1932,6 +1932,7 @@ void PlacementEditor::browse() } task->setPlacement(value().value()); task->setPropertyName(propertyname); + task->bindObject(); Gui::Control().showDialog(task); }