Add theme option for cliping border

This commit is contained in:
Antonis Ryakiotakis 2015-01-28 13:03:42 +01:00
parent 1678cb9af2
commit 7a6d757a3b
7 changed files with 36 additions and 15 deletions

View File

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 273
#define BLENDER_SUBVERSION 4
#define BLENDER_SUBVERSION 5
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 5

View File

@ -310,7 +310,6 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D
bool draw_background, int alpha_mode, char err_out[256]);
struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype,
bool use_solid_tex, bool use_gpencil, bool draw_background, int alpha_mode, char err_out[256]);
void ED_view3d_offscreen_sky_color_get(struct Scene *scene, float sky_color[3]);
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);

View File

@ -293,6 +293,8 @@ enum {
TH_INFO_DEBUG,
TH_INFO_DEBUG_TEXT,
TH_VIEW_OVERLAY,
TH_V3D_CLIPPING_BORDER
};
/* XXX WARNING: previous is saved in file, so do not change order! */

View File

@ -682,6 +682,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_INFO_DEBUG_TEXT:
cp = ts->info_debug_text;
break;
case TH_V3D_CLIPPING_BORDER:
cp = ts->clipping_border_3d;
break;
}
}
}
@ -951,6 +954,7 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tv3d.gradients.high_gradient, 58, 58, 58, 255);
btheme->tv3d.gradients.show_grad = false;
rgba_char_args_set(btheme->tv3d.clipping_border_3d, 50, 50, 50, 255);
/* space buttons */
/* to have something initialized */
btheme->tbuts = btheme->tv3d;
@ -2572,6 +2576,25 @@ void init_userdef_do_versions(void)
}
}
if (U.versionfile < 273 || (U.versionfile == 273 && U.subversionfile < 5)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
unsigned char *cp = (unsigned char *)btheme->tv3d.clipping_border_3d;
int c;
copy_v4_v4_char((char *)cp, btheme->tv3d.back);
c = cp[0] - 8;
CLAMP(c, 0, 255);
cp[0] = c;
c = cp[1] - 8;
CLAMP(c, 0, 255);
cp[1] = c;
c = cp[2] - 8;
CLAMP(c, 0, 255);
cp[2] = c;
cp[3] = 255;
}
}
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;

View File

@ -162,15 +162,15 @@ static void view3d_draw_clipping(RegionView3D *rv3d)
/* fill in zero alpha for rendering & re-projection [#31530] */
unsigned char col[4];
UI_GetThemeColorShade3ubv(TH_BACK, -8, col);
col[3] = 0;
UI_GetThemeColor4ubv(TH_V3D_CLIPPING_BORDER, col);
glColor4ubv(col);
glEnable(GL_BLEND);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, bb->vec);
glDrawElements(GL_QUADS, sizeof(clipping_index) / sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index);
glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_BLEND);
}
}
@ -3089,15 +3089,6 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
G.f &= ~G_RENDER_OGL;
}
/* get a color used for offscreen sky, returns color in sRGB space */
void ED_view3d_offscreen_sky_color_get(Scene *scene, float sky_color[3])
{
if (scene->world)
linearrgb_to_srgb_v3_v3(sky_color, &scene->world->horr);
else
UI_GetThemeColor3fv(TH_BACK, sky_color);
}
/* utility func for ED_view3d_draw_offscreen */
ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag,
bool draw_background, int alpha_mode, char err_out[256])

View File

@ -288,9 +288,10 @@ typedef struct ThemeSpace {
char handle_vertex[4];
char handle_vertex_select[4];
char pad2[4];
char handle_vertex_size;
char clipping_border_3d[4];
char marker_outline[4], marker[4], act_marker[4], sel_marker[4], dis_marker[4], lock_marker[4];
char bundle_solid[4];

View File

@ -1682,6 +1682,11 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Skin Root", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "clipping_border_3d", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Clipping Border", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
rna_def_userdef_theme_spaces_paint_curves(srna);
}