Page 3 of 3
Posted: Mon Aug 03, 2009 9:07 pm
by stefman
Here's a tip for creating pop up windows and organizing all the elements using "push" and "pop:.
If you can find any of the "Macton" or "Crashcore" scripts that use pop ups look at how they create the "layeout". It's in the beginning of the code. You may need to have some more lua experience to understand it but it truly is an easier way to organize the layout.
What they do is create a "function" that "builds" the layout. So instead of a huge long chunk of code you call a function that is easier to see and read. The formatting of the "push/pop" layout is the same each time you call that function. It makes designing pop up lay outs easier.
Here's is a snippet showing the function from one of those scripts:
Code:
function CC_PASTE_CURVE_TO_CAMERA_TRACK_Dialog:add_col_e4( l, el_0, el_1, el_2, el_3 )
l:PushV()
l:AddChild( el_0, LM.GUI.ALIGN_LEFT )
l:AddChild( el_1, LM.GUI.ALIGN_LEFT )
l:AddChild( el_2, LM.GUI.ALIGN_LEFT )
l:AddChild( el_3, LM.GUI.ALIGN_LEFT )
l:Pop()
end
If all the code to create those elements were INSIDE the "push/pop" it would be much longer and harder to read. Using a function with arguments and variables and sending the element data to the function keeps the code more compact and easy to read.
-vern
Thank you Vern. After having studied at bit more the structure of your script I understood what you mean.
Well, I created a nearly empty PopUpWindow that can't do anything. Absolutely nothing.
-- **************************************************
-- PopUpWindow
-- **************************************************
ScriptName = "sm_PopUpWindow"
-- **************************************************
-- General information about this script
-- **************************************************
sm_PopUpWindow = {}
function sm_PopUpWindow:UILabel()
return("PopUpWindow")
end
-- **************************************************
-- Grid dialog
-- **************************************************
local sm_PopUpWindowDialog = {}
function sm_PopUpWindowDialog:new(moho)
local d = LM.GUI.SimpleDialog("Test", sm_PopUpWindowDialog)
local l = d:GetLayout()
d.moho = moho
l:PushH(LM.GUI.ALIGN_LEFT)
d.Flip = LM.GUI.StaticText("
")
l:AddChild(d.Flip)
l:Pop()
return d
end
function sm_PopUpWindowDialog:OnValidate()
end
-- **************************************************
-- The guts of this script
-- **************************************************
function sm_PopUpWindow:Run(moho)
local dlog = sm_PopUpWindowDialog:new(moho)
if (dlog:DoModeless()) then
return
end
end
Now, I'm trying to put graphical elements into it.
To begin, I would like to enter a filled circle into this PopUp window.
The Anime Studio lua GUI chapter contains several commands especially for the creation of graphics.
I think that these elements will certainly be part of those which have to be put together in order to create and to show the circle.
bool IsEnabled()
int Width()
int Height()
FillCircle(center, radius)
But, I really don't find out how all this has to work together.
How could this be integrated to the Layout of the LM.GUI.SimpleDialog?
And, how could this to match into this:
l:PushH(LM.GUI.ALIGN_LEFT)
d.Flip = ?????????????,
l:AddChild(d.Flip)
l:Pop()
Or, is it just really impossible to create graphical elements and to integrate them in AS's interface?
But, I think that it must be possible. As the mentioned commands are in the GUI part of the scripting reference.
desperate stefman
Posted: Tue Aug 04, 2009 12:26 am
by heyvern
I've never tried drawing in a pop up window.
Look at the script "Star" in the "draw" menu script folder. It has a popup that updates the image of the star as you change the values. It should show you exactly how to do that.
Like I said I have zero experience with that.
There is a NEW thing in AS 6 that lets you use actual images inside pop ups and tool settings. I have not played with that either and there isn't any documentation yet.
-vern
Posted: Tue Aug 04, 2009 5:43 am
by Rudiger
I saw the LM_Graphics class but I assumed it was only for drawing graphics objects in the main interface window, but I guess not. You are showing good perseverance, Stefman, and I think you will definitely get there in the end. Let me know when you want to sit down and work out the interface between your GUI and my existing key shifting scripts.
Posted: Tue Aug 04, 2009 1:31 pm
by stefman
Vern, I'm vitually kissing your feet.*
*[expr. of big thankfulness from one individual towards another one]
This takes the whole thing a big step further. Thank you very much. I can't wait to be back home and to explore that script.
Rudiger,
thank you very much in advance!! Be sure, I definitively would appreciate that a lot. I won't miss the moment to ask you.
But, there's still some way to go. I hope that my comprehension curve will rise a little bit faster from now on.
stefman
Posted: Sat Aug 22, 2009 1:46 pm
by stefman
Sorry for insisting so much,
but as it seems to be impossible to create popup windows which remain open to and run several actions and as creating non existing GUI elements with AS's Lua widgets doesn't seem to be feasable neither I'm wondering if the interface of a timeline like this couldn't be done with Java:
An external application that cummincates with AS and applies Rudiger's nudge tool scripts, but which shows all the (consolidated?) layers at the same time.
The idea remains the same as I had some time ago when I was thinking about an external C++ application. But perhaps, doing the same thing with Java could be more realistic as there are perhaps more people outthere with Java skills and alsi as Java is quiet close to Lua.
I know that I am a bit redundant, but I don't like speculating if in the next version there will be perhaps a much more enhanced timeline allowing a global vision and control of all the keys at the same time.
This is an indispensable feature for the creation of more complex animation with overlaps and secondary mouvements.
Cheers,
stefman
Posted: Sun Aug 23, 2009 1:59 am
by Rudiger
Please don't do this in Java. Even as an external application, there's no reason it couldn't be done with Lua and wxLua and this is what most of us are familiar with. It would also be much easier to integrate into AnimeStudio should Mike ever allow modeless dialogs access to the scripting interface or even allow wxLua to be used from inside AS.
Besides, wouldn't a modeless dialog working together with an update button tool be closer to what you want than an external application anyway?
Posted: Sun Aug 23, 2009 2:31 am
by stefman
Rudiger wrote:It would also be much easier to integrate into AnimeStudio should Mike ever allow modeless dialogs access to the scripting interface or even allow wxLua to be used from inside AS.
Besides, wouldn't a modeless dialog working together with an update button tool be closer to what you want than an external application anyway?
Indeed, it would be much more practical. But, at the moment I really don't see a way to create such an interface with the widgets that are available inside AS.
And as I said, waiting for Mike to integrate something next year which perhaps won't even be integrated doesn't seem to me very satisfying.
Sorry, I'm a bit frustrated at the moment.
This software has a so powerfull concept, but it lacks at very basic features, which destroys everything. Key control for all the layers and adjustable velocities are indispensable basic features.
Cheers,
stefman
Posted: Sun Aug 23, 2009 3:40 am
by Rudiger
stefman wrote:Rudiger wrote:It would also be much easier to integrate into AnimeStudio should Mike ever allow modeless dialogs access to the scripting interface or even allow wxLua to be used from inside AS.
Besides, wouldn't a modeless dialog working together with an update button tool be closer to what you want than an external application anyway?
Indeed, it would be much more practical. But, at the moment I really don't see a way to create such an interface with the widgets that are available inside AS.
And as I said, waiting for Mike to integrate something next year which perhaps won't even be integrated doesn't seem to me very satisfying.
Sorry, I'm a bit frustrated at the moment.
This software has a so powerfull concept, but it lacks at very basic features, which destroys everything. Key control for all the layers and adjustable velocities are indispensable basic features.
Cheers,
stefman
I think perhaps you misunderstood me. You can download wxLua (it comes with its own version of Lua I believe) and install it as a separate application from AnimeStudio. It would then let you write gui applictions in Lua, completely separate from AnimeStudio. It would certainly be easier to do it this way than in Java, which is a compiled language, instead of a much easier to program scripting language.
Posted: Sun Aug 23, 2009 11:40 am
by stefman
Sorry, Rudiger.
Yes, I had missunderstood you a bit.
Thank you,
I'll have a look again on wxLua with the target to create an external GUI with it.
Cheers,
stefman
Posted: Sun Aug 23, 2009 4:13 pm
by Rudiger
Hi Stefman,
This is what I meant by the idea I posted on July 28.
http://www.users.on.net/~alexical/Anime ... /PlanB.png
The idea is that, when you created/updated a consolidated timeline layer, it would literally draw a representation of the time line in the workspace, which you could use to select which keys you wanted to be nudged and it would update in real time when you used the nudge tools.
Anyway, might do for a Plan B if your external app becomes too much trouble.
Posted: Sun Aug 23, 2009 8:19 pm
by stefman
Hey that looks great.
Does this work in both directions?
You move a key in the timeline --> The keys are updated and move in the animation field
The keys are updated and moved in the timeline <-- You move the keys in the animation field
And could this timeline automatically add a line whenever keys are added to a before non animated layer?
This could be a solution, you only have to have a screen wich is big enouh.
Let's keep that solution in mind for if ever I won't manage to create the GUI with wxLua. (Which is really not guaranteed

)
Cheers,
stefman
Posted: Sun Aug 23, 2009 10:59 pm
by heyvern
I actually think a separate custom "Time Line Tool" would be a way to do this.
Instead of drawing vectors "on a layer" the tool can actually draw "on the screen". The drawback of course is having to use that tool to SEE the key frames for all the layers. The "draw" features in the AS scripting are very useful. You can draw any kind of shape, have unlimited access to colors, fills, lines etc. You can "antialias" the GUI drawn elements. You could even go CRAZY and draw "widgets" with "shading" and "3D" look... it would be a waste of effort but is possible.
The problem with such a thing is storing the data it produces. However using an extra vector layer to store that data "in the points" might work.
This is a REALLY old example of a "font" I created entirely in lua that would display text "bound" to a bone and "bone colorizing" and "grouping" I was experimenting with. These are live, real screen grabs in AS. The text and bone colors AND bone outlines are drawn using only the AS GUI draw interface. If you want the code that I used for the font let me know. It should be fairly simple to use in conjunction with an "interface" tool to create text on screen.
The font had script controlled variable weights so it got thicker when small. It would "scale" with the bone it was "assigned" to. I have planned to use this for "instructions" and "labels".
This was way more complex but the same principle as the text. This demonstrates using "alpha" transparency on GUI drawn shapes and colors. The bone shapes are slightly transparent so they don't obscure the layers. In my custom tool you could assign the transparency and color of bone groups.
-vern
Posted: Mon Aug 24, 2009 1:05 am
by Rudiger
Wow, I see what you scripting veterans mean when you say that you have scarcely scratched the surface of what's possible with scripting in Anime Studio.
I didn't intend to make the workspace timeline display interactive at all, so you would still need to use the nudge keys to move the keys around, but it would let you see where all of your keyframes are and select the ones that you wanted to nudge. If you did any changes to the timeline in the conventional way, then you would have to explicitly update the consolidated timeline layer (like you do now anyway).