Page 1 of 3

Genete's scripts

Posted: Sun Aug 19, 2007 11:09 am
by Genete
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.


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.

See below.

See below
Enjoy! :D


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!!!


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.

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)

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.


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:


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:

The video tutorials and some samples:

The thread where I presented the version 10 for the 3Dgrid script what makes the Z sort of the layers.

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

Until next AS update or version you can freely play with this script embedded into the vector layer: ... onesv2.lua
(See this post if you want to load the old version. May be you prefer its behavior)
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.

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:
and so on

In the example the last bone must be (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.

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.

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!

: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: ... _shape.lua
The icon: Image (right click save as)
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    ...
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: ... shapes.lua
NEW VERSION: :!: ... 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.)
Just download the script file and drop into the /AnimeStudioPro/scripts/menu/Bone folder (create the Bone folder if it doesn't exists).
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.


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:

Unzip the file and drop the content to the folder:
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)

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.


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
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
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
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.

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 ...
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

Posted: Sun Aug 19, 2007 12:56 pm
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!


Posted: Sun Aug 19, 2007 1:05 pm
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.


Posted: Sun Aug 19, 2007 1:07 pm
by jahnocli
I feel very humble about this. Your English is a damn sight better than my Spanish! Hasta la vista, muchacho!

Posted: Sun Aug 19, 2007 1:10 pm
by Genete

Don't worry. I love learn English.

BTW is the correction OK? :roll:

PD: Ah! If you don't mind I would not change the scripts names ...

Posted: Sun Aug 19, 2007 1:20 pm
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.

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)



Posted: Sun Aug 19, 2007 5:43 pm
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.


Posted: Sun Aug 19, 2007 6:35 pm
by Genete
Thanks jahnocli! You're so kind.

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!

Posted: Sun Aug 19, 2007 7:24 pm
by funksmaname
excellent scripts genete! and love the icons... :)

Posted: Sun Aug 19, 2007 7:31 pm
by Genete
funksmaname wrote:excellent scripts genete! and love the icons... :)
Thanks! you're invited to use them!

Posted: Sun Aug 19, 2007 9:16 pm
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)

Posted: Mon Aug 20, 2007 1:50 am
by heyvern
Icons are brilliant and you can even tell what they do.

I struggle designing those icons.



Posted: Mon Aug 20, 2007 7:29 am
by Genete
heyvern wrote:Icons are brilliant and you can even tell what they do.

I struggle designing those icons.


Thanks!... and for the new word for my personal collection (struggle) :D

Posted: Sun Sep 02, 2007 1:29 am
by Genete
Using the post to store my scripts.
Thanks whom made it sticky!!

Animated Sort Shapes Based on Bones Position Script

Posted: Sun Sep 02, 2007 4:48 pm
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.