Conditional colordiffuse
#1
I'm looking for a way to do a colordiffuse with buttons that takes effect based on when the button has focus, and as far as I can tell, this isn't possible right now unless i want to get extremely hackish and messy. In my case, I would like it to take effect only when the button does not have focus but I can certainly see it being useful for both cases. I'm thinking the best way might be just to let conditions in general apply to colordiffuses:

<colordiffuse condition="!Control.HasFocus(21)">ff3344ff</colordiffuse>
Reply
#2
I suppose another option would be to add a tags like for texture. <colordiffusefocus> and <colordiffusenofocus>

EDIT: One other use I could have for a conditional colordiffuse would be applying a different colordiffuse when a button is disabled.
Reply
#3
this would be useful.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#4
Personally I would make it a new animation type
<animation type="diffuse" start="FFFFFFFF" end="ff3344ff" time="200" condition="!Control.HasFocus(21)">Conditional</animation>

much more flexible
Reply
#5
good idea
Reply
#6
The problem is that the colorspace is not necessarily linear. i.e. it would require us to cycle through the colour space while altering both A,R,G and B separately.

Animations (as they are currently at least) are also multiplicative - i.e. one can have multiple animations that are all applied simultaneously from a window, down through controlgroups to individual controls. I'm not sure how well this would apply.

Certainly something interesting to look into though.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#7
you could try the setProperty() builtin or even a setString() for the buttons that getfocus.

so for control 21:

<onfocus>SetProperty(colordiffuse,ff3344ff)</onfocus>

then in the other control.

<colordiffuse>$INFO[Window.Property(colordiffuse)]</colordiffuse>
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#8
jmarshall Wrote:The problem is that the colorspace is not necessarily linear. i.e. it would require us to cycle through the colour space while altering both A,R,G and B separately.

Animations (as they are currently at least) are also multiplicative - i.e. one can have multiple animations that are all applied simultaneously from a window, down through controlgroups to individual controls. I'm not sure how well this would apply.

Certainly something interesting to look into though.

Cheers,
Jonathan

This did occur to me while i was posting that last comment, but I'm not sure how best to approach it. I started to write down some ideas here but realized they had some holes in the logic and i really don't know enough about coding to offer many worthwhile suggestions.

One idea though, in regards to the multiplicity, would it be possible to have some sort of ladder of priority with colordiffuse animations, so that whichever is "deeper" would dictate the animation to use? For example, if i had a control group that said to do a colordiffuse animation fade to green and then an image within that control group that said to fade to red, everything inside that control group would fade to green except that one image which would ignore the green fade, and instead fade to red. I can't imagine it being very desirable for colordiffuse it to function any other way, to be honest.

And thanks for the suggestions nuka, though I have my suspicions that it might not work quite how i want it in my particular case. I'll give it a shot though and report back.

EDIT: I tried your idea nuka, but it doesn't return to the original color after it loses focus, and the texture strangely isn't visible at all until it has a value for the colordiffuse (ie, until the button has gained focus). What I'm doing here is I have plain white textures that I'm giving different default colors using colordiffuse, but I want them to return to white when they gain focus, and of course return to the color after they lose focus. so, this doesn't seem to quite work unfortunately.
Reply
#9
The main problem with multiplicative stuff is whether or not colordiffuse should even be a member of the group class at all.

If not, then multiplicative stuff can be ignored entirely (effectively when you apply a multiplication it will just ignore what was there originally). If so, then whatever multiplicative relationship we use will have to be well defined. Usually it's point-wise, so a full red times a full green is black (nothing shared between them).

The actual animation stuff would have to be done based on some decent colorspace computation. Treating them as cartesian coordinates wouldn't work too flash. I'm sure there's been some research as to what colorspace one should use for doing blending.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#10
<onunfocus>
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#11
Well this is just my opinion, but I dont see the point in multiplicative functionality at all with colordiffuse. Why would a skinner want to mess with calculating what they would need to multiply green by to reach color x, when it would be much easier just to give it a unique independent colordiffuse that goes directly to the color specified? I imagine there's somebody out there that could find a use for it, but for the most part i think it would just make things more complicated for a majority of skinners.

Here's something that might be useful: http://www.codeproject.com/KB/GDI-plus/K...ocess.aspx

I'm not sure if that's helpful in the least, but it appears at least somewhat relevant. I think it also covers some different types of blending like multiply and color dodge, etc (which actually would be pretty amazing to have available in xbmc but that's not something i'm requesting atm)

Also, i'm not sure if alpha blending is relevant to this situation or not, but if so this may be relevant...http://www.gamedev.net/reference/article...le1594.asp

I'll leave it at that as I hardly know what I'm reading and am probably just slowing you guys down:p
Reply
#12
Nuka1195 Wrote:<onunfocus>

I assumed that only worked on an unfocus event, not whenever something didn't have focus. I'll give it a try..
Reply
#13
Yeah, I just tried it after adding onunfocus which makes it return to the original color after losing focus, which i assumed would happen, but it still doesn't fix the problem with no texture showing up at all until it gains focus for the first time because it has an empty colordiffuse tag
Reply
#14
I guess we could offer some different methods and play around with them.

Traversing through RGB space generally means you get a darkening in the middle of the animation, whereas traversing through HSL or HSV gives a constant lightness, but differing hues (eg a spectrum traversal). You've also got a choice of which way through the hues you go - clockwise or anticlockwise.

Certainly something fun to have a play with.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
Conditional colordiffuse1