[Bf-blender-cvs] [8e05a5bf8c] blender2.8: fix build: BLF Theme color

Mike Erwin noreply at git.blender.org
Thu Feb 2 01:01:45 CET 2017


Commit: 8e05a5bf8c37174d1019b9dc7efd7a53831f292a
Author: Mike Erwin
Date:   Wed Feb 1 19:00:30 2017 -0500
Branches: blender2.8
https://developer.blender.org/rB8e05a5bf8c37174d1019b9dc7efd7a53831f292a

fix build: BLF Theme color

blenderplayer uses BLF but not Editor UI, so we got a link error for the missing UI_GetThemeColor function.

Moved the new function from BLF to UI.

@Blendify reported problem in IRC

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

M	source/blender/blenfont/BLF_api.h
M	source/blender/blenfont/intern/blf.c
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c

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

diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 856234dad4..b6fc42d774 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -65,7 +65,6 @@ void BLF_position(int fontid, float x, float y, float z);
 void BLF_size(int fontid, int size, int dpi);
 
 /* goal: small but useful color API */
-void BLF_ThemeColor(int fontid, int colorid);
 void BLF_color4ubv(int fontid, const unsigned char rgba[4]);
 void BLF_color3ubv(int fontid, const unsigned char rgb[3]);
 void BLF_color3ubv_alpha(int fontid, const unsigned char rgb[3], unsigned char alpha);
@@ -73,6 +72,7 @@ void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b)
 void BLF_color4fv(int fontid, const float rgba[4]);
 void BLF_color3f(int fontid, float r, float g, float b);
 void BLF_color3fv_alpha(int fontid, const float rgb[3], float alpha);
+/* also available: UI_FontThemeColor(fontid, colorid) */
 
 /* Set a 4x4 matrix to be multiplied before draw the text.
  * Remember that you need call BLF_enable(BLF_MATRIX)
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 01feb652f3..4b3a965efd 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -52,8 +52,6 @@
 
 #include "BLF_api.h"
 
-#include "UI_resources.h"
-
 #include "IMB_colormanagement.h"
 
 #ifndef BLF_STANDALONE
@@ -467,15 +465,6 @@ void BLF_blur(int fontid, int size)
 }
 #endif
 
-void BLF_ThemeColor(int fontid, int colorid)
-{
-	FontBLF *font = blf_get(fontid);
-
-	if (font) {
-		UI_GetThemeColor4ubv(colorid, font->color);
-	}
-}
-
 void BLF_color4ubv(int fontid, const unsigned char rgba[4])
 {
 	FontBLF *font = blf_get(fontid);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index dbd3d7d993..5924529ddc 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -379,6 +379,10 @@ void    UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3]
 // get a 3 byte color, blended and shaded between two other char color pointers
 void    UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset);
 
+// sets the font color
+// (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color)
+void UI_FontThemeColor(int fontid, int colorid);
+
 // clear the openGL ClearColor using the input colorid
 void    UI_ThemeClearColor(int colorid);
 
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 38df7620ed..76b8f348c9 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -53,6 +53,8 @@
 
 #include "BIF_gl.h"
 
+#include "BLF_api.h"
+
 #include "UI_interface.h"
 #include "UI_interface_icons.h"
 
@@ -1393,6 +1395,12 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off
 	glColor4ub(r, g, b, a);
 }
 
+void UI_FontThemeColor(int fontid, int colorid)
+{
+	unsigned char color[4];
+	UI_GetThemeColor4ubv(colorid, color);
+	BLF_color4ubv(fontid, color);
+}
 
 /* get individual values, not scaled */
 float UI_GetThemeValuef(int colorid)




More information about the Bf-blender-cvs mailing list