DiegoM's Forum Posts

  • eleanorjmorel

    It sounds like it should be possible.

    If you haven't already, you should try importing some folders and zip files manually into the Animations Editor, that way you will get a feel of what the results are going to be. That will help in making clear what your application should produce.

    There is a subtle difference between importing folders and zip files, which is not too difficult to understand once you try it out yourself, but when explained through text it can get confusing and might seem more complex than it actually is.

    As for your problem with reading the json content, this snippet should do it

    	zip.file("docData.json").async("uint8array").then(function (d) {
    		const text = new TextDecoder().decode(d);
    	
    		// Print JSON as a raw string
    		console.log(text);
    		
    		// Parse string into Javascript object
    		const jsonObject = JSON.parse(text);
    	});
    

    I found in JSZip's documentation https://stuk.github.io/jszip/documentation/examples.html that you should be able to read directly as a string, but that didn't work. Fortunately, it supports reading as a typed array and you can then decode that using the TextDecoder object.

    That snippet is the most basic use case, watch out when doing asynchronous work inside a for loop, it might have unexpected results if you don't manage it properly.

  • As of r252 support for importing animations frames from zip files and folders has been implemented, and as is usually the case, there are a few things which are not immediately obvious about the feature. So let's talk about that.

    Let's start with the basic use cases.

    Basics

    Importing folders

    • Dragging and dropping a folder into the Animations panel, will create a new sub folder with a new animation inside of it. The animation will have frames for all images found at the root level of the folder. Both the new sub folder and the animation will have the name of the dropped folder.
    • Dragging and dropping a folder into the Frames panel or the Main drawing area will add all the individual images in the folder as frames of the current animation.

    Importing zip files

    • Dragging and dropping a zip file into the Animations panel, will create a new animation with all images found at the root level of the zip file. The animation will have the same name as the zip file.
    • Dragging and dropping a zip file into the Frames panel or the Main drawing area will add all the individual images in the zip file as frames of the current animation.

    Importing from the toolbar options

    The toolbar Load button now has two options. Load frames and Load animations.

    • Load frames allows you to pick images to be loaded as frames of the current animation. Is is now also possible to pick zip files from the file picker. All images in a zip file will be added as frames of the current animation.
    • Load animations allows you to pick images to be loaded into a new animation. Is is now also possible to pick zip files from the file picker. A new animation will be created with all of the individual images picked, while each picked zip file will correspond to a new animation being created.

    Nested content

    Folders and zip files which in turn also have folders and zip files inside of them are supported, depending on how you try to import these, this is how C3 will behave.

    • Dropping in the Animations Panel: C3 will process everything and create animations and sub folders as needed.
    • Dropping in the Frames Panel or Drawing Area: all of the nested content will be turned into a flat list and added as frames to the current animation.
    • Toolbar Load Frames option: all the nested content inside a zip file will be turned into a flat list and added to the current animation.
    • Toolbar Load Animations option: if a zip file with nested content is loaded, the images at the root level of the zip will be used to create an animation, if other zip files are found, new animations will be created for them. If a folder is found in a zip file, a sub folder with an animation inside of it will be created, following the same patters as importing a folder.

    The key points to remember are:

    • Importing folders will create a sub folder with an animation inside of it, both named after the original folder. The animation will have frames corresponding to the images found at the root level of the original folder.
    • Importing zip files will create an animation named after the zip file and will have frames corresponding to all the images found at the root level of the zip file.
    • If nested content is found, the same pattern applies. Each folder will correspond to a new sub folder with a new animation inside of it. Each zip file will correspond to a new animation.

    Optional configuration file

    Normally when importing a single file, C3 asks if the file should be treated as a sprite sheet or as a single file. In the case of importing multiple files this isn't really an option. Because of that, when importing folders or zips, even if an animation ends up having only one frame, C3 never asks how it it should be treated.

    To get around this problem, a special configuration file can be added to a folder or zip file to tell C3 how it should handle the files found on them.

    It's a simple JSON file, must be named c3-import-settings.json and should look like this:

    {
    	"import-mode": "spritesheet",
    	
    	"sort": "alphabetical",
    	
    	"order": "ascending",
    
    	"replace-existing-animation": false,
    	
    	"replace-existing-folder": false,
    
    	"use-raw-folder-names": false,
    
    	"spritesheet": {
    		"horizontal-cells": 4,
    		"vertical-cells": 4,
    		"direction": "horizontal"
    	},
    	
    	"svg": {
    		"width": 100,
    		"height": 100
    	},
    
    	"animation": {
    		"name": "optional-animation-name",
    		"speed": 5,
    		"loop": false,
    		"repeat-count": 1,
    		"repeat-to": 0,
    		"ping-pong": false,
    		"frame-durations": [1, 2, 3, 4],
    		"frame-collision-polys": [
    			{"points":[0,0,1,0,1,1,0,1]},
    			{"points":[0,0,1,0,1,1,0,1]},
    			{"points":[0,0,1,0,1,1,0,1]},
    			{"points":[0,0,1,0,1,1,0,1]}
    		],
    		"frame-image-points":[
    			[{"originX":0.5,"originY":0.5}, {"name":"Image Point 1","x":0.5,"y":0.5}],
    			[{"originX":0.5,"originY":0.5}],
    			[{"originX":0.5,"originY":0.5}],
    			[{"originX":0.5,"originY":0.5}]
    		],
    		"frame-tags":["tag-1", "tag-2", "tag-3", "tag-4"]
    	}
    }
    

    This special file can be placed at the root of a folder or zip structure and will affect all content found.

    Another file with the same name can be placed further down the hierarchy and will take precedence over the ones found before. That way you can configure different sets of files to be interpreted differently when imported.

    I think that covers everything about this new feature.

  • Don't mean to be negative... But i'll indulge myself.

    This suggestion was already made in the suggestions platform, and it was declined.

    construct3.ideas.aha.io/ideas/C3-I-1463

    Mainly because the task can already be achieved and the performance impact (if any) is negligible.

    At the end of the day, the only real benefit of this feature would be having a specialised object type with it's accompanying special icon in the project bar and event sheets.

    While aesthetically pleasing, it's not worth it from a development stand point. From the user perspective, it would just be a little extra thing that beginner's would be left scratching their heads at. There are already plenty of those as it is.

  • The shortcuts Ctrl + Shift + 🡐 and Ctrl + Shift + 🡒 can be used to navigate between the open tabs.

    Is that what you mean? I am not super familiar with Visual Studio UI, I think the last version I used was Visual Studio 2004 :P

  • Took a look at this, and found a little problem.

    If you open the .tmx in Tiled and take a look at the Tile Layer Format property in the map's main properties, it is set to Base64 (Zstandard compressed). The problem with this is that it looks like C3 is not even handling that case, so it just ignores it and doesn't do what it needs to do when it comes to the un-compression step it does when loading a map.

    If you change the property to anything else, Base64 (zlib compressed) will work, and try loading in C3, then it will work.

    I'm an not very familiar with Tiled so it took me a while to realize how to show the main properties, found them in Map -> Map Properties.

    Anyway, that should sort you out. C3 should at least say that the compression type is not supported, should be an easy fix.

  • Can you share the .tmx file you are using?

  • The documentation is a bit cryptic for those two shortcuts.

    Looking at the code it seems that they are only for the dialogs relating to setting actions, conditions and their parameters. With those you can move back and forth the different dialogs that are presented.

    The back shortcut also works in the expressions dictionary.

    An additional extra caveat which I just found out, which is not documented, is that the shortcuts do not work when an input element has focus, and in the case of most of those dialogs, the search input will automatically have focus, which means the shortcuts won't work!

    For that there are variants, Alt + Shift + B and Alt + Shift + N, for back and next respectively, those will have the intended effect regardless of an input element having focus.

    The first step would be to document those hidden shortcuts... but I am not really sure why they are needed in the first place.

  • This is a deceptively complex problem, fortunately you don't have to do any of it. With a little script you can take advantage of the Intl object, which is provided by modern browsers.

    It has a lot of interesting features geared towards translating strings, the one of interest is the number formatter.

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat

    Here is an example, that formats a number according to the English language. It has many more options.

    https://www.dropbox.com/s/rjzccrakmwcrs3h/NumberFormat.c3p?dl=0

  • Can you share the project you are working on? Or an example that shows the problem?

    From your explanation it should work.

  • The Pin behaviour is not going anywhere, don't worry about that. It is too widely used to even consider getting rid of it.

    I guess that "replacing" was the wrong term to use.

    What happens is, scene graph transformations solve a lot of the problems where the Pin behaviour fell short or was too cumbersome to use. So in that sense it is a replacement.

    Having said that, both features are widely different in their inner workings, so the Pin behaviour can never really be completely replaced.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's better if you submit an issue in our tracker, as this thread might be quickly forgotten.

    As for key count and performance, I really don't know. Haven't really tested Javascript's limitations myself in that regard, so I can't tell.

  • The limit is arbitrary, it has to have one as memory is not infinite.

    I did notice a couple of things though.

    1) It looks like it is a bug that you can continue to add rows after the limit is reached.

    2) Dictionary could most likely do with a larger limit.

    I think the 1000 limit was put in there because of the array editor, where you can have 100 sheets of 1000 rows and 1000 columns each, which can potentially be a ton of data.

    In the case of dictionaries the limit could be much larger, because the columns are always 2 and there are no sheets.

    In the mean time you'll have to deal with 1000 limit.

  • If I had to guess I'd say it is possible to add what you want. If I were to do it though, I would need to first understand the subject. I really have no idea about noise and it has never been something which I found particularly interesting.

    If there wasn't anything else for me to do, I wouldn't mind giving it a try. But I already have a bunch of other things waiting to be done.

    So I guess you will need to re-invent the wheel? It would probably be faster than waiting for me to figure out all that stuff.

  • Have you tried writing a script in C3 and use DOMParser? You still need to do some coding, but it's all kept in C3.

    I'm sure extracting data from HTML like that will be much more convenient than working with regular expressions and raw text.

    Either way I think you are going to need some coding because C3 really doesn't have anything built for this specific task.

  • I am not super familiar with PHP, but if you need to do DOM parsing, you are better of using a library. Avoid rolling your own regular expressions like the plague, it will only cause you trouble in the future.

    Looking around I found this PHP DOM manipulation library github.com/ivopetkov/html5-dom-document-php/, have never used it, but it looks promising and has a bunch of stars in github. And it seems to have documentation, which is always a plus.

    Even if you are using a library, the problem with scraping is that it depends on the layout you are trying to get data from, so if that changes, you need to update your code. Because of that reason, in the past I found that it is better to keep your queries just specific enough to get what you want, in the case the layout changes a little bit, but not too much, you might get away without changing anything on your side.

    What does this has to do with C3?