mdl 'forwarding' and transparency

Discussion area for user-created Allegiance models, textures, voicechats, music, and other ingame content.
Post Reply
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

Hi,

I've set my mind on changing the f4 and f7 menu, or at least making a mod that makes it easier to mod those.

For now i'm trying to make the mechanics work, focusing primarily on the inventory screen.

What i'm trying to do is to replace the current bitmap.mdl with a text.mdl that in turn imports a png, aphachannels and all. (Note that I'm using the only function i know that actually succeeds in blending transparency properly: the one that handles gauges. Yeah, it's a kludge. I'm open for suggestions on that one).

this works:

for e.g. inventorylinebkgndbmp.mdl

Code: Select all

use "model";
    inventorylinebkgndbmp = 
              ImportImageFromFile("mods/CThruPanes/media/cthru_inventorylinebkgnd.png", true);
this doesn't:

Code: Select all

use "model";
inventorylinebkgndbmp = 
    TranslateImage(
        BlendImage(
            GaugeImageRect(
                JustifyBottom,
                ImportImageFromFile("mods/CThruPanes/media/cthru_inventorylinebkgnd.png", true),
                Rect(0, 0, 214, 18),
                true,
                1
            ), 
        BlendModeAdd
        ),
    Point(0,0)
    );
any ideas?
Last edited by Bunnywabbit on Mon Jun 01, 2009 10:16 pm, edited 1 time in total.
ImageImage current version r158 new beta as of jan 23 2012
Andon
Posts: 5453
Joined: Sun Jun 03, 2007 8:29 pm
Location: Maryland, USA
Contact:

Post by Andon »

From what I can guess, it's the Rect bit - You're confusing it with multiple dimensions is the best way to put it, even though the dimensions may be the same.

I would try finding an example of and using just a plain GaugeImage
Image
ImageImage
Orion
Posts: 1733
Joined: Tue Jul 01, 2003 7:00 am
Location: Planet Min·ne·so·ta
Contact:

Post by Orion »

Rect's typically have (x, y, width, height) parameters.
Image
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

that would be strange;

i used the rect's in this format before. the image is in fact 214x18 px....

....

doh!

i'm an idiot.
the image should of course be of a power of 2 in size!

lemme check....

>>>>>>>>>
hmmm... Okay, that didn't work.

More experimentation and lots of crashes reveals the following.

Putting that GaugeImageRect code into a dialog.mdl renders it fine. However, if I change it into an ImagePane, it crashes.

Is there something about ImagePanes and transparency i need to know about? For instance, say, that they don't work together?

>>>>>>>>

Even more experimentation reveals that alleg doesn't like it if you import via plain simple ImportImage(), an mdl file with code for transparency in it.

it is possible, however, to put the transforming operations in the calling mdl file.

so this works:

in BunnyThing.mdl

Code: Select all

 use "model";

BunnyThing = 
    ImportImageFromFile("mods/CThruPanes/media/BunnyThing.png", true);
in dialog.mdl (example)

Code: Select all

BunnyThing = 
    BlendImage(
        GaugeImageRect(
            JustifyBottom,
            ImportImage("BunnyThing", true),
            Rect(0, 0, 256, 256),
            true,
            1
        ),
    BlendModeAdd
    );
and this doesn't:

"in BunnyThing.mdl

Code: Select all

 use "model";

BunnyThing = 
    BlendImage(
        GaugeImageRect(
            JustifyBottom,
    ImportImageFromFile("mods/CThruPanes/media/BunnyThing.png", true),
            Rect(0, 0, 256, 256),
            true,
            1
        ),
    BlendModeAdd
    );
in dialog.mdl (example)

Code: Select all

BunnyThing = ImportImage("BunnyThing", true);
now to figure out what that means wrt ImagePanes...
Last edited by Bunnywabbit on Tue Jun 02, 2009 1:11 pm, edited 1 time in total.
ImageImage current version r158 new beta as of jan 23 2012
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

okay, so i'm trying to make this work:

in invafterburn.mdl:


Code: Select all

use "inventorypart";
use "model";

<<< some stuff i haven't touched >>> 

 InventoryLineBG = 
        GaugeImageRect(
            JustifyBottom,
            ImportImageFromFile("mods/CThruPanes/media/cthru_inventorylinebkgnd.png", true),
            Rect(0, 0, 214, 18),
            true,
            1
        );

InventoryLine = 
    ImagePane(
        InventoryLineBG,
        [
     <<<< list of stuff i didn't touch and some other stuff i also didnt touch >>>>
    ]
);
Last edited by Bunnywabbit on Tue Jun 02, 2009 6:25 pm, edited 1 time in total.
ImageImage current version r158 new beta as of jan 23 2012
Andon
Posts: 5453
Joined: Sun Jun 03, 2007 8:29 pm
Location: Maryland, USA
Contact:

Post by Andon »

BBC tags, like bold, don't work in code boxes.
Image
ImageImage
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

Andon wrote:QUOTE (Andon @ Jun 2 2009, 05:15 PM) BBC tags, like bold, don't work in code boxes.
so i see.
yes, that is needlessly confusing, ill edit them out.
ImageImage current version r158 new beta as of jan 23 2012
madpeople
Posts: 4787
Joined: Tue Dec 16, 2003 8:00 am
Location: England

Post by madpeople »

CODEthey do work in

Code: Select all

es though[/b], just not in [i]code[/i] boxes
Last edited by madpeople on Tue Jun 02, 2009 6:47 pm, edited 1 time in total.
Andon
Posts: 5453
Joined: Sun Jun 03, 2007 8:29 pm
Location: Maryland, USA
Contact:

Post by Andon »

ahhh, a

Code: Select all

 instead of just code...
Image
ImageImage
Bunnywabbit
Posts: 965
Joined: Sun May 15, 2005 7:00 am
Location: Amsterdam, the Netherlands

Post by Bunnywabbit »

so i hate to spoil a good derail when it's gaining track, but any ideas as to the whole imagepane - transparency thing?

<<< update >>>

I consulted with KGJV and he managed to retrieve some info out of dusty memories of messing with the code.

Wrt transparency and blending, all he recalls is that it is 'a hell of a hack' in the engine code.

Wrt Panes and Images, he mentions that they are handled completely differently. They are 'two worlds' and translating between the two of them comes with big problems. Complicated stuff like transparency is often lost.

Transparency and blending being part of the 'image world' and 2D images in the menus being part of the 'Pane world', the odds that those menus will become translucent become slim. I will have to see if i can rework those F4 and F7 panes as images....

Meanwhile, i'll wikify the info i collected in my quest.
Last edited by Bunnywabbit on Thu Jun 04, 2009 7:27 am, edited 1 time in total.
ImageImage current version r158 new beta as of jan 23 2012
Post Reply