The Tool I'm creating is...

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

The Tool I'm creating is...

Post by Peteroid »

..... is still not done, but I'm making headroom.

Here is an image of the interface. It is a Camera Tool called Point Camera (you can read the description in the interface):

http://www.peteroid.com/images/point_ca ... erface.png

I have the calculation routines completely done and seem to calculate correctly.

All I have left is the following:

- upon pressing the Execute button: for each frame in the range of Frames given, read the world locations for Camera and the currently selected Layer, run them through my routine which pops out pan and tilt for the Camera, then set those pan and tilt values for the Camera at the frame (which will create a keyframe there), and make sure everything is visibly updated ans all my 'ducks are in a row'.

So I'm close, but I still am having problems with things like getting the current frame, and even though I get a valid moho object, it seems to only have a nil elements (e.g., document = nil, layer -=nil, etc.).

But every day I get a little closer... I'm the putt putt train that CAN! :)
[==Peter==]
User avatar
DK
Posts: 2849
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

What happens/will happen to the camera after the end of the desired frame range? Will it stay in the same spot if there are more frames to go in the project? Would it be hard to target multiple objects, ie, after the end of one desired frame range is reached have the camera point at another layer?

Cheers
D.K
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid »

DK wrote:What happens/will happen to the camera after the end of the desired frame range? Will it stay in the same spot if there are more frames to go in the project? Would it be hard to target multiple objects, ie, after the end of one desired frame range is reached have the camera point at another layer?

Cheers
D.K
Yes to all your questions.

Before the range the camera tilt and pan will be unchanged. Afterward it will remain at the same setting as the last frame in the range. Of course, if you set a keyframe for pan/tilt at the frame just after the range (and do so before you apply the script) then everything afterward will remain unchanged.

Maybe once I get the basics working I can add a check box that automatically sets the keyframe after the range first so it only affects the range in question! So your question has given me an idea for a possible cool additional feature! Thanks!

As for 'chaining' these... ABSOLUTELY! That's the whole point. I'm trying to set it up so the camera is more 'Hollywood'-like. That is, you follow one character, then immediately cut to look and follow another character. Obviously only one can be pointed to at time. You just select the desired layer from one character, set the range, apply the script... then select the desired layer from another character, reposition the frame range after the first range, and apply the script. Now it follows the first character in the first range, the second character in the second range. Put space between the two ranges, and the camera will tween the pan/tilt to go from one to the other (that is, pan from one character to the other regardless of their motion and the cameras motion).

I also thought of this. One could create an invisible layer called 'focus point'. If Point Camera is applied to this Layer, then in the frame range where ever you move this layer the camera follows. You have an object that becomes the point you want to focus on!

Now imagine attaching this to a character. Then during the animation. move the focus point up the character. Now you are following the character where ever it goes, and you are panning up the body!

And you can even put the camera on a path and then put the focus point layer on a different path, they both can do complex moves, and the camera will always have the focus point dead center of screen a all times.

It is important to realize Point Camera does NOT change the LOCATION of the camera at all, just the pan and tilt.

Also there are some degenerate cases I might have to eventually handle. Like, if the layer passes directly overhead it is a discontinuity point, since one can now pan and it is equivalent to rolling. Also if the layer and camera are at the exact same location, of course there is no direction that works.

Finally, FYI, the Layer's location will be defined as the Origin of the Layer, and the 'current Layer' will be the one selected in the Layers area. If more than one Layer is selected, nothing will happen.
[==Peter==]
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Re: The Tool I'm creating is...

Post by Genete »

Peteroid wrote:..... is still not done, but I'm making headroom.

Here is an image of the interface. It is a Camera Tool called Point Camera (you can read the description in the interface):

http://www.peteroid.com/images/point_ca ... erface.png

I have the calculation routines completely done and seem to calculate correctly.

All I have left is the following:

- upon pressing the Execute button: for each frame in the range of Frames given, read the world locations for Camera and the currently selected Layer, run them through my routine which pops out pan and tilt for the Camera, then set those pan and tilt values for the Camera at the frame (which will create a keyframe there), and make sure everything is visibly updated ans all my 'ducks are in a row'.

So I'm close, but I still am having problems with things like getting the current frame, and even though I get a valid moho object, it seems to only have a nil elements (e.g., document = nil, layer -=nil, etc.).

But every day I get a little closer... I'm the putt putt train that CAN! :)
There are some errors in the moho scripting documentatin. current frame is moho.frame IIRC. Please checkoput other scripts and you'll get the correct interface. We all suffered that. It is the "joke" for the scripter novice ;)
-G
User avatar
DK
Posts: 2849
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Wonderfull Peteroid :)

Would it be hard to make a 2D checkbox for those who only wish to use it on the 2D plane or will that be native to the feature?

Cheers
D.K
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid »

DK wrote:Wonderfull Peteroid :)

Would it be hard to make a 2D checkbox for those who only wish to use it on the 2D plane or will that be native to the feature?

Cheers
D.K
This should work in 2D just as well as in 3D (after all, 2D is just the special case of 3D where Z= 0 always)... :)
[==Peter==]
User avatar
patricia3d
Posts: 726
Joined: Thu May 31, 2007 4:38 am
Location: India
Contact:

Post by patricia3d »

Great Tool Idea. I am using Blender so I know in Blender, We can use lots of differenet cameras and using Python you can also control from from No. 1 to Fram No. 121 Camera1 will be used and From Frame No. 122 to 211 Camera2 will be used and so on....
It will be so nice that in ASP you will be able to ues more than one camera.

Please keep in mind for Version 6.2 also.
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid »

kkrawal wrote:Great Tool Idea. I am using Blender so I know in Blender, We can use lots of differenet cameras and using Python you can also control from from No. 1 to Fram No. 121 Camera1 will be used and From Frame No. 122 to 211 Camera2 will be used and so on....
It will be so nice that in ASP you will be able to ues more than one camera.

Please keep in mind for Version 6.2 also.
I am just now learning LUA and MOHO, so I'm still too much of a novice at this point to know what I'd have to do different, if anything, to do a 6.2 version.

Let me get the version I'm working on to at least beta. Then I'll post it any maybe someone can see if it works with 6.2. If so, cool. If not, we can go from there to make it so.

Of course the beauty of LUA is that everyone who has a LUA script can edit it since it is an interpreted language.

Although I've seen a 'compile script' option in LuaEdit. Are there two forms of LUA, interpreted source and compiled? I guess the latter would be used if you wanted to not reveal how you do things...(and it would likely be a bit faster in execution too).
[==Peter==]
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid »

The Point Camera Tool is now available at beta in another thread 'New Camera Tool: Point Camera':

Link: viewtopic.php?t=17432
[==Peter==]
User avatar
DK
Posts: 2849
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Hi Peteroid.
Just tried it in AS5.6 and get this Lua error:


Image


Cheers
D.K
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid »

DK wrote:Hi Peteroid.
Just tried it in AS5.6 and get this Lua error:


Image


Cheers
D.K
If those errors end up being the only problems for supporting AS5 (sorry about the way the looks), it shouldn't be too difficult.

I only had ASP7 scripts as scripts to study. So I have no idea how to build one that is AS5 compatible.

Could you send me some AS5 LUA Scripts?

The errors which occured are only the calls that list the description in the toolbar and the roll-over Point Camera toll tool-tip text. Though it might find other errors past these once these are solved, so can't be sure yet how simple it will be.

With some AS5 examples I can build a separate one that works for AS5. It is also possible an AS5 version would work in ASP7 (but not the reverse).

I think this is called AS5-backwards compatibility...

But I can only work on this if I have sample AS5 LUA Scriots to see the difference...
[==Peter==]
User avatar
DK
Posts: 2849
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Hi Peteroid.
Here are some 5.6 camera scripts.

http://www.polliefillers.com.au/forum/A ... cripts.zip

Cheers
D.K
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid »

DK wrote:Hi Peteroid.
Here are some 5.6 camera scripts.

http://www.polliefillers.com.au/forum/A ... cripts.zip

Cheers
D.K
OK, try it now (you will have to download the zip file again, but only need to replace pao_point_camera.lua in 'tool')... I don't have AS version 5 to test with, so I can't be sure.

But I mimicked the places where the errors were as they are in the version 5 code (and they were different), and it still works in ASP7.

So tell me if there are new errors now please (which is quite possible).
[==Peter==]
User avatar
DK
Posts: 2849
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

So sorry about this Peteroid.
Another Lua error:

Image

my email is: info@polliefillers.com.au

If you want me to test files for you via email rather than fill this thread with Lue console screen grabs I'd be more than happy to help.

Cheers
D.K
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid »

No, my stupidity... I made the new version... and then proceeded to put the OLD version back on my website for downloading.

That's why it has the exact same errors! (DOH!)

So, try it now... (I hope I put the right version there now)... hehe ;)

If it doesn't work this time, we can go to email...
[==Peter==]
Post Reply