Conditional colordiffuse

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
timdog82001 Offline
Posting Freak
Posts: 1,132
Joined: Mar 2006
Reputation: 0
Post: #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>
find quote
timdog82001 Offline
Posting Freak
Posts: 1,132
Joined: Mar 2006
Reputation: 0
Post: #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.
(This post was last modified: 2008-12-18 04:03 by timdog82001.)
find quote
Nuka1195 Online
Skilled Python Coder
Posts: 3,917
Joined: Dec 2004
Reputation: 17
Post: #3
this would be useful.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Jezz_X Offline
Team-XBMC Skinner
Posts: 5,264
Joined: Jun 2006
Reputation: 55
Location: Earth
Post: #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

Skins I have done....
[Image: skinsq.png]
And others in the past...

Want to know what I'm working on currently? Check me out on Google+
find quote
timdog82001 Offline
Posting Freak
Posts: 1,132
Joined: Mar 2006
Reputation: 0
Post: #5
good idea
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #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: badge.gif]
find quote
Nuka1195 Online
Skilled Python Coder
Posts: 3,917
Joined: Dec 2004
Reputation: 17
Post: #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/
find quote
timdog82001 Offline
Posting Freak
Posts: 1,132
Joined: Mar 2006
Reputation: 0
Post: #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.
(This post was last modified: 2009-01-22 01:49 by timdog82001.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #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: badge.gif]
find quote
Nuka1195 Online
Skilled Python Coder
Posts: 3,917
Joined: Dec 2004
Reputation: 17
Post: #10
<onunfocus>

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Post Reply