Fix bug showing invalid layer name in Layer Props dialog after "New Layer" command

This commit is contained in:
David Capello 2015-08-21 14:55:34 -03:00
parent 5dfe7b64ae
commit 214f886a0e
4 changed files with 5 additions and 5 deletions

View File

@ -294,7 +294,7 @@ void ImportSpriteSheetCommand::onExecute(Context* context)
DocumentApi api = document->getApi(transaction);
// Add the layer in the sprite.
LayerImage* resultLayer = api.newLayer(sprite);
LayerImage* resultLayer = api.newLayer(sprite, "Sprite Sheet");
// Add all frames+cels to the new layer
for (size_t i=0; i<animation.size(); ++i) {

View File

@ -107,7 +107,7 @@ void NewLayerCommand::onExecute(Context* context)
{
Transaction transaction(writer.context(), "New Layer");
DocumentApi api = document->getApi(transaction);
layer = api.newLayer(sprite);
layer = api.newLayer(sprite, name);
// If "top" parameter is false, create the layer above the active
// one.
@ -116,7 +116,6 @@ void NewLayerCommand::onExecute(Context* context)
transaction.commit();
}
layer->setName(name);
update_screen_for_document(document);
StatusBar::instance()->invalidate();

View File

@ -392,9 +392,10 @@ void DocumentApi::swapCel(
if (cel2) setCelFramePosition(cel2, frame1);
}
LayerImage* DocumentApi::newLayer(Sprite* sprite)
LayerImage* DocumentApi::newLayer(Sprite* sprite, const std::string& name)
{
LayerImage* layer = new LayerImage(sprite);
layer->setName(name);
addLayer(sprite->folder(), layer,
sprite->folder()->getLastLayer());

View File

@ -80,7 +80,7 @@ namespace app {
LayerImage* layer, frame_t frame1, frame_t frame2);
// Layers API
LayerImage* newLayer(Sprite* sprite);
LayerImage* newLayer(Sprite* sprite, const std::string& name);
LayerFolder* newLayerFolder(Sprite* sprite);
void addLayer(LayerFolder* folder, Layer* newLayer, Layer* afterThis);
void removeLayer(Layer* layer);