Kodi Community Forum

Full Version: Menu Button to switch between animations for discart
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello
I'm currently on 16.1 jarvis, and using aeon mq6 skin, I want to add a button in includestopmenu.xml (general section) that can switch between 2 different animation for Discart for movies in dialogvideoinfo view , currently the only way to switch between them is to replace the xmls manually. I was hesitant about at which forum I should post this, but then I figured It is more likelt to belong here, I have searched and couldn't find anything in this regard, any help is appreciated.
first animation
Code:
<control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>!Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true">
                    <effect type="slide" start="-1500,0" end="0" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="rotate" start="0" end="-720" center="auto" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="zoom" start="104" center="auto" end="100" delay="5120" time="140" tween="quadratic" easing="out" />
                </animation>
                    <animation effect="rotate" end="-360" center="auto" delay="5500" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>

second animation
Code:
<control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>!Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true">
                    <effect type="slide" start="235,0" end="0" delay="800" time="1200" tween="quadratic" easing="out"/></animation>
                    <animation effect="rotate" end="-360" center="auto" delay="2000" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>

Image
add Skin.SetBool(foo) to your button and use Skin.HasSetting(foo) / !Skin.HasSetting(foo) in the visible conditions of the images?
(2016-05-28, 13:51)ronie Wrote: [ -> ]add Skin.SetBool(foo) to your button and use Skin.HasSetting(foo) / !Skin.HasSetting(foo) in the visible conditions of the images?

Thank you ronie very much
I added the conditional visibility to the images like this , what you think of this?

Code:
<control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>Skin.HasSetting(DiskartAnimation1) + !Skin.HasSetting(DiskartAnimation2) + !Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true">
                    <effect type="slide" start="-1500,0" end="0" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="rotate" start="0" end="-720" center="auto" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="zoom" start="104" center="auto" end="100" delay="5120" time="140" tween="quadratic" easing="out" />
                </animation>
                    <animation effect="rotate" end="-360" center="auto" delay="5500" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>
            
            <control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>Skin.HasSetting(DiskartAnimation2) + !Skin.HasSetting(DiskartAnimation1) + !Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true">
                    <effect type="slide" start="235,0" end="0" delay="800" time="1200" tween="quadratic" easing="out"/></animation>
                    <animation effect="rotate" end="-360" center="auto" delay="2000" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>

Now only two steps remaining , adding the variables and adding the buttons to includestopmenu.xml, but I cannot figure out exactly how
maybe something like this
Code:
<variable name="value_discartanimation">
    <value condition="StringCompare(skin.string(discartanimation),discart) + Container.Content(movies) + !IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart) + Skin.HasSetting(DiskartAnimation1)]</value>
    <value condition="StringCompare(skin.string(discartanimation),discart) + Container.Content(movies) + IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart) + Skin.HasSetting(DiskartAnimation2)]</value>
    </variable>
this is the button I created inside includestopmenu.xml
Code:
<control type="button" id="92152">
    <include>TopMenuButton</include>
    <label>Diskart Animation</label>
    <label2>$VAR[DiskartAnimationValue]</label2>
    <onclick condition="StringCompare(skin.string(discartanimation_dialog),animationright)">Skin.SetString(discartanimation_dialog,animationleft)</onclick>
    <onclick condition="StringCompare(skin.string(discartanimation_dialog),animationleft)">Skin.SetString(discartanimation_dialog,animationright)</onclick>    
    <onclick condition="Skin.HasSetting(animationleft)">Skin.SetBool(animationleft)</onclick>
    <onclick condition="Skin.HasSetting(animationright)">Skin.SetBool(animationright)</onclick>
    </control>

the variables are like this inside includesvariable.xml

Code:
<variable name="value_discartanimation">
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationright) + Container.Content(movies) + !IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationright) + Container.Content(movies) + IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationleft) + Container.Content(movies) + !IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationleft) + Container.Content(movies) + IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    </variable>
        
    
<variable name="DiskartAnimationValue">
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationright)">Right</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationleft)">Left</value>
    </variable>

and these are the discart images inside dialogvideoinfo.xml
Code:
<control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>Skin.HasSetting(animationleft) + !Skin.HasSetting(animationright) + !Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true">
                    <effect type="slide" start="-1500,0" end="0" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="rotate" start="0" end="-720" center="auto" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="zoom" start="104" center="auto" end="100" delay="5120" time="140" tween="quadratic" easing="out" />
                </animation>
                    <animation effect="rotate" end="-360" center="auto" delay="5500" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>
            
            <control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>Skin.HasSetting(animationright) + !Skin.HasSetting(animationleft) + !Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true">
                    <effect type="slide" start="235,0" end="0" delay="800" time="1200" tween="quadratic" easing="out"/></animation>
                    <animation effect="rotate" end="-360" center="auto" delay="2000" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>

the button does nothing , and neither the animation nor the discart appear, I don't know what I'm doing wrong
Image
I looked at your code and the first that cones to mind is.. wow thats alot of fickering for very little. If all you want to do is toggle a bool. Do that and check for it when you <include>

But there may be more to what you want.. then I really apologize for not reading it all ;-)
i think you're over-complicating it ;-)

i'd start with using a radio button:
Code:
<control type="radiobutton" id="92152">
    <include>TopMenuButton</include>
    <label>Diskart Animation</label>
    <label2>$VAR[DiskartAnimationValue]</label2>
    <enabled>Skin.HasSetting(animationright)</enabled>
    <onclick>Skin.ToggleSetting(animationright)</onclick>
</control>

then use Skin.HasSetting(animationright) and !Skin.HasSetting(animationright) elsewhere in your code.
(2016-05-28, 21:13)Torben Wrote: [ -> ]I looked at your code and the first that cones to mind is.. wow thats alot of fickering for very little. If all you want to do is toggle a bool. Do that and check for it when you <include>

But there may be more to what you want.. then I really apologize for not reading it all ;-)

thank you Torben , off course I don't need to store it, I simply want to toggle between two different animations for discart, in dialogvideoinfo, one of them is coming in from right the other coming from left,

(2016-05-28, 21:15)ronie Wrote: [ -> ]i think you're over-complicating it ;-)

i'd start with using a radio button:
Code:
<control type="radiobutton" id="92152">
    <include>TopMenuButton</include>
    <label>Diskart Animation</label>
    <label2>$VAR[DiskartAnimationValue]</label2>
    <enabled>Skin.HasSetting(animationright)</enabled>
    <onclick>Skin.ToggleSetting(animationright)</onclick>
</control>

then use Skin.HasSetting(animationright) and !Skin.HasSetting(animationright) elsewhere in your code.
thank you ronie
I added the radio button and used Skin.HasSetting(animationright) and !Skin.HasSetting(animationright) in the discart images, and I'm still stuck , I think my variables have problems but I can't pinpoint them
Code:
<variable name="value_discartanimation">
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationright) + Container.Content(movies) + !IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationright) + Container.Content(movies) + IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationleft) + Container.Content(movies) + !IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationleft) + Container.Content(movies) + IsEmpty(ListItem.Art(discart))">$INFO[ListItem.Art(discart)]</value>
    </variable>    
    
<variable name="DiskartAnimationValue">
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationright)">Right</value>
    <value condition="StringCompare(skin.string(discartanimation_dialog),animationleft)">Left</value>
    </variable>
(2016-05-28, 21:42)DolGuldur Wrote: [ -> ]I added the radio button and used Skin.HasSetting(animationright) and !Skin.HasSetting(animationright) in the discart images, and I'm still stuck , I think my variables have problems but I can't pinpoint them

you need to use those conditions in your variables as well (instead of the stringcompare()).
(2016-05-29, 02:01)ronie Wrote: [ -> ]
(2016-05-28, 21:42)DolGuldur Wrote: [ -> ]I added the radio button and used Skin.HasSetting(animationright) and !Skin.HasSetting(animationright) in the discart images, and I'm still stuck , I think my variables have problems but I can't pinpoint them

you need to use those conditions in your variables as well (instead of the stringcompare()).

Thank you so much ronie, your help is truly appreciated, I did it exactly as you said and finally succeeded , one click toggles between the two different discart animations, one coming from right the other coming from left which is exactly as I wanted, so thank you again very very much, here are the final results
only one variable is required which is
Code:
variable name="DiskartAnimationValue">
    <value condition="Skin.HasSetting(animationright)">Right</value>
    <value condition="!Skin.HasSetting(animationright)">Left</value>
    </variable>

I changed the button to regular button which I prefer, radio button also works fine
Code:
<control type="button" id="92152">
    <include>TopMenuButton</include>
    <label>Diskart Animation</label>
    <label2>$VAR[DiskartAnimationValue]</label2>
    <enabled>Skin.HasSetting(animationright)</enabled>
    <onclick>Skin.ToggleSetting(animationright)</onclick>
</control>



the controls are exactly the same only the animations are different, I tried to bring them under one control but it messes up the animation , anyway I'm happy with this

Code:
<control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>!Skin.HasSetting(animationright) + !Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true" condition="!Skin.HasSetting(animationright)">
                    <effect type="slide" start="-1500,0" end="0" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="rotate" start="0" end="-720" center="auto" delay="800" time="4120" tween="quadratic" easing="out" />
                    <effect type="zoom" start="104" center="auto" end="100" delay="5120" time="140" tween="quadratic" easing="out" />
                </animation>
                    <animation effect="rotate" end="-360" center="auto" delay="5500" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>
            
            <control type="image">
                <!-- Show Discart -->
                <posx>1093</posx>
                <posy>313</posy>
                <height>372</height>
                <width>375</width>
                <aspectratio>keep</aspectratio>
                <texture background="true">$INFO[ListItem.Art(discart)]</texture>
                <visible>Skin.HasSetting(animationright) + !Container.Content(episodes) + !Container.Content(tvshows)</visible>
                <include>Animation_VisibleChange200</include>
                <animation type="WindowOpen" reversible="true" condition="Skin.HasSetting(animationright)">
                    <effect type="slide" start="235,0" end="0" delay="800" time="1200" tween="quadratic" easing="out"/></animation>
                    <animation effect="rotate" end="-360" center="auto" delay="2000" time="9000" loop="true" reversible="true" condition="System.IdleTime(2)">Conditional</animation>
            </control>

Left side aniamtion
Image
Image
Image




Right side aniamtion
Image
Image
Image