[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51032] trunk/blender/source/blender: code cleanup: make the behavior of set_current_material_texture() clearer and remove redundant NULL check there.
Campbell Barton
ideasman42 at gmail.com
Thu Oct 4 11:43:27 CEST 2012
Revision: 51032
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51032
Author: campbellbarton
Date: 2012-10-04 09:43:27 +0000 (Thu, 04 Oct 2012)
Log Message:
-----------
code cleanup: make the behavior of set_current_material_texture() clearer and remove redundant NULL check there. also small changes to ui_draw_but_HSVCIRCLE().
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/texture.c
trunk/blender/source/blender/editors/interface/interface_widgets.c
Modified: trunk/blender/source/blender/blenkernel/intern/texture.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/texture.c 2012-10-04 09:33:14 UTC (rev 51031)
+++ trunk/blender/source/blender/blenkernel/intern/texture.c 2012-10-04 09:43:27 UTC (rev 51032)
@@ -1073,19 +1073,21 @@
{
Tex *tex = NULL;
bNode *node;
-
- if (ma && ma->use_nodes && ma->nodetree) {
- node = nodeGetActiveID(ma->nodetree, ID_TE);
- if (node) {
- tex = (Tex *)node->id;
- id_us_min(&tex->id);
+ if ((ma->use_nodes && ma->nodetree) &&
+ (node = nodeGetActiveID(ma->nodetree, ID_TE)))
+ {
+ tex = (Tex *)node->id;
+ id_us_min(&tex->id);
+ if (newtex) {
node->id = &newtex->id;
id_us_plus(&newtex->id);
- ma = NULL;
}
+ else {
+ node->id = NULL;
+ }
}
- if (ma) {
+ else {
int act = (int)ma->texact;
tex = (ma->mtex[act]) ? ma->mtex[act]->tex : NULL;
Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c 2012-10-04 09:33:14 UTC (rev 51031)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c 2012-10-04 09:43:27 UTC (rev 51032)
@@ -1903,27 +1903,25 @@
*val_rad = atan2f(m_delta[0], m_delta[1]) / (2.0f * (float)M_PI) + 0.5f;
}
-static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
+static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
{
+ const int tot = 32;
+ const float radstep = 2.0f * (float)M_PI / (float)tot;
+
+ const float centx = BLI_rcti_cent_x_fl(rect);
+ const float centy = BLI_rcti_cent_y_fl(rect);
+ float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
+
/* gouraud triangle fan */
- float radstep, ang = 0.0f;
- float centx, centy, radius, cursor_radius;
+ float ang = 0.0f;
+ float cursor_radius;
float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
- int a, tot = 32;
+ int a;
int color_profile = but->block->color_profile;
if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = FALSE;
- radstep = 2.0f * (float)M_PI / (float)tot;
- centx = BLI_rcti_cent_x_fl(rect);
- centy = BLI_rcti_cent_y_fl(rect);
-
- if (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect))
- radius = (float)BLI_rcti_size_y(rect) / 2;
- else
- radius = (float)BLI_rcti_size_x(rect) / 2;
-
/* color */
ui_get_but_vectorf(but, rgb);
/* copy_v3_v3(hsv, ui_block_hsv_get(but->block)); */ /* UNUSED */
More information about the Bf-blender-cvs
mailing list