[sldev] [VIEWER][META] Trying to use LLUICtrlFactory to create a custom panel or how I learned to love the Bomb

Lawson English lenglish5 at cox.net
Fri Sep 14 13:41:10 PDT 2007


Has anyone ever added a custom GUI widget to the SL GUI framework?

OK, the background:

Idea: create a replacement for that silly 200+ item drop down combobox 
at the bottom of hte LSL editor.

Make it a floater with hierarchical categories based on what you find at 
the LSL wiki.

Should be simple: just derive a new class from whatever is used to make 
the inventory floater in the client.

Whoops. Nope. LLInventoryView is rather entangled with the client's 
need. Not designed for something simple...

OK, there's bound to be a intermediate, simpler class...

 Nope. LLInventory bypasses LLScrollListCrtl and reinvents the wheel 
based on LLPanel.

OK... So, lets roll our own faux outline class based on LLScrollListCrtl.


OK, seems doable. Now, before we go much further, lets make sure we can 
create it using the LLUICtrolFactory widget thing...


Uh-oh...

Some checking around, I find that WIDGET_TYPE_SCROLL_LIST occurs 5 
places in 4 files:

llscrolllistctrl.h, llui.h, lluictrlfactory.cpp, llfloatereditui.cpp

I can add the various references to WIDGET_TYPE_FAUX_OULINE_LIST no 
problem and create my own callback in various spots.

I can see that I likely need to create several methods for my class:

    virtual EWidgetType getWidgetType() const { return 
WIDGET_TYPE_SCROLL_LIST; }
    virtual LLString getWidgetTag() const { return 
LL_SCROLL_LIST_CTRL_TAG; }
    virtual LLXMLNodePtr getXML(bool save_children = true) const;
    void setScrollListParameters(LLXMLNodePtr node);
    static LLView* fromXML(LLXMLNodePtr node, LLView *parent, 
LLUICtrlFactory *factory);


The question:

is that all? This seems relatively straightfoward by SL client 
standards, albeit annoyingly difficult for the single use that I would 
put it to, but given that I'm seeing many possible uses for a outline 
list class, even one as baby-fied as what I'm working on, it would be 
worth the work. Yes, I know that a outline list view is due out sometime 
"soon," but how soon? mono-time? And will it do what *I* want, but only 
some esoteric, SL-specific thing that one person out of 100,000 
potential users wants?

In addition to a better way of inserting keywords into LSL, I can see 
its utility in creating:

A library of scripts, without having to go out to the asset server for 
each and every one of them, save when saving the selected library entry 
to a real script in inventory or the prim...

A library of notes about avatars, events, places, etc, cached on the 
client's harddrive, so that they can be searched without using the asset 
server...

A script creator, ala Hilaray Mason's, 
http://www.3greeneggs.com/autoscript/, would also benefit from a 
lightweight nested hierarchical list  panel, I think.

Some might say "its never been done, so no-one must want it," but note 
that it is impossible to do anything simple in the SL viewer without 
"rolling your own," including analyzing the convoluted nature of the 
interacting classes, so the most useful (usually the most simple) stuff 
never gets done, just the convoluted stuff, that is useful only to a 
select handful of people who need something complex.



So again: what am I missing? Is there more to adding a new class type to 
the GUI factory than I have said? Is this documented anywhere, or am I 
again in virgin territory?

("here be dragons" reference goes here)

L.









More information about the SLDev mailing list