Jump to content




[1.4.5] NPaintPro

utility

238 replies to this topic

#81 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 28 November 2012 - 05:59 PM

I LOVE THIS!!! I have been using it to make all sorts of pixel art!

Edit: Slight bug when printing to 3d:
While watching the cursor move on the screen, i noticed that in vertical printing, it will show the background color of the block above it while tracking the turtle.

Edited by Cranium, 28 November 2012 - 06:03 PM.


#82 mrgreaper

  • Members
  • 88 posts

Posted 05 December 2012 - 11:57 AM

ok i figured out how to make an animation and how to make it print in world 3d using a turtle but how do you display an animation onto a monitor (or even a just one picture?)

#83 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 05 December 2012 - 03:14 PM

View Postmrgreaper, on 05 December 2012 - 11:57 AM, said:

ok i figured out how to make an animation and how to make it print in world 3d using a turtle but how do you display an animation onto a monitor (or even a just one picture?)

I don't think there's an API for animation yet, and I've been distracted with other work.
You can use the paintutlis library however for drawing images on monitors (using the loadImage and drawImage functions).

When an animation API is released or I release my own, details will be posted here.

#84 ArchAngel075

  • Members
  • 149 posts

Posted 05 December 2012 - 06:51 PM

View Postnitrogenfingers, on 05 December 2012 - 03:14 PM, said:

View Postmrgreaper, on 05 December 2012 - 11:57 AM, said:

ok i figured out how to make an animation and how to make it print in world 3d using a turtle but how do you display an animation onto a monitor (or even a just one picture?)

I don't think there's an API for animation yet, and I've been distracted with other work.
You can use the paintutlis library however for drawing images on monitors (using the loadImage and drawImage functions).

When an animation API is released or I release my own, details will be posted here.


Hmm nitro, how do you store the animations? Are they all pasted one by one in a single file? Cause I can then definitely add de-compiling support for your animation files to my program for outputting animation to a monitor :) but if its a different I'm still happy to try adding it(since I've put off support for too long)

-end-

#85 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 05 December 2012 - 06:54 PM

You can open an NFA file in edit, it's plain text. The format for each image is identical to the NFP/standard picture format that Paint uses, but each frame is separated by a single ~ character.
So I usually have an additional table, the frames table, which in turns stores every image in the animation. When parsing, it's identical to parsing a paint file, but whenever you hit a ~, you just create a new frame and start on the next line.

#86 RadogoR

  • New Members
  • 1 posts

Posted 05 December 2012 - 10:44 PM

Awesome idea. Just awesome! I actually got here accidentally, surfing the news about ComputerCraft, but then I saw this 3d printing function... Oh my, I'm playing with it for an hour already )) It's actually a very handy thing in some cases.

I have just one question - how does the turtle "decide" which direction it should start printing? I tried it a couple of times with the same picture and it seems to me that it starts in a totally random direction. Or did I miss something?

#87 ArchAngel075

  • Members
  • 149 posts

Posted 05 December 2012 - 11:00 PM

View Postnitrogenfingers, on 05 December 2012 - 06:54 PM, said:

You can open an NFA file in edit, it's plain text. The format for each image is identical to the NFP/standard picture format that Paint uses, but each frame is separated by a single ~ character.
So I usually have an additional table, the frames table, which in turns stores every image in the animation. When parsing, it's identical to parsing a paint file, but whenever you hit a ~, you just create a new frame and start on the next line.

Thats the exact same trick i use with my .amov (compiled frame files(aka compiled .afr)) so I can just dupe my decompiler and adjust the frame break to use '~' and then make it auto output into a project folder, plus this makes me NEED to add additional file paths(since right now you can only use a project folder and not a folder within the project folder))

Thanks for the input!

In-fact I might look at your decompiler since mine derps at nil lines (i think i fixed this now though)

again thanks :)

#88 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 06 December 2012 - 12:52 AM

View PostRadogoR, on 05 December 2012 - 10:44 PM, said:

Awesome idea. Just awesome! I actually got here accidentally, surfing the news about ComputerCraft, but then I saw this 3d printing function... Oh my, I'm playing with it for an hour already )) It's actually a very handy thing in some cases.

I have just one question - how does the turtle "decide" which direction it should start printing? I tried it a couple of times with the same picture and it seems to me that it starts in a totally random direction. Or did I miss something?

Thanks :)

The printer should start in the direction it's facing. It will always start in the bottom left corner of the frontmost frame- so for a top/bottom layering it will start at the bottom left corner at the bottom frame and work up. For a forward layering I think it will move forward to the back frame (the highest frame) and print from the bottom left corner right/up.
It should do at least. If it doesn't, let me know.

#89 ArchAngel075

  • Members
  • 149 posts

Posted 06 December 2012 - 01:55 AM

Looking at how I decompile the animation files, i noticed there will be a problem if it hits nil, since i use a '&&' to signal end of file where yours does not...

Any suggestion to detect the end of your files?

-edit-

I will just make it check if a '&&' exists, else toss one at the end before attempting to decompile for safety.

#90 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 06 December 2012 - 03:11 AM

View PostArchAngel075, on 06 December 2012 - 01:55 AM, said:

Looking at how I decompile the animation files, i noticed there will be a problem if it hits nil, since i use a '&&' to signal end of file where yours does not...

Any suggestion to detect the end of your files?

-edit-

I will just make it check if a '&&' exists, else toss one at the end before attempting to decompile for safety.


You can check the loadFromNFA method in NPaintPro to see precisely how I parse the file, but EOF is easy. You don't need a dedicated character, I just use:

local file = io.open("file")
local line = nil
repeat
  line = file:read()
  --Your parse code here
until not line

When line becomes nil you've reached the end of the file.

#91 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 06 December 2012 - 09:27 AM

You're already using io.open(), which is excellent, so why not use this for the loop:

local file = io.open("filename", "r")
if file then
  for line in file:lines() do
    --parse code here
  end
  file:close()
else
  print("Could not open file!")
end


#92 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 06 December 2012 - 01:03 PM

A better solution- cheers Lyqyd :) I always forget the option...

#93 ArchAngel075

  • Members
  • 149 posts

Posted 06 December 2012 - 03:37 PM

problem with the basic paint editor is it has huge 5+ lines of nils in between each frame.. how will it handle those i wonder ?

but when i looked at some .amovs i made none had my end of file character, and worked fine, so no worries afaik.. still need to dupe my decompiler into a TEST file and check..

#94 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 11 December 2012 - 01:00 PM

An API companion has now been released for turning your NPaintPro sprites and creations into video game assets!

Posted Image


The GameUtils API converts NFP and NFA files in-program into game assets, that can be moved, transformed, repainted, animated and eventually collided against!
You can get it here: http://www.computerc...with-npaintpro/

The API is designed to be as fuss-free as possible- to get something drawing on screen immediately, just make a quick sprite, then call local mysprite = loadSprite(path, x, y), and then simply mysprite:draw().
Further updates for this (and NPaintPro) are on the way.

#95 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 19 December 2012 - 02:30 AM

Могли бы вы быть более конкретным?
И, возможно, на английском языке?
(Thanks Google Translate)

#96 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 19 December 2012 - 05:12 AM

3dprint pastebin link is broken. D:

#97 Tjakka5

  • Members
  • 256 posts

Posted 19 December 2012 - 05:28 AM

View Postnitrogenfingers, on 19 December 2012 - 02:30 AM, said:

Могли бы вы быть более конкретным?
И, возможно, на английском языке?
(Thanks Google Translate)

Lol, гэта даволі пацешна.

#98 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 December 2012 - 02:41 AM

Both pastebin links say unknown paste id. however i did get to them this way :P good thing your usernames are the same! ;)

http://pastebin.com/u/nitrogenfingers

#99 john3553

  • New Members
  • 1 posts

Posted 20 December 2012 - 04:37 PM

The 3dpaint program on pastebin says Unknown Paste ID.
I checked nitrogenfingers account but it doesn't have the program.
Please help!!

#100 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 21 December 2012 - 01:23 AM

Irritating, I did update them...

Probably another issue with the HTML on the forums. I'll make the update now.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users