Genete's scripts

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Genete's scripts

Post by Genete »

FREEZE POINTS V2 NEW!!!
Yeah!
This is a new version of the previous one. Those are the main changes:
#The code is changed so now you can render the animation with the embedded script loaded. Before it did not work and you had to unload the script so did not work with bones. The menu and embedded scripts should work together so you should discard the old version and load all the new version because there is not back compatibility.
#I have added two new embedded scripts: freezerx.lua and freezery.lua. They basically do the same job (one for X and other for Y). See below to learn to use them.
#There are some examples done with point motion and bone motion. The point motion one will look OK but the bone motion one not. It is due to that the points freeze X values are lost, as it is explained later, when you close the file. For that example I've loaded a swf sample.

http://www.darthfurby.com/genete/Scripting/freezer2.zip

USAGE:

freezer.lua
See below
freezerx.lua and freezery.lua
Its usage is similar to the freezer.lua script. The only difference is that the script only limit the x (y) position of the points (stop them if you or a bone want to move to a bigger value). So the steps to have success with the scripts are:
1) Embed the script (freezerx.lua or freezery.lua) into the desired vector layer.
2) In a certain frame (you should keep it if want to reuse later) place the points in one position where you explicitly don't want them to pass the x (y) values.
3) Select the points.
4) Run the ge_freeze_points.lua menu/tool script (depending if you have it installed as menu or as tool). A console message will tell you some info about the frozen points.
5) After that you're not able to move the points beyond its x (y) values when they were frozen. You can render the animation and the script will do the job.

Working with bones gives better result than with point motion. It is due that with point motion you have to set the keyframes in different positions to prevent key all the points at the same time. It depends on your particular situation. See the example.

INSTALLATION:
See below.

KNOWN PROBLEMS:
See below
Enjoy! :D

-----------------------------------------------

FREEZE POINTS
Yeah!
This is a combination of script tools (menu like) and embedded script that would make life easier (I hope) for some people.
It has been requested that it could be cool if you could freeze the points sometime meanwhile you edit the other points of the mesh.
Here it is. I've created a menu script (also it is a button tool script) that freezes the current selected points in the current active vector layer. It is used in combination of an embedded script for that vector layer what is the one who makes the magic. It reads the frozen values of the points and maintain them there although you try to move them with any of the tools that move points. Even they stay quiet under bones movements!!!

http://www.darthfurby.com/genete/Scripting/freezer.zip

USAGE:

Embed the freezer.lua file into the vector layer and use the ge_freeze_points.lua script as usually: Select the points to freeze and press the button. To unfreeze the points simply select none and press again the button. It would show you a console information regarding how many points are set in the frozen table.
It could be used for several layers but you should embed the freezer.lua script on each layer. Please ask me if you don't know how to.

INSTALLATION:
Unzip the file and copy the ge_freeze_points.png image and ge_freeze_points.lua into the scripts/tool folder
Add the following line to _tool_list.txt file at tool folder.

Code: Select all

button  ge_freeze_points	...
Copy the ge_select_frozen_points.lua file into any of the script/menu folders. I have it at Draw. Or create a button by your self. (TODO list)

KNOWN PROBLEMS:
If you delete a point then the points ID numbers changes. The embedded script doesn't wrap point deletion. Only discard it if the point index is out of range. So if you delete points then unexpected result would come. To solve this just release all the points and freeze them again.

:arrow: The frozen, frozen by X, or frozen by Y points and its values are lost when open the file again. You can store the frozen position in some dummy keyframes that are not used during the animation. Maybe frame 1, 2, 3, etc. an start your animation later.

Enjoy!

-----------------------------------------------
PSEUDO 3D STUFF
It is really hard to explain the concept, the usage and the variations of versions that between Vern and I have developed in other threads.
Just put the link for the files and the link for the hot threads:

THE FILE:
http://darthfurby.com/genete/Scripting/ ... ls_v10.zip

CONTENTS and LINK TO USAGE AND SAMPLES:
3Dgrid9.1.lua: Embedded script for the bone layer that move "pt" bones, based on rotations of other bones, like if they were in a 3D space. Prepared for usage of the auto 3D rig scripts, sort shapes, perspective projection, creation of limbs, and control of the model based in position of one single bone.
3Dgrid9.lua: same than the previous one but without perspective projection.
3Dgrid10.lua: same than version 9 but with an additional feature: the layers that are bind to the "pt" bones are moved also in its Z position what would allow a Z sort of them.
ge_front_3Drig3.2.lua and ge_side_3Drig3.1.lua: a pair of menu script that work together and allow automatic creation of the pt bones, the masterX and master Y bones and the mX and mY bones. Really needed for complex models.

Where all this story begun:
viewtopic.php?t=8618

The video tutorials and some samples:
viewtopic.php?t=8778

The thread where I presented the version 10 for the 3Dgrid script what makes the Z sort of the layers.
viewtopic.php?t=9133

Please if you have questions or doubts please use the threads above to ask. I live in the forums... :wink:
______________________________________________

ANIMATED SORT SHAPES BASED ON BONES POSITION
Yeaaaaah!
Until next AS update or version you can freely play with this script embedded into the vector layer:
http://www.darthfurby.com/genete/Script ... onesv2.lua
(See this post if you want to load the old version. May be you prefer its behavior)
INSTALLATION:
Just download the lua file and place in the same folder that your project file. The embedded file can be located in other folder but then you cannot move the project or the embedded lua file to other place.

USAGE:
1) Create your model as a normal vector - bone layer model (vectors layers inside a bone layer and rigged if needed)
2) For the vector layer that you want the shape sort, count the number of shapes (let's say there are 14 shapes in the vector layer)
3) Create as many bones as shapes you have count. No more no less bones. You can still having other bones for the rig but the name of the just created bones must be special. Set the strength of the new bones to 0 to avoid region or flexible binding. In the example you should create 14 bones. I recommend to create all them with the same orientation at first and separated one from other by its Y position (like in the examples). Later you can rotate some of them to distinguish from the other.
4) Set the names of the created bones to be like this:
0.sh
1.sh
2.sh
and so on

In the example the last bone must be 13.sh (We have started from 0 so there are 14 bones exactly).
4) Link the bones (14 in the example) to another root bone (no matter its name) That root bone would define the X origin of the (14) bones.
5) BE SURE that the just created 14 bones have a different X position BEFORE embed the script. If not, if two bones have exactly the same X value the script would mess up the shapes and its names (the names of the bones are changed EVERY TIME the script is called - it is strange but needed)
6) Embed the lua file to the vector layer and start to play with the just created 14 bones. Their relative X positions defines the shapes stack order. DONT move them using Grid snap just use translate bones tools and do it manually. It would prevent to have two bones with the same X value.

How it works: It sort the shapes ONLY when a keyframe of the specially named
bones is in the current frame. So if no keyframe not sort operation. As well as shapes don't have a continuous Z value (they are just above or below the others) it is more useful make only the sort operation when the keyframe is found. In this way you (the user) should enter the keyframes at the exact frame where you want the sort operation to be performed. In this way you can sort shapes "when they don't overlap" so the transition is smooth. Please ask me for a video tutorial if you don't understand how they work.

LIMITATIONS:
Only for one vector layer for each bone root layer. If there are more vector layers on the bone folder then they cannot have embedded the script. If it is embedded then the shapes would be also sorted in the same way although it could be no sense for the animation.
If you create less bones than shapes then the script could mess up your shapes. It would not crash but strange results could happen. If you create more named bones there is no problem.

KNOWN BUGS AND NO IDEA HOW TO SOLVE :
Don't use Raise shape or Lower shape buttons or any of the related menu entries. I have crashed AS pressing too much the Raise Shape button in the middle of the timeline when using the old version. This version probably have less opportunity to do that but let quiet those buttons please!

HELPING TOOLS:
:arrow: A button tool that select the corresponding bone to the previous selected shape. I mean: select a shape then press the button tool and it would select the corresponding bone.
The file:
http://www.darthfurby.com/genete/Script ... _shape.lua
The icon: Image (right click save as)
Installation:
Just download both files (script and png image) and drop into the /AnimeStudioPro/scripts/tool folder. Change the _tool_list.txt file adding this code line at the section you prefer:

Code: Select all

button ge_bone_of_shape    ...
Usage:
Still not figure out how it works? :wink:

:arrow: A menu script to auto add the needed bones for the selected vector layer. It would run all the shapes and create a bone for each. It can automatically create the proper bone's name and place it in the correct position (linked to the parent bone that must be previously selected.
The file:
http://www.darthfurby.com/genete/Script ... shapes.lua
NEW VERSION: :!:
http://www.darthfurby.com/genete/Script ... apesv2.lua
(This version would recycle the existing bones with special naming "*.sh". It only would add a bone if there is no bone with the proper name. Now, you don't need to delete all the *.sh bones to run the script again when a change in the shapes is done, and so, can freely add or delete shapes and just run again the script and the bones would be aligned and placed in the proper position, ready to be moved.)
Installation:
Just download the script file and drop into the /AnimeStudioPro/scripts/menu/Bone folder (create the Bone folder if it doesn't exists).
Usage:
BEFORE you embed the script and once the model is done add a single bone to the skeleton and select it (be sure that no more bones are selected). Select the vector layer where lies the shapes you want to sort using the bones positions (the bone must still being selected). Go to Menu->Scripts->Bones and click on "GE: Bones for Shapes".
It would produce a set of bones ordered in a stair position and properly named. Each bone represents a shape. To know what bone represent one shape just select the shape and press the button tool I have shown above (ge_bone_of_shape) and the bone would be selected.
Now you can embed the script "sort_shapes_by_bonesv2.lua" to the vector layer. Go to other frame and move horizontally the bones and see what happens.

Hope you enjoy this script.
_________________________________________________

ALIGN SHAPES BY ITS GRAVITY CENTER BY X AND BY Y

I'm proud to present you a pair of handy scripts that align selected shapes by its gravity center X or Y values.

The file:
http://www.darthfurby.com/genete/Scripting/align.zip

INSTALLATION:
Unzip the file and drop the content to the folder:
AnimeStudio/scripts/tools
AND BE SURE that you modify the _tool_list.txt file ADDING those two lines at the Draw section. (You can add them to the "Other" section if you want or other different)

Code: Select all

button   ge_alignx      ...
button   ge_aligny      ...
Replace the tree dots with a letter in capitals if you want to use them by a hot key. But I think ALL the keys are already used by other tools...

To select multiple shapes at the same time you MUST use fazek's select points tools (again fazek's wonderful tools)

USAGE:
Select more than one shape at the same time and press the corresponding button.
The shapes will be aligned to the first more deep shape in the layer. So if you want to align TO an specific shape you have to be sure to send it below all the other shapes to be aligned.

For the moment it only work for filled shapes. I have to modify them to be used by only outline shapes. If a non filled shape is selected it returns an error.

Hope you find these tools useful. And please test them and tell me if you find any bug.
_______________________________________________


TOGGLE SELECTION OF POINTS BASED ON ITS BINDING VALUES


Are you tired about select points to release them and / or make them flexibind ?
Do you want to know if a point is released, flexibound or bound from/to the bone(s)?

Here is the solution!!

I have made three very simple scripts but (IMHO) very useful:

Toggle Selection of Released Points
ge_select_released_points.lua
Imagethis is the button image (right click and save as)
This button tool toggles selection of all released points in the current vector layer. All non-released points are unselected.

Toggle Selection of Bound Points
ge_select_bound_points.lua
Imagethis is the button image (right click and save as)
This button tool toggles selection of all bound points in the current vector layer. All non-bound points are unselected.

Toggle Selection of FlexiBound Points
ge_select_flexibound_points.lua
Imagethis is the button image (right click and save as)
This button tool toggles selection of all flexi bound points in the current vector layer. All non-flexi bound points are unselected.


INSTALLATION
Download the lua files and the png images and place them in the AnimeStudio/scripts/tool folder.
Also you need to edit the _tool_list.txt file and add the following lines in the section you want the tools to appear (maybe in the Bone section)

Code: Select all

button  ge_select_released_points ...
button  ge_select_flexibound_points ...	
button  ge_select_bound_points ...
USAGE
Just press the button once you're in a vector layer and it would toggle the selection to the corresponding points.
It allow to do UNDO if you want to maintain the previous selection.

Here you can find all the needed files in one single zip package.

___________________________________________________________

Thanks Vern! :D
-G
Last edited by Genete on Tue Dec 11, 2007 11:37 pm, edited 9 times in total.
User avatar
jahnocli
Posts: 3471
Joined: Fri Oct 29, 2004 2:13 pm
Location: UK

Post by jahnocli »

Genete -- a suggestion. Each one of these actions is a "toggle" in English; if you substitute the word "Toggle" for "Select", it will give a better 'shorthand' way of understanding what is happening. (Sorry about all the quote marks).

Like I said, just a suggestion. The script looks really useful, and a real time-saver. Thanks!

J
You can't have everything. Where would you put it?
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Thank you very much for the suggestion.
I'll modify the post and the tittle.
I still learning English as well as still learning to draw... I think I know more English by now...

I'm glad you find the scripts useful.

Best
-G
User avatar
jahnocli
Posts: 3471
Joined: Fri Oct 29, 2004 2:13 pm
Location: UK

Post by jahnocli »

I feel very humble about this. Your English is a damn sight better than my Spanish! Hasta la vista, muchacho!
You can't have everything. Where would you put it?
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

:lol:

Don't worry. I love learn English.

BTW is the correction OK? :roll:
-G

PD: Ah! If you don't mind I would not change the scripts names ...
User avatar
jahnocli
Posts: 3471
Joined: Fri Oct 29, 2004 2:13 pm
Location: UK

Post by jahnocli »

OK -- here comes an English lesson! Pin your ears back (means "pay attention!"):

"...the selection to all the released points..."

it's better to say

"...selection of all released points..."

It's "selection *of*". And you can leave out "the" a lot in English. We're kinda lazy!! Good work!

-----------------------------------------------------------------------
(EDIT) If you want the full version, here it is!...

Toggle Selection of Released Points
...
This button tool toggles selection of all released points in the current vector layer. All non-released points are deselected.

Toggle Selection of Bound Points
...
This button tool toggles selection of all bound points in the current vector layer. All non-bound points are deselected.

Toggle Selection of Flexi-Bound Points
...
This button tool toggles selection of all flexi-bound points in the current vector layer. All non flexi-bound points are deselected.


INSTALLATION
Download the lua files and png images and place them in the AnimeStudio/scripts/tool folder. Also you need to edit the _tool_list.txt file and add the following lines in the section you want the tools to appear (maybe in the Bone section)

----------------------------------------------------

J
You can't have everything. Where would you put it?
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Cool tools!

I never even thought about needing this before. You are right though. Often I have absolutely no idea if I have bound points or not. These will come in very handy.

Thanks Genete.

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Thanks jahnocli! You're so kind.
Cheers!

heyvern! I was bored to go to bone menu or use manipulate bones every time I want to know if a point is flexi/bound or not or if it is released or not, so I decided to make a tool script to do that. Once You have them installed they come very handy.
:D You're welcome!
-G
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Post by funksmaname »

excellent scripts genete! and love the icons... :)
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

funksmaname wrote:excellent scripts genete! and love the icons... :)
Thanks! you're invited to use them!
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

i never thought in something like this, but looks very useful. it go directly to my tool palette.

thanks genete!
(and nice and smart icons, it's true)
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Icons are brilliant and you can even tell what they do.

I struggle designing those icons.

:)

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

heyvern wrote:Icons are brilliant and you can even tell what they do.

I struggle designing those icons.

:)

-vern
Thanks!... and for the new word for my personal collection (struggle) :D
-G
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Using the post to store my scripts.
Thanks whom made it sticky!!
-G
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Animated Sort Shapes Based on Bones Position Script

Post by Rudiger »

So, I tried out the sort_shapes_by_bonesv2.lua script and "Yeaaaaah!" is right! It works great and you don't even need to name your shapes. It would be nice if the strength of the generated bones were automatically set to 0 though.

Thanks for delivering on your promise, and so quickly. I can't wait to try this script out on some of my stalled projects.
Post Reply