Script request - Vector layer/group to PNG

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

hayasidist
Posts: 2122
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Script request - Vector layer/group to PNG

Post by hayasidist » Wed Apr 25, 2018 9:11 am

chucky wrote:...<snip>
Only one thing bugged it out... an old file using the offset on 0 , that froze the file at render... no big deal.

<snip>

Really cool, my Kentish friend, very clever.
Do you mean sequencer offset? I've run it a few times with both +ve and -ve offsets on a vector with no obvious issues. Or do you mean that the image is not set to the vector offset? (easy to fix if only one layer, but not so with multiple layers that might be shifted differently). Be interested to see what exactly happened if you could maybe (strip out sensitive content and) let me see the file PM / or post?

And - just to be very picky <vbg> :D -- there's a world of difference between Kentish Man (someone from West Kent) and Man of Kent (from East Kent) - nearly as bad as calling a New Zealander an Aussie! :lol: or vice versa!

Thanks for the kind words!
User avatar
chucky
Posts: 3920
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land
Contact:

Re: Script request - Vector layer/group to PNG

Post by chucky » Wed Apr 25, 2018 11:57 am

Oh... ouch what am ignorant faux pas, my humblest and deepest apologies... how offended and insulted you must be, Paul. :oops:
I might as well have called you a.... 'Northerner!' :lol:
Although I'm thinking the comparison is more New South Wales person to a Queenslander- both would be insulted - the new south welshman rightly so :wink: DK?
Or even a Victorian and a Taswegian .
Kiwi and Aussie is more like Norwegian and Swede... just a completely different kettle of herring.

Of course I have no real place of origin that I can cling to rightly, I've lived soo many places.... guilty secret though... I was born in Surry , Haslemere 'actually' . Don't hate me, I have nothing to do with those people. :P
Sequential offender.
my latest animations
User avatar
chucky
Posts: 3920
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land
Contact:

Re: Script request - Vector layer/group to PNG

Post by chucky » Wed Apr 25, 2018 11:58 am

Oh about the offset glitch , that was the long forgotten 'bone' offset.
Yeah ancient history.
That's 'old' moho juju.
Sequential offender.
my latest animations
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Script request - Vector layer/group to PNG

Post by Greenlaw » Wed Apr 25, 2018 5:37 pm

Thanks for making this script Paul! It sounds great.

I haven't had a chance to try it yet (working mostly in 3D at lately,) but hope to give it a spin at home soon. Will let you know how it goes.
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
peterkajan
Posts: 3
Joined: Tue Mar 22, 2016 8:05 pm

Re: Script request - Vector layer/group to PNG

Post by peterkajan » Thu Apr 26, 2018 11:38 am

Hi Paul
thanks for great script!
But, to make it really useful production tool, it would be great to implement some changes:

1. The resolution of the baked image is the same as your current project resolution. This is quite limitation factor, if you could implement a function which would do this:
a. you select a layer and hit script button.
b. script changes your project settings resolution by factor 2 - e.g. from 1920x1080 to 3840x2160 and then do the same as now and after putting the PNG in to your project, scales the resolution to 1920x1080 (original one) back.
c. it will setup the high-quality rendering on the PNG layer settings.

2. It would be great if the script could remember the hidden and showed layers before doing the rendering. So you select for example only BG Folder and the script will save the current composition settings, then hide everything else except the BG Folder, then do his job and at the end put everything back in normal – as it was before.

I would provide you with any help if you could implement those changes, we can even make some paid ob from it. We have a lot of ideas for new scripts. We can pay you for development of these.

PS: I created the icon for the script, you can use it of you like it :)
https://goo.gl/YaixaK


Best,
Peter






hayasidist wrote:http://www.mediafire.com/file/fx8avrl92 ... akePNG.lua

I think this is a pretty robust and just about functionally complete version... but give it a thrashing and let me know!

much of the wish list is implemented - including layer comps; but not yet scale up

Installation: copy the .lua to your custom directory (sorry - still no icon...)

operation.

activate with just one unlocked (=default state) vector / group selected: the PNG is rendered; the source layer is locked
activate on a locked vector / group: the PNG is made invisible and the source layer is unlocked for editing.

activate with multiple layers selected: a layer comp is created containing the selected layers; the layercomp is SET (i.e. everything else is made invisible); a PNG is created and a NOTE layer is created as a surrogate for the layer comp. The note layer is locked; the layercomp is DEACTIVATED (i.e. only the PNG and "non-render" Note layer are visible)

activate on a locked NOTE layer - the Note layer is unlocked; the layercomp is SET; and layers are available for editing.
activate on an unlocked NOTE layer (i.e. you can put the name of a pre-existing layer comp as the note text) - this is the same as multiple selected layers - i.e.the layercomp is SET; PNG is created; note layer is locked; the layercomp is DEACTIVATED

activate on a PNG: the same as activating on whatever created it.

activate with an unlocked source on any frame - you'll get a PNG for the frame on which it's activated (e.g. run on frames 0, 6, 30 - you get 3 PNGs). All the PNGs from the source are hidden when the source is open for editing.


right now a lot of the "options" that a user might want are hardwired ... e.g. path names to save the png (defaulted to the same as the .moho -- you'll be prompted to save the .moho if necessary); png file names (moho file name .. layer name .. uuid); layer comp names (from the active selected layer)...

Let me know ....
hayasidist
Posts: 2122
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Script request - Vector layer/group to PNG

Post by hayasidist » Thu Apr 26, 2018 1:58 pm

new version 1.26 same link. EDIT: <bad link> http://www.mediafire.com/file/fx8avrl92 ... akePNG.lua <Sorry!!

new feature: (thanks for feedback - and Greenlaw's original request!) this version renders at double scale unless the upscaled project would exceed moho's limits (i.e. it will double the scale as long as the document has a maximum dimension of 4500 px) No warning is issued / other action taken if the project is too big to have its dimensions doubled - it just renders as is. (i.e. one more on the list of "some UI might be nice" ... I'll get there ...)
Last edited by hayasidist on Thu Apr 26, 2018 4:37 pm, edited 1 time in total.
User avatar
chucky
Posts: 3920
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land
Contact:

Re: Script request - Vector layer/group to PNG

Post by chucky » Thu Apr 26, 2018 2:37 pm

This one didn't work like the last . Might have used it wrong. :oops:

Here's my temp icon.
Image
Sequential offender.
my latest animations
hayasidist
Posts: 2122
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Script request - Vector layer/group to PNG

Post by hayasidist » Thu Apr 26, 2018 4:39 pm

chucky wrote:This one didn't work like the last . Might have used it wrong
:oops: bad link - corrected! Sorry. (that was a link to bake frame - take the vectors and bake the point / bone / layer / motion...)

http://www.mediafire.com/file/fx8avrl92 ... akePNG.lua

oh - and - the soufflé?! that's neat! :D
hayasidist
Posts: 2122
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Script request - Vector layer/group to PNG

Post by hayasidist » Fri Apr 27, 2018 2:36 pm

http://www.mediafire.com/file/orpyy2gj2 ... akePNG.zip

new link - this adds layer save / set / restore layer visibility and includes Chucky's oven-baked delicacy icon... makes me smile every time I see it!

Once again, I've given it a fair going over but I'm sure there will be wrinkles in there to iron out... some grounded on the one or two niggles with the way layer comps work (e.g. SET layercomp doesn't seem to want to activate the parent layers of included layers?!)

one "feature" you might find is if you try to use a locked layer in a layercomp -- just run the tool to unlock it first!

there are "missing" features, such as the UI, and these are planned for a couple of months time all other things being equal
but that's it as far as core functionality is concerned for the next little while at least (barring any compelling "must have"s) - but there will be bug fixes as necessary of course.

let me know.....
User avatar
Greenlaw
Posts: 4383
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Script request - Vector layer/group to PNG

Post by Greenlaw » Thu May 24, 2018 4:38 pm

I finally got around to trying Bake To PNG and it appears to do exactly what I need! Thank you so much for making this tool. I'll try it on a past scene where I had to do this manually and let you know how it goes.

Oh, and nice icon Chucky! :)
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
Post Reply