aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/io_plugins/editor_atlas.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2015-11-11 17:39:06 -0300
committerJuan Linietsky2015-11-11 17:39:06 -0300
commit1d7e9c4ba52250db3b0b0fd732e44074252045d2 (patch)
treefa3e0c634bb4ac63383803900ce7f7a403184ecf /tools/editor/io_plugins/editor_atlas.cpp
parent61c4c5795ff9057b1c67142758418a4f982a0241 (diff)
downloadgodot-1d7e9c4ba52250db3b0b0fd732e44074252045d2.tar.gz
godot-1d7e9c4ba52250db3b0b0fd732e44074252045d2.tar.zst
godot-1d7e9c4ba52250db3b0b0fd732e44074252045d2.zip
-fixes to animatedsprite used with atlas
Diffstat (limited to '')
-rw-r--r--tools/editor/io_plugins/editor_atlas.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/editor/io_plugins/editor_atlas.cpp b/tools/editor/io_plugins/editor_atlas.cpp
index 4a260a9a6..7e9acd193 100644
--- a/tools/editor/io_plugins/editor_atlas.cpp
+++ b/tools/editor/io_plugins/editor_atlas.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_atlas.h"
-
+#include "print_string.h"
struct _EditorAtlasWorkRect {
@@ -83,6 +83,7 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
//place them
int ofs=0;
int limit_h=0;
+
for(int j=0;j<wrects.size();j++) {
@@ -100,6 +101,9 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
wrects[j].p.x=ofs;
wrects[j].p.y=from_y;
+
+
+
int end_h = from_y+wrects[j].s.height;
int end_w = ofs+wrects[j].s.width;
if (ofs==0)
@@ -116,7 +120,7 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
if (end_w > max_w)
max_w=end_w;
- if (ofs==0 || end_h>limit_h ) //while h limit not reched, keep stacking
+ //if (ofs==0 || end_h>limit_h ) //while h limit not reched, keep stacking
ofs+=wrects[j].s.width;
}
@@ -136,8 +140,8 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
for(int i=0;i<results.size();i++) {
- float h = nearest_power_of_2(results[i].max_h);
- float w = nearest_power_of_2(results[i].max_w);
+ float h = results[i].max_h;
+ float w = results[i].max_w;
float aspect = h>w ? h/w : w/h;
if (aspect < best_aspect) {
best=i;