Embedded Scripts
Moderators: Víctor Paredes, Belgarath, slowtiger
So would it be possible to make a script that causes a layer to become attached to a bone/another layer dynamically (as with a person picking up an object and giving it to another person, where the object becomes attached first to one hand then another). Right now there's no way to link two objects together in any kind of easy way. There doesn't seem to be a way to change parameters for these scripts on the fly (i.e. attach object A to object B at frame X, then attach it to object C at frame Y). Then again I know nothing about Lua scripting at all and don't have time to learn it.
- Lost Marble
- Site Admin
- Posts: 2355
- Joined: Tue Aug 03, 2004 6:02 pm
- Location: Scotts Valley, California, USA
- Contact:
Yes, this should be possible. Take a look at the "Bind Layer" tool. This will show you how to bind a layer to a bone by script. Then, your embedded script just needs to change the binding at different frames depending on your specific need.MarkBorok wrote:So would it be possible to make a script that causes a layer to become attached to a bone/another layer dynamically...
But is it possible to bind a layer to a bone in a bone layer that is not its parent? I mean if you have two characters with bone rigs and one throws a ball to another (the ball being on its own layer), is it possible to bind the ball layer to a bone in rig 1 and then bind it to another bone in rig 2?Lost Marble wrote:Yes, this should be possible. Take a look at the "Bind Layer" tool. This will show you how to bind a layer to a bone by script. Then, your embedded script just needs to change the binding at different frames depending on your specific need.MarkBorok wrote:So would it be possible to make a script that causes a layer to become attached to a bone/another layer dynamically...
- Lost Marble
- Site Admin
- Posts: 2355
- Joined: Tue Aug 03, 2004 6:02 pm
- Location: Scotts Valley, California, USA
- Contact:
Yes, that's what I thought (how I've been doing it so far). It can result in a bit of clutter, though, if you have a lot of objects being manipulated. In my case I only had one, so it was no big deal.Lost Marble wrote:No, that wouldn't be possible, but it's just a simple matter of two balls - one attached to one character, and one attached to the other. Then, just animate the visibility of the two so that you only see one at a time.
(Incidentally, I presume that turning off an object's visibility saves quite a bit on rendering time? I've been doing it whenever the camera pulls in on a scene in such a way that certain objects end up outside the frame or hidden by other objects in the foreground. Does Moho discard invisible objects, or do they still take up some time in the rendering process?)
Still, the idea of dynamically binding a layer to different bones at different times is a useful one, as with a character passing an object from hand to hand or putting it on top of his head.
I'd like to see something like this into Moho too. The other visibility way works, yes... But seems like a way to "get by", not a "professional" solution, and the posibility of binding a layer to different bones at different times it'd be a more simple, compreensive, versatile and QUICK solution for animators life...MarkBorok wrote:Still, the idea of dynamically binding a layer to different bones at different times is a useful one, as with a character passing an object from hand to hand or putting it on top of his head.

The excellent idea, very useful function. However it would be desirable to see not a direct way to a file, and relative.
The direct way leads to mistakes at moving the project or scripts:
Better relative:
Too most it would be desirable to see and for images. For example such way Necessarily will cause a mistake at loading a file:
If I compulsorily edit a file by means of "notebook", the mistake disappears.
Better so
The direct way leads to mistakes at moving the project or scripts:
Code: Select all
layer_script "D:/ANIMO/test_script/layer_script.lua"
Code: Select all
layer_script "../layer_script.lua"
Code: Select all
image "C:/Documents and Settings/Seliverstov.LANDOMAIN/Рабочий стол/image/3485725koh.jpg"
Better so
Code: Select all
image "../../../image/3485725koh.jpg"