Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-04 13:43:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-04 13:43:27 +0400
commitc872ffd94f1b94f8da725080e53d2e5400cb3a04 (patch)
treeb6665b928faa75dc055f80d7b0cb336e1aec1680
parent753b627cb6fb92ec1b168c6ea6270eb5115911b7 (diff)
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().
-rw-r--r--source/blender/blenkernel/intern/texture.c18
-rw-r--r--source/blender/editors/interface/interface_widgets.c24
2 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index bdd9b424f3b..9dd83181521 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1073,19 +1073,21 @@ void set_current_material_texture(Material *ma, Tex *newtex)
{
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;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 6f819bd0491..aa74ee8e49a 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1903,27 +1903,25 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec
*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 */