Page MenuHome

Color picker (Python) brightness slider doesnt work...
Closed, ArchivedPublic

Description

--- Operating System, Graphics card ---
Windows 7 Ultimate 64bit
Intel HD4000

--- Blender version with error, and version that worked ---
version 2.68 bug

--- Short description of error ---
The color picker brightness slider always selects black

--- Steps for others to reproduce the error (preferably based on attached .blend file) ---

Start the attached addon, in the panel_func function it draws a color picker that works on a FloatVectorProperty with subtype "COLOR".

When trying to use the brightness slider in the color picker, it flips out and goes black...

Event Timeline

I'm getting an immediate crash when clicking the "Start PreSel" button, i think this is caused by returning PASS_THROUGH instead of RUNNING_MODAL/CANCELLED from your operators.

I only return PASS_THROUGH from within my modal handler function, that shouldnt cause a crash, should it?

I added a second version of the addon as attachment...

I am using this addon together with many correspondents on the forum, so it should not crash...

Someone in the forum had an immediate crash too, it was due to his copy of Blender having an unknown revision number.
Im adding the file that fixed his as attachment mesh_presel3.py

Ok thanks, this works now.

All you need to do is give the color properties a max value, like this: http://www.pasteall.org/44780/python

The FloatVectorProperty by default uses the FLT_MAX value, which is huge. In theory the subtype should automatically determine a sensible default range of 0-1 for colors, but since the generic python function FloatVectorProperty *always* has a default value it cannot detect whether this was passed by the user or not ...

Attached a preliminary patch that uses NaN values to identify unspecified parameters and replace them with defaults based on the property subtype. After discussion with Campbell decided to postpone this.

Lukas Tönne (lukastoenne) changed the task status from Unknown Status to Archived.Aug 13 2013, 12:07 PM

Thanks, this was quite confusing.

You preliminary patch could be a good thing, I reckon something must be done about this issue.

Just found out one needs to set a min value too!