Can't use Text Editor for JSON Arrays

0 favourites
  • 10 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I was using the Text Editor to edit my .json project file, which is basically a JSON array. After I closed the tab and reopened it it's now stuck on the Array Editor.

    The thing is, I'm using a tridimensional array to store my levels. X is the level, Y is the Tile Y position and Z is the Tile X position. Using the Text Editor I have a perfect view of each level, what doesn't happen in the array editor.

    Is there any way to force Construct 3 to open my JSON file on the TExt Editor as it was previously doing?

    Thanks in advance.

    Cheers!

  • JSON files which match the Array format will be opened in the Array editor instead of the text editor. If you use a slightly different format then it will be opened in the text editor instead. But I guess if you need the file to be loadable by the Array plugin then you will need to keep it in this format.

    There isn't a direct method of opening it in the text editor, although I think we might have had this in the past. The easiest way to trick the system is to rename the file and change the file extension to something other than "json". You will lose the JSON syntax highlighting doing this unfortunately. Also depending on what you change it to you might have issues loading the file in the runtime as the mimetype won't be JSON.

  • Nepeo Is it possible to add an option to rotate the view in the Array editor? (The view only, not the data).

    It's often much easier when the data is presented in columns, especially when editing a large array, or entering long lines of text.. It's more Excel-like, compact, can fit a lot more data into the same space. Compare:

  • dop2000 We probably could, but is there a reason why you can't just have your data structured in the other direction?

  • Nepeo I kind of used to store records in arrays on X axis and different fields in the record on Y axis.

    Besides, some events and expressions don't work the other way, for example, you can't do "Array for each Y element", or use IndexOf to find something on Y axis.

    I actually had to do this today - changed the structure of my array so that the data is now stored on Y axis, because it was really awkward to enter about a hundred of records in one row. I know there are workarounds (I can prepare the table in excel, convert to JSON etc.), but it would be much easier if there was an option to rotate the view in C3.

  • I figured it would be something along those lines. Thanks for taking the time to explain.

    Flipping the axis like this would probably mean us having to rebuild the view. Then have some logic when creating/reading that data back to map it to the corrected axis. As arrays are 3D there are 3 possible flips, and 6 combinations ( 3 * 2 * 1 ) which makes the remapping logic more complicated ( as well as the associated UI ).

    In your situation your just interested in "viewing it the other way" but modifying the data is actually easier to implement I think. Also it actually allows you to change the data instead of the view, which some people will want to do.

    This will probably end up towards the bottom of the TODO list unfortunately, but I will add it to my notes to investigate.

  • If you are saying that transposing the data is easier to implement, I guess it's an even better (more universal) solution!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah sorry I spent about 20 minutes trying to wrap my head around how it would work, comes across in how I explained it! I was proposing a transpose feature yes. 3 buttons transpose x - y, transpose x - z, transpose y - z

    The data editor is on it's second major revision and it's still quite complicated to work with. I have ideas on how to improve it further, but can't justify the time required to tear it to pieces and rebuild

    it again. Which is a shame, because I think it would have made this easier.

  • Nepeo, thanks so much for adding the transpose option in array editor!

  • No worries dop2000 I hope it comes in handy. I ended up just putting in options for doing an x/y transpose. It seemed the simplest and the most useful. You can also choose to transpose a single layer or the whole editor, due to transposing swapping the width/height of the array you can only transpose a single layer if the width and height are the same.

    I spent a fair amount of time considering what adjustments could be made to the data editor regarding improving memory usage, but the files would be so massive anyway I don't think there is much point! So yeah just did this the simple way, but it might be slow for massive files.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)