Please send suggestions for my scriptwriting

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

The Translate Points tool works as you described. But you must click exactly on the point, together with the SHIFT key. If you click on the line, outside of the points, all points are selected. The LM's original point selection requires too precise clicking, so maybe I will replace it with a "click near to point" version.
- - - Fazek
Toontoonz
Posts: 763
Joined: Fri Mar 25, 2005 9:28 pm

Post by Toontoonz »

I now see my mistake - After selecting the multiple points I was then clicking on one of the points to drag them all. This deselected the others. I should just drag without touching any points with the Translate tool cursor.

And I just noticed that one can drag the Translate cursor tool and select multiple points. Wow!
Impossible with the Moho version of the tool and essentially elilminating the need of Moho´s Select Points tool.

Now being able to select multiple points with the Translate Tool is like taking the Moho Translate tool out of the Stone Age and putting it into modern vector illustration program standards.
Thanks!!! :D

(Now if a better method could be devised for adjusting curves on lines.....:D )
User avatar
GregSmith
Posts: 99
Joined: Sun May 22, 2005 6:56 pm
Location: Flagstaff, Arizona

Visual Stlyle Palette

Post by GregSmith »

I'll throw in my 2 cents for a feature I would love to see in Moho, possibly made by independent programmers:

A visual palette for styles . . . in other words, a way to display, in rendered form, what a style actually "looks like". Then, there should be an extremely simple way to select a shape, click on the visual, actual representation of that style, and have the shape update immediately . . . a 2 click solution. Artists like simplicity where programmers like complexity.

Most of us use a very finite number of styles on any given project, so the palette could be saved with every project, for repeated use. Such a palette could also be saved as a kind of default palette, by means of a project "template".

My main complaint with Moho is too many tools and too many clicks to get things done. Simplify, simplify, simplify.

Thanks,

Greg Smith
The400th
Posts: 177
Joined: Wed Dec 22, 2004 3:51 pm

Post by The400th »

Greg, make your request a separate post, otherwise it will get lost in the background noise...
User avatar
Rai López
Posts: 2228
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

Fazek wrote:Maybe a menu script would be useful to duplicate and rename a layer this way.
...EY! (HI! :D) I always have been thinking on how a menu could be available to can interacting with embedded scripts, finally I though if don't be possible something like a "Embedded Tool" that you must select in the Tools window to can accede to a sensitive tool panel showing in this way specific embedded scripts options of the currently selected layer... I hope something like this could be possible cause the Window option seemed to me like a very limited way and had some problems every time you Undo in Moho as we were able to see in the LM's embedded script with dialogue window experiment of the past... Well, at least I always have thought that if a embedded script can invoke a pop up window it should be able to invoke a Sensitive panel with the help of a specific and generic tool, isn't? In this way... :shock: Oh, OH! I've just re-read your post now Fazek and seems to me like you were reffering to another kind of solution by menu script... but well, as I still had wrote all this I'll leave it here just in case ;) ...hmmm, BYE!

PD1: BTW... I'm enjoining too with all your modified scripts, so... THANKS again!
PD2: I'm elavorating too something like an "issues list" that I will comment to you in other moment :)
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

I thought only to make a menu script to duplicate a layer with a different naming convention. It has no relations to the layer scripts at all. The LM's default duplication takes the layer name, increases its number if it has, or adds " 2" to the end of the name. It is not so sophisticated (for my script, we must distinguish the orignal and the copy somehow) and usually creates many-many similar names everywhere in the layer tree. It is confusing.

PS. I think the best way to keep the variables of the layerscript is to put them into the LAYER structure. The layer is a simple lua table and you can keep any custom variables there. (but Moho won't save your own variables). It seems the variables are there even if you are using or not the "LayerAs..." typecasts.
- - - Fazek
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

First, if I did not yet say thank you for your scripts Fazek - thank you. The many cool scripts added by scripters like yourself have really increased the power -and ease of use- of Moho.

I have many suggestions but I'll just offer one related to all these scripts. Not sure LUA can handle this but it would be useful to be able to create different tool sets - ie assign all these scripts to various toolbars- and be able to load different ones with hotkeys. Say I assign your scripts or mactons to their own toolbars, assign each one to a function key and I can popup your scripts when I need them and mactons when I need those. I am a little confused by so many scripts -and of course I want them all. :)
[url=http://burtabreu.animationblogspot.com:2gityfdw]My AnimationBlogSpot[/url:2gityfdw]
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

It is possible to create additional dialog windows and keep them open while you are using any other functions of Moho. It is also possible to load and run external lua scripts from a lua script. The problem is, if I create such a window, it has no access to the actual edited scene (the "moho" variable). Maybe it is possible to make a workaround and emulate the functions of the default tool system. Maybe it is possible to make a better, incompatible syntax. But many features works hidden from LUA - replacing the contents of the toolbar, for instance. And there is no icon button widget, not possible to load and show a .png image, so the window's user interface would be very poor. So I think this solution has very low quality, if possible. Perhaps LM reads this and will add this solution to the next version, since he can do it more easily, in the core program.
- - - Fazek
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

I have an idea about a still vector image format, matching to Moho's internal data hierarchy (points, curves, shapes), easily loadable from lua and easily editable by hand and by other programs. In the current version of Moho, I can't put the image vectorising directly inside, so I want to write a separated external program in C, and passing the result back in a file. The os.execute() seems working on every platforms. Later this would become a shared library, loadable from lua.

For the image vectorising, I really need the meaning of the curvature value. Now I think the curves in Moho are simplified Bezier curves. The direction of the two control points around a point P1 is the same as the vector between P0 and P2 (the neighbour points) and the length of the control points vector is the curvature - see the image. At the end points, it uses the vector between the end point and the only one neighbour.

This is only my suspect so please tell me if somebody knows (mathematically?)
Image
- - - Fazek
Toontoonz
Posts: 763
Joined: Fri Mar 25, 2005 9:28 pm

Post by Toontoonz »

Regarding your question I haven´t the slightest clue, but maybe these links can help you:

http://www.cse.unsw.edu.au/~lambert/splines/

http://www.ibiblio.org/e-notes/Splines/Intro.htm

http://en.wikipedia.org/wiki/Spline_(mathematics)

http://mathworld.wolfram.com/Spline.html
---------

Your vector drawing technique you describe would be very interesting!
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

Thank you. This is not my technique, it's Lost Marble's. Now I have an answer from LM so it is sure that the control points are working as I wrote above. The only thing I don't know yet is how the Curvature parameter affects the length of the vector. It seems it is working locally, so the two control point vectors have independent sizes (but same direction) and a size is depending only on the distance of the connected neighbour point and the curvature. I am waiting an answer from Lost Marble about this, but maybe now I can recover this secret alone as well.

There is a problem with loading Illustrator and EPS files into Moho. Because these formats are using (cubic) Bezier curves, Moho must convert the curves into its internal format. It keeps the original points, and adds extra points to approximate the original curve. I think this algorythm cannot do this correctly. I am thinking on a different one which converts the original curve into a sequence of many small linear segments, then optimizing them into a correct curve. This would be useful for

- loading and converting these files,
- pixel image vectorising,
- the freehand drawing tool
- - - Fazek
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

Magnet tool added, inspired by a question from Postality in the feature request forum. It has a support to modify the points with two "magnets", around a mirroring center or an axis. You can set the position of the center or the axis with selected points. It is useful if you want to keep the symmetry of a shape. It is not a final version and I am waiting the ideas how to make it more comfortable.

I still need some information about the curvature.
- - - Fazek
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

Modified Magnet tool: if you click on an existing curve, you can add new points symmetrically. If you set the mirror center or axis from selected points, it will follow these points if moving in the timeline (use the space to disconnect the mirror handles).

Now this new tool is not a Magnet at all.
- - - Fazek
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

A menu item (in menu/Script Writing) added. It is a useful tool to examine undocumented Lua variables (if any). It prints variable listing into the Lua console, very similar to the way as LM's scriptwriting menu items do. It can dump the global table (use the _G name) or the contents of MOHO, LM or LM.GUI - or any others. It has an option to print the contents of tables recursively.

ADDED: It can print the contents of metatables (some information handled as "userdata" in Moho - for example, the famous "moho" variable. These variable types are containing their functions and variables in metatables. You can find some metatables at other variables as well.) I made some access points to the most interesting variables inside the global "FA_PrintValue" table, under the name MOHO, MOHODOC etc.

It has a history as well, so you can switch between the already processed variables, back and forwards.

A smart thing: you can evaluate any expressions, even you can call functions in this program. For example, you can read the actually selected layer if you enter FA_PrintValue.MOHO.layer by hand. Or just use it to calculate the 2 * 2 value.
- - - Fazek
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

I made a minor correction in my FloodSelection routine (it worked wrong in case of some nested curves) and extended the PaintBucket to use my FloodSelection routine if LM's version fails. The modified files: utility/fa_sharedutils.lua and tool/fa_paint_bucket.lua.
- - - Fazek
Post Reply