mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 18:39:55 +00:00
Don't show tooltip when a new frame/layer is created from a script transaction
This might improve the performance of some scripts if it creates several frames/layers at the same time.
This commit is contained in:
parent
11417c56ac
commit
43513e0f1b
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -93,6 +93,14 @@ void NewFrameCommand::onExecute(Context* context)
|
||||
ContextWriter writer(context);
|
||||
Doc* document(writer.document());
|
||||
Sprite* sprite(writer.sprite());
|
||||
|
||||
#if ENABLE_UI
|
||||
// Show the tooltip feedback only if we are not inside a transaction
|
||||
// (e.g. we can be already in a transaction if we are running in a
|
||||
// Lua script app.transaction()).
|
||||
const bool showTooltip = (document->transaction() == nullptr);
|
||||
#endif
|
||||
|
||||
{
|
||||
Tx tx(writer.context(), friendlyName());
|
||||
DocApi api = document->getApi(tx);
|
||||
@ -169,7 +177,7 @@ void NewFrameCommand::onExecute(Context* context)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UI
|
||||
if (context->isUIAvailable()) {
|
||||
if (context->isUIAvailable() && showTooltip) {
|
||||
update_screen_for_document(document);
|
||||
|
||||
StatusBar::instance()->showTip(
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -148,6 +148,13 @@ void NewLayerCommand::onExecute(Context* context)
|
||||
Sprite* sprite(writer.sprite());
|
||||
std::string name;
|
||||
|
||||
#if ENABLE_UI
|
||||
// Show the tooltip feedback only if we are not inside a transaction
|
||||
// (e.g. we can be already in a transaction if we are running in a
|
||||
// Lua script app.transaction()).
|
||||
const bool showTooltip = (document->transaction() == nullptr);
|
||||
#endif
|
||||
|
||||
Doc* pasteDoc = nullptr;
|
||||
Scoped destroyPasteDoc(
|
||||
[&pasteDoc, context]{
|
||||
@ -416,10 +423,9 @@ void NewLayerCommand::onExecute(Context* context)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UI
|
||||
if (context->isUIAvailable()) {
|
||||
if (context->isUIAvailable() && showTooltip) {
|
||||
update_screen_for_document(document);
|
||||
|
||||
StatusBar::instance()->invalidate();
|
||||
StatusBar::instance()->showTip(
|
||||
1000, fmt::format("{} '{}' created",
|
||||
layerPrefix(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user