Missing texture, not IsEmpty
#1
This must have come up before but I couldn't find it so apologies if it's an old question.

Does anyone have a nice way of setting a conditional or updating a Boolean in the event that a texture is empty, e.g. there is no corresponding studio flag PNG file for the name of the studio passed in List.Studio?

It doesn't show as List.IsEmpty = true because there is a value but there's no corresponding texture file available. In this scenario I'd like to shift my flags along so there is no gap or need for a generic fallback texture.

Does anyone know how to do this?

Thanks
Reply
#2
Give the image an id:
Code:
<control type="image" id="911">
Then use something like:
Code:
String.IsEmpty(Control.GetLabel(911))

I use it in my skin to show the label when there is no studio icon:
xml:

<control type="image" id="911">
<include>MediaFlagValues</include>
<texture>$VAR[PathFlagsStudios]$INFO[ListItem.Studio,,.png]</texture>
</control>
<control type="label">
<width>135</width>
<height>90</height>
<align>center</align>
<label>$INFO[ListItem.Studio]</label>
<font>font10</font>
<textcolor>grey2</textcolor>
<wrapmultiline>true</wrapmultiline>
<visible>String.IsEmpty(Control.GetLabel(911))</visible>
</control>
Reply
#3
Amazing thanks mikeSiLVO!!
Reply
#4
(2019-09-16, 22:46)QuizKid Wrote: Amazing thanks mikeSiLVO!!

Hmm, can't get this to work for some reason, it seems that String.IsEmpty(Control.GetLabel(911)) - I tested by using it as a visible condition for a test label and it showed whether there was a texture present or not.

Here are the controls in question:

xml:

<control type="image" id="911">
     <right>0</right>
     <bottom>0</bottom>
     <width>120</width>
     <height>80</height>
     <aspectratio>keep</aspectratio>
     <texture colordiffuse="$VAR[TextColor]">$VAR[Info_Certificate]</texture>
     <visible>Skin.String(Flags,all) | Skin.String(Flags,rating)</visible>
</control>
<control type="image" id="912">
     <right>0</right>
     <bottom>0</bottom>
     <width>120</width>
     <height>80</height>
     <aspectratio>keep</aspectratio>
     <texture colordiffuse="$VAR[BackgroundColor]">$INFO[ListItem.Studio,flags/studios/,.png]</texture>
     <visible>String.IsEmpty(Control.GetLabel(911))</visible>
</control>

The second control (912) is showing all the time, but I want it only to show when the first control 911 has a missing texture
Reply
#5
(2019-09-19, 00:38)QuizKid Wrote:
(2019-09-16, 22:46)QuizKid Wrote: Amazing thanks mikeSiLVO!!

Hmm, can't get this to work for some reason, it seems that String.IsEmpty(Control.GetLabel(911)) - I tested by using it as a visible condition for a test label and it showed whether there was a texture present or not.

Here are the controls in question:

xml:

<control type="image" id="911">
     <right>0</right>
     <bottom>0</bottom>
     <width>120</width>
     <height>80</height>
     <aspectratio>keep</aspectratio>
     <texture colordiffuse="$VAR[TextColor]">$VAR[Info_Certificate]</texture>
     <visible>Skin.String(Flags,all) | Skin.String(Flags,rating)</visible>
</control>
<control type="image" id="912">
     <right>0</right>
     <bottom>0</bottom>
     <width>120</width>
     <height>80</height>
     <aspectratio>keep</aspectratio>
     <texture colordiffuse="$VAR[BackgroundColor]">$INFO[ListItem.Studio,flags/studios/,.png]</texture>
     <visible>String.IsEmpty(Control.GetLabel(911))</visible>
</control>

The second control (912) is showing all the time, but I want it only to show when the first control 911 has a missing texture

@Quizkid,

Trick I use is to use a fallback in control 911’s texture tag and check for that in control 912’s visible tag. In my case I use blank.png, but you can use anything just as long as the texture displays nothing on screen. I don’t know if there is any difference in speed but I have a transparent texture call blank.png so Kodi does not throw an error about a non existent image. Should work either way.

Wyrm (AppTV)
Reply
#6
(2019-09-19, 03:49)wyrm Wrote:
(2019-09-19, 00:38)QuizKid Wrote:
(2019-09-16, 22:46)QuizKid Wrote: Amazing thanks mikeSiLVO!!

Hmm, can't get this to work for some reason, it seems that String.IsEmpty(Control.GetLabel(911)) - I tested by using it as a visible condition for a test label and it showed whether there was a texture present or not.

Here are the controls in question:

xml:

<control type="image" id="911">
     <right>0</right>
     <bottom>0</bottom>
     <width>120</width>
     <height>80</height>
     <aspectratio>keep</aspectratio>
     <texture colordiffuse="$VAR[TextColor]">$VAR[Info_Certificate]</texture>
     <visible>Skin.String(Flags,all) | Skin.String(Flags,rating)</visible>
</control>
<control type="image" id="912">
     <right>0</right>
     <bottom>0</bottom>
     <width>120</width>
     <height>80</height>
     <aspectratio>keep</aspectratio>
     <texture colordiffuse="$VAR[BackgroundColor]">$INFO[ListItem.Studio,flags/studios/,.png]</texture>
     <visible>String.IsEmpty(Control.GetLabel(911))</visible>
</control>

The second control (912) is showing all the time, but I want it only to show when the first control 911 has a missing texture 

@Quizkid,

Trick I use is to use a fallback in control 911’s texture tag and check for that in control 912’s visible tag. In my case I use blank.png, but you can use anything just as long as the texture displays nothing on screen. I don’t know if there is any difference in speed but I have a transparent texture call blank.png so Kodi does not throw an error about a non existent image. Should work either way.

Wyrm (AppTV) 

Thanks Wyrm, I'll give this a try tonight!!
Reply
#7
You could do what wyrm suggested. I used to do that but now try to avoid comparing strings if I can.

I'll just choose to think of the errors in the log as helpful bits to those that want to add more logos to the studio resource image packs Tongue

Out of curiosity what is the contents of $VAR[Info_Certificate]?
Reply
#8
(2019-09-19, 14:12)mikeSiLVO Wrote: You could do what wyrm suggested. I used to do that but now try to avoid comparing strings if I can.

I'll just choose to think of the errors in the log as helpful bits to those that want to add more logos to the studio resource image packs Tongue

Out of curiosity what is the contents of $VAR[Info_Certificate]?

@mikeSiLVO, with you on string compares are evil, but sometimes difficult to avoid. I am a huge believer in failing gracefully (user should not know something did not go to plan) as users never report minor problems like this. Result of this is skin writers seldom if ever see the errors in the logs, so probably best to avoid them if you can.

As always, mileage will vary.
Wyrm
Reply
#9
(2019-09-19, 14:12)mikeSiLVO Wrote: You could do what wyrm suggested. I used to do that but now try to avoid comparing strings if I can.

I'll just choose to think of the errors in the log as helpful bits to those that want to add more logos to the studio resource image packs Tongue

Out of curiosity what is the contents of $VAR[Info_Certificate]?
It's the existing code for Copacetic, I think because there are a few different ways people had UK ratings scraped, but Hitcher would know best

xml:

    <variable name="Info_Certificate">
        <value condition="String.Contains(ListItem.mpaa,U)">flags/rating/bbfc_u.png</value>
        <value condition="String.Contains(ListItem.mpaa,PG)">flags/rating/bbfc_pg.png</value>
        <value condition="String.Contains(ListItem.mpaa,12)">flags/rating/bbfc_12.png</value>
        <value condition="String.Contains(ListItem.mpaa,15)">flags/rating/bbfc_15.png</value>
        <value condition="String.Contains(ListItem.mpaa,18) | String.Contains(ListItem.mpaa,UK:X)">flags/rating/bbfc_18.png</value>
        <value>EMPTY</value>
    </variable>
Reply
#10
Because of the last variable value it will never be empty so use this instead -

<visible>String.IsEqual(Control.GetLabel(911),EMPTY)</visible>
Reply
#11
(2019-09-20, 19:42)Hitcher Wrote: Because of the last variable value it will never be empty so use this instead -

<visible>String.IsEqual(Control.GetLabel(911),EMPTY)</visible>

Thanks @Hitcher  I removed the EMPTY as I thought there might be scenarios where people are using other country flags or something that the variable has a legit value but there's no correspoding flag, and in this instance I thought comparing to EMPTY might still not account for the missing texture.

I got it working by comparing strings with the fallback value as @wyrm suggested. It seems to be working ok.

Thanks everyone for the help. It's funny how in trying to understand how the skinning engine works, sometimes things that seem very daunting are very simple, but something as small as showing an image if another image is missing a texture causes me all sorts of headaches, haha
Reply
#12
Still having some problems with this, not sure if I've made a basic error or this is the reason why people don't like comparing strings, but....

Sometimes it seems that Control.GetLabel(91w) is empty and I'm not sure why.

I have two pretty much identical controls being used in different <includes>, one for flags on media views and one for flags on the infoscreen

xml:

            <control type="image" id="912">
                <right>0</right>
                <bottom>0</bottom>
                <width>120</width>
                <height>80</height>
                <aspectratio>keep</aspectratio>
                <texture colordiffuse="$VAR[TextColor]" fallback="flags/blank.png">$VAR[Info_Certificate]</texture>
                <visible>[Skin.String(Flags,all) | Skin.String(Flags,rating)]</visible>
            </control>

xml:

            <control type="image" id="914">
                <left>0</left>
                <top>0</top>
                <width>120</width>
                <height>80</height>
                <aspectratio>keep</aspectratio>
                <texture colordiffuse="$VAR[TextColor]" fallback="flags/blank.png">$VAR[Studio_Name]</texture>
            </control>

For testing purposes, I created two labels on my list view to test why 912 works but 914 doesn't.

xml:

<control type="label">
                <label>$INFO[Control.GetLabel(912)]</label>
                <top>200</top>
                <font>list_focused</font>
            </control>
            <control type="label">
                <label>$INFO[Control.GetLabel(914)]</label>
                <top>300</top>
                <font>list_focused</font>
            </control>

Control.GetLabel(911) displays the correct MPAA listings from the variable or the fallback text if there is a texture missing.

But Control.GetLabel(914) is blank all the time and I have no idea what the difference is...
Reply
#13
What's the variable code for Studio_Name?
Reply
#14
(2019-09-22, 15:57)Hitcher Wrote: What's the variable code for Studio_Name?

xml:

    <variable name="Studio_Name">
        <value condition="!String.IsEmpty(ListItem.Studio)">$INFO[ListItem.Studio,flags/studios/,.png]</value>
        <value>flags/blank.png</value>
    </variable>

I thought for a bit that the GetLabel was working for $VAR and not $INFO but in the end it didn't make any difference
Reply
#15
Does the studio flag work correctly?
Reply

Logout Mark Read Team Forum Stats Members Help
Missing texture, not IsEmpty0