[Bf-committers] Interface Change for "new feature"

Ton Roosendaal bf-committers@blender.org
Sat, 24 May 2003 13:57:24 +0200


Hi,

Back in '95 I already thought that using 'byte' values for color was  
getting outdated... so Maya, Max and Photoshop still use that  
convention? How oldfashioned!

But I think the suggestion you do below is too hackish... it delivers  
unexpected and inconsistant behaviour.

Quite more friendly would be make it a user-preset, and write a new  
uiButton() type that displays and handles floats (range 0.0-1.0) as  
ints (range 0-255).

-Ton-

(don't maya or max offer it as a user preset? shesis...)



On Friday, May 23, 2003, at 19:46 Europe/Amsterdam, Douglas Bischoff  
wrote:

> Hello:
>
> Okay, putting my money where my mouth is, and hoping that this works  
> out well.
>
> I posted a feature request to allow entry of numbers 0-255 for color  
> values and have them translate automatically to Blender's decimal  
> system. Several packages (Maya, Max, Photoshop, etc.) operate on 0-255  
> values rather than decimals for color entry. Trying to do a tutorial  
> or color matching from one of these packages on Blender then involves  
> a calculator & pencil.
>
> I've modified interface.c to include a VERY simple modification to  
> static int uiActAsTextBut(uiBut *but) that looks like this:
>
> was:
> ----
> 	if(value>max) value= max;
> ----
>
> patch:
> ----
> 	if(value>max) {
> 		if(max>1) value= max;
> 		else {
> 		value=value/255;
> 		if(value>max) value= max;
> 		}
> 	}
> ----
>
> What this does is check to see if the value entered is greater than  
> the maximum allowed value for the button. If so, it checks to see if  
> that maximum value was already greater than one. If it is, simply set  
> the value to the maximum allowed value (just like the original  
> function). This works for things like "hardness."
>
> Then, if the number was supposed to be <= 1, it will attempt to divide  
> the entered value by 255 to give a decimal. If that number is STILL  
> greater than the maximum allowed, insert the maximum allowed (which  
> will be 1 perforce).
>
> There may be a more elegant way to code this (I'm a relative  
> beginner), I don't have commit rights, some folks might think this is  
> not a good idea overall, and Ton may have a heart attack that I'm  
> messing around in interface.c to start with. :-)
>
> Another possibility is to define a new type: instead of NUMSLI perhaps  
> 255SLI which permits this sort of thing. Then any location where this  
> behavior is desired it can be coded in buttons.c properly and that  
> behavior will only apply to those sliders where it is designated.
>
> I can code that if desired.
>
> Anyway, thanks for reading!
>
> -Bischofftep the Neophyte
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton@blender.org