[aseprite] 198/308: Fix setting opacity or user data of linked cels when the first cel isn't included in the active range

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:45:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit be57d0332f2cee3b4aa3478cc9c35fa967822d4f
Author: David Capello <davidcapello at gmail.com>
Date:   Mon Feb 1 18:05:40 2016 -0300

    Fix setting opacity or user data of linked cels when the first cel isn't included in the active range
---
 src/app/commands/cmd_cel_properties.cpp | 18 ++++++++++--------
 src/doc/sprite.cpp                      |  5 +++++
 src/doc/sprite.h                        |  3 ++-
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/app/commands/cmd_cel_properties.cpp b/src/app/commands/cmd_cel_properties.cpp
index 510b529..ee8eb8b 100644
--- a/src/app/commands/cmd_cel_properties.cpp
+++ b/src/app/commands/cmd_cel_properties.cpp
@@ -106,10 +106,11 @@ private:
       return 1;
     }
     else if (m_range.enabled()) {
+      Sprite* sprite = m_document->sprite();
       int count = 0;
-      for (Cel* cel : m_document->sprite()->uniqueCels()) {
-        if (m_range.inRange(cel->sprite()->layerToIndex(cel->layer()),
-                            cel->frame())) {
+      for (Cel* cel : sprite->uniqueCels(m_range.frameBegin(),
+                                         m_range.frameEnd())) {
+        if (m_range.inRange(sprite->layerToIndex(cel->layer()))) {
           if (backgroundCount && cel->layer()->isBackground())
             ++(*backgroundCount);
           ++count;
@@ -183,11 +184,12 @@ private:
             App::instance()->getMainWindow()->getTimeline()->invalidate();
           }
         }
-        else {
-          for (Cel* cel : m_document->sprite()->uniqueCels()) {
-            if (m_range.inRange(cel->sprite()->layerToIndex(cel->layer()), cel->frame())) {
-              if (!cel->layer()->isBackground() &&
-                  newOpacity != cel->opacity()) {
+        else if (m_range.enabled()) {
+          Sprite* sprite = m_document->sprite();
+          for (Cel* cel : sprite->uniqueCels(m_range.frameBegin(),
+                                             m_range.frameEnd())) {
+            if (m_range.inRange(sprite->layerToIndex(cel->layer()))) {
+              if (!cel->layer()->isBackground() && newOpacity != cel->opacity()) {
                 transaction.execute(new cmd::SetCelOpacity(cel, newOpacity));
               }
 
diff --git a/src/doc/sprite.cpp b/src/doc/sprite.cpp
index a4243b7..828e63f 100644
--- a/src/doc/sprite.cpp
+++ b/src/doc/sprite.cpp
@@ -555,6 +555,11 @@ CelsRange Sprite::uniqueCels() const
   return CelsRange(this, frame_t(0), lastFrame(), CelsRange::UNIQUE);
 }
 
+CelsRange Sprite::uniqueCels(frame_t from, frame_t to) const
+{
+  return CelsRange(this, from, to, CelsRange::UNIQUE);
+}
+
 //////////////////////////////////////////////////////////////////////
 
 static Layer* index2layer(const Layer* layer, const LayerIndex& index, int* index_count)
diff --git a/src/doc/sprite.h b/src/doc/sprite.h
index f460d31..e54965c 100644
--- a/src/doc/sprite.h
+++ b/src/doc/sprite.h
@@ -1,5 +1,5 @@
 // Aseprite Document Library
-// Copyright (c) 2001-2015 David Capello
+// Copyright (c) 2001-2016 David Capello
 //
 // This file is released under the terms of the MIT license.
 // Read LICENSE.txt for more information.
@@ -151,6 +151,7 @@ namespace doc {
     CelsRange cels() const;
     CelsRange cels(frame_t frame) const;
     CelsRange uniqueCels() const;
+    CelsRange uniqueCels(frame_t from, frame_t to) const;
 
   private:
     Document* m_document;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list