diff --git a/editor/model/objects/Control.cpp b/editor/model/objects/Control.cpp index 6eb16966..35fd9037 100644 --- a/editor/model/objects/Control.cpp +++ b/editor/model/objects/Control.cpp @@ -47,7 +47,10 @@ Control::Control(AxiomModel::Control::ControlType controlType, AxiomModel::Conne findLater(root->controls(), _exposingUuid).then([this, uuid](Control *exposing) { exposing->setExposerUuid(uuid); - exposing->nameChanged.connect(this, &Control::setName); + exposing->nameChanged.connect(this, [this, exposing](const QString &) { updateExposingName(exposing); }); + exposing->surface()->node()->nameChanged.connect( + this, [this, exposing](const QString &) { updateExposingName(exposing); }); + updateExposingName(exposing); }); } } @@ -211,3 +214,12 @@ void Control::updateExposerRemoved() { if (baseControl) (*baseControl)->setExposerUuid(QUuid()); } } + +void Control::updateExposingName(AxiomModel::Control *exposingControl) { + // if the control doesn't have a name, use the name of the node + if (exposingControl->name().isEmpty()) { + setName(exposingControl->surface()->node()->name()); + } else { + setName(exposingControl->name()); + } +} diff --git a/editor/model/objects/Control.h b/editor/model/objects/Control.h index c37e3ad1..6651e70b 100644 --- a/editor/model/objects/Control.h +++ b/editor/model/objects/Control.h @@ -141,5 +141,7 @@ namespace AxiomModel { void updateSinkPos(); void updateExposerRemoved(); + + void updateExposingName(Control *exposingControl); }; }