Page 1 of 1

Request to widget makers: Iconmodel

Posted: 18 May 2007, 12:51
by KDR_11k
There are some widgets that display the unit model as an icon (e.g. idle builders, selection buttons, group buttons). However, this is the base pose of the model used for the unit. For some units this is not desirable since e.g. the unit shares its model with others by hiding parts, contains effect objects (e.g. construction frames or the hourglass on the window in Kernel Panic Corruption) that aren't shown on the model normally or the unit is just posed in an unappealing or unrepresentative way (e.g. KPC Security Hole or Kernel) for better scripting.

It would be helpful if modders could define a separate model to be used for these widgets that have the hidden parts removed and possibly stand in a position that's more representative of the unit, perhaps even with additions for easier differentiation of the selection icons.

Posted: 18 May 2007, 13:29
by zwzsg
Said model should also be used for the ghost building you see when placing it, if I may add.

However, personnaly I'd just like a Cob Function, MakesModelPretty(), that contains all the move/turn to make the model presentable. Because I hate any kind of duplicate, makes maintenace hellish.

Ex: You touch up a model, with your method you have to touch up the icon model as well. While with mine, no.

Posted: 18 May 2007, 15:22
by KDR_11k
Yes but I figured Lua just reads the data from the model and dumps it on the screen with no understanding for what a COB is.

Posted: 18 May 2007, 18:28
by rattle
I have a different idea. Use the buildpic instead of a 3D model.

Posted: 19 May 2007, 19:55
by chlue
I used this luafunction to draw the buildpic of a unit some time ago.

Code: Select all

local function drawbuildPic(coord,unitDefID,Color)
	gl.Color(Color)
	gl.Texture("#" .. unitDefID)
	gl.Shape(GL_QUADS, {
    { v = { coord.x + 1, coord.y + 1 }, t = { 0, 1 } },
    { v = { coord.x+iconSizeX - 0, coord.y + 1 }, t = { 1, 1 } },
    { v = { coord.x+iconSizeX - 0, coord.y+iconSizeY - 0 }, t = { 1, 0 } },
    { v = { coord.x + 1, coord.y+iconSizeY - 0 }, t = { 0, 0 } },
	})
	gl.Texture(false)
end
(needs the variables iconSizeX, iconSizeY)

Posted: 20 May 2007, 00:28
by trepan
gl.TexRect() is a faster / easier call that can be used with SVN lua.