Page 1 of 3

Preview of "RICcreator", yet another RIC editor

Posted: 18 May 2011, 22:53
by spillerrec
As I stated back in early December, I started to write a program to edit RIC files. I used this as my final project in the Programming course I have been taking in high school. (Didn't really get much out of it though...)
Now that I know I don't need to attend an exam in the subject I'm releasing it.
You can download it here: http://sourceforge.net/projects/riccreator/files/
RICcreator rev 55.jpg
It is still far from a finished editor, but it supports and renders nearly everything in the RIC format right now.
What it doesn't render correctly yet:
  • NumberOut opcode is not drawn (since I will implement this by using RIC fonts)
  • Ellipse implementation renders incorrectly quite often
  • Fill Shape isn't implemented for Ellipse (and therefore Circle) and Polygon
  • Polyline not added
  • RIC fonts
Otherwise everything else, CopyBits, VarMaps, parameters and CopyOptions should work as they do on the enhanced firmware.

So what isn't quite complete is the interface to edit the files. As of now only the shape objects (line, rectangle, circle) can be edited by numerical input. (And you can't edit the CopyOptions since that control is bugged...)
Well, it is an beginning...

Anyway, this thing should work in Linux and Mac too, though I haven't tested it.
I made it to compile on Linux, but I got two QT errors that I had to resolve first. I had to remove two lines that made the tabs movable and added a close button to them... I might have downloaded an old version of QT? I left it in the code for now though, so if any more experienced Linux people would try to compile it I would be grateful.

Re: Preview of "RICcreator", yet another RIC editor

Posted: 19 May 2011, 08:08
by muntoo
You should push your SVN repository onto https://riccreator.svn.sourceforge.net/ ... riccreator... it's empty.

Can you also include the binaries? I've been struggling with compiling/installing/integrating Qt with MSVS2010 Pro for weeks...

----

I'm curious: what did you get for it (marks)?

(I'll make further comments later, but it's 1 AM, and I really should get going.)

Re: Preview of "RICcreator", yet another RIC editor

Posted: 19 May 2011, 09:56
by spillerrec
I have tried to move my existing SVN repository up on SourceForge but I couldn't quite figure it out and I don't want to start on a fresh one...

There should be a compiled version up there, though not the newest revision. (I wanted to try to include the dlls to see if I could reduce the file size a bit, but it was still over 10MB... So I will just let it use dynamic linking for now.) Is there any issues with running that version?
There isn't much change between the two revisions though, the only thing you will notice is that when you add new elements, it will have some default values now. I will upload a new version as soon as I recompile QT...


I have not gotten any response from my teacher yet, however I got an A (ECTS) in the subject.
Since it was an introductory course in programming I sorta knew everything beforehand... So it was basically some free time in school where I could work on some programming : D

Re: Preview of "RICcreator", yet another RIC editor

Posted: 19 May 2011, 18:22
by nxtboyiii
I cannot create sprites!

Re: Preview of "RICcreator", yet another RIC editor

Posted: 19 May 2011, 18:40
by afanofosc
I moved my existing SVN repository for the enhanced NBC/NXC firmware to the mindboards SVN repository recently. I figured out how to do it using Google and the sourceforge documentation. Here's a link I didn't have when I did it but it seems like it does a great job of explaining the process.

http://dukeslittleb.wordpress.com/2010/ ... epository/

John Hansen

Re: Preview of "RICcreator", yet another RIC editor

Posted: 19 May 2011, 23:07
by spillerrec
nxtboy,
Sprites can currently not be edited so I disabled adding new sprites. I'm currently working on that though so it should be done in the near future.

John,
After trying to compile a program I didn't need, to find out that my SVN version was too old, trying without luck to update it, trowing it out and installing another Linux distro instead and a few other issues I finally succeeded... I guess it just wasn't my day...
Anyway, thanks for the link.

Re: Preview of "RICcreator", yet another RIC editor

Posted: 21 May 2011, 17:58
by spillerrec
I have uploaded a new version which makes it possible to edit sprites and copybits.
Sprite editing is still fairly basic though.
Image
Only those shapes shown in the picture can be used and only in black color. (Another issue is that you can't change the ID...)
An interesting thing I noticed was that nxtRICedit seems to, when editing the sprite, use some default drawing commands and then convert them into 2 bit color. The circle drawing option doesn't always make perfectly symmetrical circles...

I use the nxtCanvas class to simulate a 2 bit canvas all drawing operations in the firmware. When the RIC file is loaded the its sprite data is converted into a nxtCanvas object. The editing GUI simply uses those commands to draw on the sprite.
It also means that every drawing method you can use in NXC will be possible to use to modify the sprite, for example drawing shapes with AND and XOR. When I have added it to nxtCanvas you will also be able to write with RIC fonts and draw polygons. If anyone thinks it could be useful to draw another RIC file on the sprite I can add that too.

There is one issue right now, the CopyOptions code I have written is a mess... I want to have it as a class, however the issue is that sometimes it needs to act on its own, and at other times it needs to be a member of a RIC file (to make parameters work). So the reason you can't draw in white right now is because it would have needed to set the CopyOptions to invert...

The separate dots in the screenshot is the draw command. In normal cases it will behave like in nxtRICedit, however this was done on the largest possible sprite which can be created in nxtRICedit which is 1024x512. The larger the canvas is, the slower the drawing is and therefore it didn't draw the dots often enough. The performance in nxtRICedit is much worse though, with less than 5 dots for the same drawing. (Ubuntu was running in a VM.)
I just tried something while writing. The resource hog seems to be in two different places, in mine it is in the drawing command while in nxtRICedit it is in the CopyBits command. Without the copybits statements it behaves pretty much like it should it nxtRICedit while RICcreator seems unaffected. And now that I think about it, I don't update the file preview in the corner while drawing so the CopyBits isn't even triggered...
Well, it needs some improvement here... EDIT: Improved it a bit, not perfect, but quite a bit better. No binary uploaded though.


On the other hand, I have fixed the GUI element to edit CopyOptions. It actually works now and it also hides the options that would have no effect for that element:
Image
As also apparent, the formatting doesn't look good in Ubuntu since the font size apparently was much larger... There was also a few other bugs when adding new elements on Ubuntu which needs to be fixed... Installing QT and compiling RICcreator worked like a charm though.


Again my usual habit with writing way too much even though I'm a slow writer...

Re: Preview of "RICcreator", yet another RIC editor

Posted: 27 Jun 2011, 19:15
by spillerrec
A month have passed and by so more work have been done. Release is on the SF project page, link in first post. This is a snapshot, there are several known bugs...
The most important changes:
  • Ellipses now draws correctly and supports fill_shape.
  • Simple FontTextOut() implemented.
  • Number opcode now draws (because of FontTextOut()). Looks different than nxtRICedit, but it correspond to the result achieved on my NXT. Did the font look different in the 1.x firmwares?
  • Sprite editing greatly improved and supports copyoptions.
  • Order of RIC objects can be changed, objects can be deleted.
  • Save dialog appears if you try to close a unsaved file. (It only appears for commands done in the program, closing the program using your operation system will not invoke it. (That is, using alt+F4, task manager, the exit button on the main window.))
  • Lot of internal changes. Some regressions with file saving might have appeared?
Screenshot:
RICcreator rev 111.jpg
I'm still working on making the editor for sprite better. Stuff like import of images, copy and paste, cropping, RIC font drawing and bucket fill is to come next. (scrollbars doesn't work very well right now either.)
What is done however is several mouse controls which I love in other image editing programs. Mouse wheel scrolling works, if shift is held down it scrolls horizontally, if control it zooms at the current position. And you can use these features to move the visible area while you are drawing. Middle mouse button also moves the view but since other mouse buttons will abort the current drawing operation this will too.
Starting a draw operation with right mouse button toggles the "Invert" copyoption. (Perhaps holding shift down while starting the draw operation should toggle "fill shape"?)
Using the control button while drawing rectangles or ellipses changes them into squares or circles. (It will limit lines to specific angles in the future, I'm just not sure which/how many would be good. Perhaps shift could increase the amount of angles?)

I will also add a few keyboard commands someday, like moving the view with the arrow keys, zooming with + and -, and copy-pasting with control+c, control+v.


How VarMaps should be edited still remains as a mystery to me. I just remembered how ridiculously annoying it is to edit them in nxtRICedit when I wanted to make a new RIC font... Well it could be improved greatly with some tweaking but I'm not sure this would end up being the best result.

Re: Preview of "RICcreator", yet another RIC editor

Posted: 28 Jun 2011, 05:17
by muntoo
Very nice.

Unfortunately, I seem to attract trouble. I discovered a number of bugs you should fix:
  • While freehand drawing, if you press Ctrl and scroll (to zoom in/out), a random line is drawn.
  • While zooming in/out (Ctrl+Scroll), it doesn't focus into where the mouse is pointing. Just keep zooming for a while, and it'll become obvious what I mean.
  • Revision 111 isn't compiling with Visual Studio. :(
Suggestions:
  • The Shift "Angle Lock" while drawing lines should be in 15 degree increments, as in Paint.NET. (0, 15, 30, 45, ..., 345)
  • Grid view should be optional. (A toggle-grid button in the toolbar, maybe?)

Re: Preview of "RICcreator", yet another RIC editor

Posted: 28 Jun 2011, 10:05
by spillerrec
As said, there are several known bugs. I have noticed the issue with freehand drawing.

I thought that the zooming problems was because the view is always aligned to the lower left pixel but looking into it again it seems it is also a bit inaccurate. I will try to improve it.

I don't have any issues with compiling revision 111 nor running it in the debugger. I'm not using Visual Studio though so what does it complain about?

I will in the future add a way to configure the grid, at which zoom levels the small and the large grid appears (individually), any offsets the large grid should have and what spacing the large grid should have. I will remember to add a way of temporary disabling the grid then.

I will use the 15 degree increments for drawing lines.

EDIT: Fixed freehand drawing, fixed zooming and added control modifier for line drawing.