LM.GUI.???

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
sherlock
Posts: 48
Joined: Fri Nov 05, 2004 1:31 am
Contact:

LM.GUI.???

Post by sherlock »

I was wondering, in addition to the following:

Menu
PopupMenu
CheckBox
Button
StaticText
DynamicText
TextControl
PopupDialog

Are there other graphic controls available? In particular, I would like to know about a combobox, radio buttons, and/or some sort of slider type control for quickly adjusting integer and float values.

Thanks,
HL
User avatar
AcouSvnt
Posts: 190
Joined: Wed Aug 04, 2004 4:14 am
Location: Rochester, NY
Contact:

Post by AcouSvnt »

Lua doesn't distinguish between floats and integers.
-Keith
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

...But the Moho Lua API does. For input or display, the GUI can be configured to input signed or unsigned float and integer values(thanks, LM!). The "Explosion" Menu script has an example of the "AngleWidget", which uses the same sort of knobs used for the directions in Particle layers. Even though it's outputting angles, a kinda kludgy(because I don't think you can get rid of the angle display below the knob) general solution would be to take it's output , convert it to the type of number you want, and drop that into a text field. The "Smoke" script (these are all in the Scripts>Particle Effects folder) is a good example of how to set up radio buttons. For quick adjustment, you can set an increment for mouse wheel adjustment, heres a snippet from the Bone Strength tool:

self.strength = LM.GUI.TextControl(0, "00.0000", self.CHANGE, LM.GUI.FIELD_UFLOAT)
self.strength:SetWheelInc(0.1)

Actually, that shows you how to define the values, too. The text field can be FLOAT, UFLOAT, INT, or UINT. I don't think there's any provision for comboboxes, but you could always add a list of common values into a popup menu. Also, I haven't tried it, but I'm sure you could draw sliders for use in the main window the same way that the various crosshairs and selection markers are, and detect when the mouse is inside them. You'd have to do some extra coding, but I suspect it's entirely possible. Kind up "heads-up display" style.

If you haven't gotten it yet, you should get the modified API script that Myles did, adress in this post. Outputs a nicely formatted copy of the API in HTML. I have a printout from it I refer to all the time.

--Brian
User avatar
AcouSvnt
Posts: 190
Joined: Wed Aug 04, 2004 4:14 am
Location: Rochester, NY
Contact:

Post by AcouSvnt »

Oh, I guess it would have to, wouldn't it ... because Moho isn't a Lua program, it's a C++ program with a Lua interface. Duh, sorry. :oops:
-Keith
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Well, dunno if it would have to. Since Lua was written expressly to work with C, and it's so "whatever" about typing, it's a wonder they can get along in the first place.

--Brian
Post Reply