Poster: slouken at 12/27/2005 3:11:27 PM PST Subject: 1.10 sneak peek - Dynamic Frames |
| |
In the 1.10 patch you will be able to dynamically create frames, textures, and fontstrings from Lua.
New API functions:
frame = CreateFrame("frameType" [, "name"] [, parent])
texture = Frame:CreateTexture(["name"] [, "layer"]);
fontstring = Frame:CreateFontString(["name"] [, "layer"]);
parent = Texture:GetParent()
Texture:SetParent(parent or "parent")
layer = Texture:GetDrawLayer()
Texture:SetDrawLayer("layer")
parent = FontString:GetParent()
FontString:SetParent(parent or "parent")
layer = FontString:GetDrawLayer()
FontString:SetDrawLayer("layer")
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286153 |
| |
Poster: slouken at 12/27/2005 3:26:23 PM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: does a hidden frame that un hides on a specific event take up more ui memory than an event that creates and distroys a dynamic frame?
Given that you can't destroy a dynamic frame... no. :)
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286164 |
Poster: slouken at 12/27/2005 4:32:46 PM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: slouken must be the only dev which generates no hate from the forum crowd. He can do no wrong!! all the devs get hate from someone...
lol, I just get to blame the problems on designers. ;-)
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286195 |
Poster: slouken at 12/27/2005 5:10:20 PM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: What name is given to a frame if you leave the name parameter off?
""
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286212 |
Poster: slouken at 12/27/2005 7:28:03 PM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: In this case, is a lua global not created for it and then the only reference to that frame (as a lua table with userdata in [0]) the one returned by CreateFrame?
That's correct.
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286273 |
Poster: slouken at 12/27/2005 7:55:19 PM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: I'd hope to see a destroy frame function in there. I can see many devs creating dynamic frames and the memory becoming huge in some mods. Mods will have to recycle their frames I guess.
I'd expect this to have a very limited application. Most of the time the application knows exactly what and how many frames it needs in advance. It's only in cases like the world map, where you have data-driven UI without a fixed number of elements where you'd want to have dynamically created frames. And yes, you'd reuse the frames as needed.
Q u o t e:
Also will there only be frames or will there also be buttons, checkboxes, etc... for dynamic creation ?
You can create any type of frame with this, that's what the "type" parameter is.
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286283 |
Poster: slouken at 12/27/2005 7:59:49 PM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: I guess it's possible real frames userdata might get managed by the gc, but I'm not particularly knowledgable about userdata.
It's possible to set up links between garbage collection and the frame management system, but it's a pretty complex system and the game is set up to do garbage collection as little as possible (never, ideally)
Aside from garbage collection there really isn't any way to invalidate every reference to a frame in the Lua scripting system. It is possible of course to use a userdata object that refers to the frame object indirectly and does something graceful if the frame has been destroyed, but it wasn't set up that way initially because we weren't going to have dynamically created frames and didn't want the memory and code overhead of such a system.[ post edited by slouken ]
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286286 |
Poster: slouken at 12/27/2005 10:57:28 PM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: Quick offtopic, just wanted to say thanks for the all the sneak peaks. I'm a programmer but I don't do any ui development for WoW, I still read this forum because there is such great communication.
You're very welcome, it's a pleasure. :)
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286360 |
Poster: slouken at 12/28/2005 8:35:53 AM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e:
frame = CreateFrameFromXML(xml) would be cool, too, in the absence of using virtual frames defined in the XML file =)
That's not going to happen, the frames must be entirely programmatically created.[ post edited by slouken ]
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post286519 |
Poster: slouken at 1/4/2006 7:44:18 AM PST Subject: Re: 1.10 sneak peek - Dynamic Frames |
| |
Q u o t e: Can we have frame reparenting? I think I can create virtually destroyable frames with that...
You already do... Frame:SetParent()
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=286153&p=#post291465 |