Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
make exposed controls inherit name of node if control's name is empty,
Browse files Browse the repository at this point in the history
…fixes #11
  • Loading branch information
cpdt committed Sep 15, 2018
1 parent b9340ec commit 9562fe4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion editor/model/objects/Control.cpp
Expand Up @@ -47,7 +47,10 @@ Control::Control(AxiomModel::Control::ControlType controlType, AxiomModel::Conne
findLater<Control *>(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);
});
}
}
Expand Down Expand Up @@ -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());
}
}
2 changes: 2 additions & 0 deletions editor/model/objects/Control.h
Expand Up @@ -141,5 +141,7 @@ namespace AxiomModel {
void updateSinkPos();

void updateExposerRemoved();

void updateExposingName(Control *exposingControl);
};
}

0 comments on commit 9562fe4

Please sign in to comment.