[Bf-blender-cvs] [fd795368456] greasepencil-object: GPencil: Invert Sort for Palette Value

Antonio Vazquez noreply at git.blender.org
Mon Nov 18 16:26:23 CET 2019


Commit: fd79536845693cd72f0f2942510a3215c1936ce2
Author: Antonio Vazquez
Date:   Mon Nov 18 16:22:58 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBfd79536845693cd72f0f2942510a3215c1936ce2

GPencil: Invert Sort for Palette Value

===================================================================

M	source/blender/blenkernel/intern/paint.c

===================================================================

diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 135dd2f61d4..0a15a1897ed 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -651,8 +651,8 @@ bool BKE_palette_is_empty(const struct Palette *palette)
 static int palettecolor_compare_hsv(const void *a1, const void *a2)
 {
   const tPaletteColorHSV *ps1 = a1, *ps2 = a2;
-  double a = (ps1->h * 1e11) + (ps1->s * 1e7) + (ps1->v * 1e3);
-  double b = (ps2->h * 1e11) + (ps2->s * 1e7) + (ps2->v * 1e3);
+  double a = (ps1->h * 1e11) + (ps1->s * 1e7) + ((1.0f - ps1->v) * 1e3);
+  double b = (ps2->h * 1e11) + (ps2->s * 1e7) + ((1.0f - ps2->v) * 1e3);
 
   if (a < b) {
     return -1;



More information about the Bf-blender-cvs mailing list