Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output_abs_xy option #187

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix incorrect order in JSON output
  • Loading branch information
thenewvu committed Feb 7, 2015
commit 9c9de11e06c58cbdf008edaeecbc75ca9cbf6bb9
2 changes: 1 addition & 1 deletion glue/formats/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def needs_rebuild(self):
return False

def render(self, *args, **kwargs):
return json.dumps(self.get_context(*args, **kwargs))
return json.dumps(self.get_context(*args, **kwargs), indent=4)


class BasePlistFormat(BaseTextFormat):
Expand Down
5 changes: 3 additions & 2 deletions glue/formats/jsonformat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections import OrderedDict
import os
import json
import codecs
Expand Down Expand Up @@ -33,7 +34,7 @@ def populate_argument_parser(cls, parser):
def get_context(self, *args, **kwargs):
context = super(JSONFormat, self).get_context(*args, **kwargs)

frames = dict([[i['filename'], {'filename': i['filename'],
frames = OrderedDict([[i['filename'], {'filename': i['filename'],
'frame': {'x': i['x'],
'y': i['y'],
'w': i['width'],
Expand All @@ -47,7 +48,7 @@ def get_context(self, *args, **kwargs):
'sourceSize': {'w': i['original_width'],
'h': i['original_height']}}] for i in context['images']])

data = dict(frames=None, meta={'version': context['version'],
data = OrderedDict(frames=None, meta={'version': context['version'],
'hash': context['hash'],
'name': context['name'],
'sprite_path': context['sprite_path'],
Expand Down