StaticImage and setting image

klajter

18-01-2010 11:24:03

Hi.
I've got a problem with setting image to StaticImage widget.
In one of my widgets, I have few StaticImages and in game I'm changing theirs contents (images). This images are from one image set, and here is no problem.
But in other widget I have one StaticImage, and I want to change its image like earlier ( and I'm doing it in the same way ). But this time, image hasn't changes. No matter if images.
I'm doing it by using methods:
pSI->setItemResource(resource);
pSI->setItemGroup(group);
pSI->setItemName(img);

after that, in my pSI object, texture, resource etc aren't null ( I chekced in debug ), but in game widget is empty.

I was trying to use setImageTexture() or to change widget from StaticImage to simple Widget and _setTextureName(), but with no effects.

Of course all paths to images, which I want to use, are in resource.cfg and there are exists.

Altren

18-01-2010 17:26:34

So you can't see them even when you setting same textures that you use for another StaticImages that you can see? If yes then probably your widget is hidden, have 0 size, 0 alpha or something else that you may set and forgot about it. If no - show me your layout with this StaticImage that you can't see of code where you create it.

klajter

18-01-2010 18:05:43

Widget isn't hidden, it has size, texture have correct UV etc. As I said even filed in object looks fine (names, not null pointers to texture). Sometimes ( I don't know when :/ i didn't notice any dependence when it's happens) Image is visible. When I put texture name in layout file, then image is visible in game, but when I change it to another one it "disappear".
I will put layout file tomorrow, right now I haven't access to it.

klajter

19-01-2010 05:51:09

it's my layput file:


<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Widget" skin="Item_big" position_real="0.25 0.0433333 0.5 0.843333" layer="Back" name="item_big">
<UserString key="script" value="item_bigpanel.lua"/>

<Widget type="StaticImage" skin="StaticImage" position_real="0.152778 0.16469 0.711111 0.674572" layer="Back" name="Image">
<UserString key="eventMouseClick" value="ItemClick"/>
</Widget>


<Widget type="Button" skin="ButtonXItem_big" position_real="0.925 0.0250329 0.0513889 0.0540184" layer="Back">
<UserString key="eventMouseClick" value="CloseButtonClick"/>
</Widget>
</Widget>
</MyGUI>



and skin:
http://pastebin.4programmers.net/516

klajter

19-01-2010 09:40:13

OK, I found a problem.

When all images are in one ResourceImageSet, and in one group of it , then all is OK, images are changing.
But when there are in different ResourceImageSets, or in one but in different groups, then when I change image in widget, It isn't visible :/.

Altren

19-01-2010 13:05:36

You should set not only image: when you have images in different groups you should also set group.

klajter

19-01-2010 16:57:32

As I wrote in first post, I'm setting group and resource (and image of course) every time, but it doesn't work.

my.name

19-01-2010 18:07:27

version MyGUI?

klajter

20-01-2010 07:13:07

I was trying it on some old (two months old) version from svn, and today I tried do this on MyGUI 3.0 and the effects are the same.

// My bad, with 3.0 everything works fine, with earlier version was crap