<include condition=

Discussion and development of skins for XBMC4XBOX
Post Reply
User avatar
byron
Posts: 575
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 26 times
Been thanked: 92 times

<include condition=

Post by byron » Fri Sep 21, 2012 5:54 pm

Was wondering if there is a more efficient way of writing this http://pastebin.com/gnUt3RuN. I have it so that all breadcrumb items are customizable (font color and background color), and i thought that those four lines could be merged into one condition but I don't know how to do it (or if it's even possible). I'm curious because when i made it customizable my RAM took a pretty good hit (I have that code in several files now as well as this http://pastebin.com/dWChs73e for the fonts). Any help would be MUCH appreciated

User avatar
byron
Posts: 575
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 26 times
Been thanked: 92 times

Re: <include condition=

Post by byron » Sat Sep 22, 2012 7:47 pm

Ok, I'm not sure if nobody replied because they didn't uderstand what I was asking, or if they didn't know how to help. Either way it doesn't matter because I figured it out :D I wouldn't usually make another post here but this is really cool and I think what I did should be explained in case someone else wants to try it (and I'm pretty sure the advanced skinners already know how to do this so please bear with me).

Anyway, specifically what I was doing was adding skin options into my custom_SkinSettings.xml so that I would be able to have the choice of how I wanted my top bar to look:

http://pastebin.com/ASbH6JUa (also did the same thing for BreadcrumbFontColor, BreadcrumbHomeIcon, and the TopBarColor was already done when I got the skin originally)

So now when I enter "skin settings" in the skin I have the option to chanage these things from a GUI standpoint. This is where I was when I originally posted my question, and thus the code that I was asking about previously. The problem was that there were numerous accounts of that code for TopBarColor, BreadCrumbBackgroundColor, and BreadCrumbFontColor throughout my 720p folder, and they were all "<include>" which stay in memory until the skin is reloaded or XBMC is restarted (these tags eat up memory). This is the cool part, and I think it might be what Wannabgt4 was talking about with "incluception" but I'm not entirely sure. So the main problem was that the code was mostly in my includes_Breadcrumb.xml file (font color includes and background color includes plus http://pastebin.com/gnUt3RuN), and

<include condition="foo" file="includes_foo.xml">foobar</include>

doesn't work for several lines of "skin.string" code, not to mention the fact that I ended up with 100 or more extra little <include> tags after I was finished with my customization. What I ended up doing was making a new .xml file, moved all of the related code to one spot to make another "<include name=" (to avoid having to include everything from includes_Breadcrumb.xml file just to get what little i wanted out of it) and created this http://pastebin.com/XS1ygaez (for TopBarColor, and FontColor as well) so that i could end up with these:

<include condition="skin.String(BreadCrumbBackgroundColor)" file="includes_BreadCrumbSettings.xml">BreadCrumbBackgroundSettings</include>

<include condition="skin.String(BreadCrumbFontColor)" file="includes_BreadCrumbSettings.xml">BreadCrumbFontSettings</include>

<include condition="skin.String(TopBarColor)" file="includes_BreadCrumbSettings.xml">TopBarColorSettings</include>

These replace the relevant four lines of code and take away from the RAM eating :) Soooooo, long story short I basically just created three more <include>'s in the skin, but I wasn't sure how to go about doing that with a "skin.string" command. Sorry for such a long post, especially if this is common knowledge...but hopefully someone can benefit from this along the way---

User avatar
Dan Dar3
Posts: 1147
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 247 times
Been thanked: 243 times
Contact:

Re: <include condition=

Post by Dan Dar3 » Sat Sep 22, 2012 8:42 pm

@byron
Not a lot of skinners here, you can always post but if no replies, might want to PM xbs, he is the only skin expert we have around here (as far as I know :-))

User avatar
BuZz
Site Admin
Posts: 1889
Joined: Wed Jul 04, 2012 12:50 am
Location: UK
Has thanked: 62 times
Been thanked: 422 times
Contact:

Re: <include condition=

Post by BuZz » Sun Sep 23, 2012 12:38 am

yeh we are a bit short on skinners, so your post is appreciated, and welcome also ;-)

User avatar
byron
Posts: 575
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 26 times
Been thanked: 92 times

Re: <include condition=

Post by byron » Sun Sep 23, 2012 7:38 am

Thanks guys, nice to know...it's silly, you get so buried in code that when you actually stick your head up out of it you expect people to understand where you're coming from. I'm not bashful, if I have anything to share i most definitely will :) I'm starting to get a pretty firm grasp on the skinning aspect of things, but i don't really know what I can do to help "the cause," my efforts at this point are pretty self-centered. I kinda wanna post a beta of what I'm doing, but it's not there yet

NOTTHESAME
Posts: 532
Joined: Thu Aug 02, 2012 7:46 am
Has thanked: 82 times
Been thanked: 61 times

Re: <include condition=

Post by NOTTHESAME » Mon Aug 12, 2013 10:03 am

this code seems that it could be used for a few skins that we have that run low on ram, let me see if this works on xperience and if so and ill see if it can be lowered down to one instead of 4 lines, be back later on

User avatar
byron
Posts: 575
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 26 times
Been thanked: 92 times

Re: <include condition=

Post by byron » Sat Aug 17, 2013 5:39 am

@ NOTTHESAME...sorry I must have not seen you reply to this. It should work on any skin, and my guess is that most of them already use

<include condition="foo" file="includes_foo.xml">foobar</include> (has to be some kind of condition)

The more you can conditionally include, the more RAM you will save. But it becomes tricky to figure out the patterns and such for what the skinner has done, and also really requires some brainpower to find something from that list that might work (much trial and error). What I was working on when I posted this was real time customization from skin settings (didn't want a theme, wanted a user to be able to choose any combination of the options available in my mod). If you have rapier, look at includes_BreadCrumbSettings.xml (lines 102-126 and then see how I wrapped it into another include from 136-141)

Code: Select all

<!--  BREADCRUMB FONT COLOR  ---------------------------------------------------------------------------------->
	<include name="BreadCrumbDefaultFontColor">
		<textcolor condition="Skin.String(BreadCrumbFontColor,1)">BreadCrumbColor</textcolor> <!-- GREY -->
		<shadowcolor>-</shadowcolor>
		<focusedcolor>ThemeColor</focusedcolor>
	</include>
	
	<include name="BreadCrumbFontColor2">
		<textcolor condition="Skin.String(BreadCrumbFontColor,2)">cc72644E</textcolor> <!-- VANILLA -->
		<shadowcolor>-</shadowcolor>
		<focusedcolor>ThemeColor</focusedcolor>
	</include>
	
	<include name="BreadCrumbFontColor3">
		<textcolor condition="Skin.String(BreadCrumbFontColor,3)">ff454A4F</textcolor> <!-- BLUE -->
		<shadowcolor>-</shadowcolor>
		<focusedcolor>ThemeColor</focusedcolor>
	</include>
	
	<include name="BreadCrumbFontColor4">
		<textcolor condition="Skin.String(BreadCrumbFontColor,4)">ccE5E5E5</textcolor> <!-- WHITE -->
		<shadowcolor>-</shadowcolor>
		<focusedcolor>ThemeColor</focusedcolor>
	</include>
<!--  BREADCRUMB FONT COLOR  ---------------------------------------------------------------------------------->
Wrapped into:

Code: Select all

<include name="BreadCrumbFontSettings">
	<include condition="Skin.String(BreadCrumbFontColor,) | Skin.String(BreadCrumbFontColor,1)" file="includes_BreadCrumbSettings.xml">BreadCrumbDefaultFontColor</include>
	<include condition="Skin.String(BreadCrumbFontColor,2)" file="includes_BreadCrumbSettings.xml">BreadCrumbFontColor2</include>
	<include condition="Skin.String(BreadCrumbFontColor,3)" file="includes_BreadCrumbSettings.xml">BreadCrumbFontColor3</include>
	<include condition="Skin.String(BreadCrumbFontColor,4)" file="includes_BreadCrumbSettings.xml">BreadCrumbFontColor4</include>
</include>
In this case it's a string I've conditionally included and the code for this example is:

<include condition="skin.String(BreadCrumbFontColor)" file="includes_BreadCrumbSettings.xml">BreadCrumbFontSettings</include>

If you really want to see what I did and how I did it let me know and I'll tell you where to look in the xml's rather than squinting at these code boxes. Bottom line is less includes = more RAM (but more processor usage if you get too out of control with it). More conditionally included items results in more available RAM. If you want to see a pretty quick jump in performance without doing too much work though, knock out all of the animations includes that you can from includes.xml or includes_animations.xml etc...By that I mean copy the code from the <include name="foo"> tags and replace

<include>foo</include> with that code. Hope that makes sense :)

Post Reply