Cleanup: style

This commit is contained in:
Campbell Barton 2019-02-28 12:15:42 +11:00
parent c51516c3fb
commit 3d4d7b97c2
7 changed files with 73 additions and 57 deletions

View File

@ -10960,7 +10960,7 @@ static ID *link_named_part(
if (id == NULL) {
/* not read yet */
const int tag = force_indirect ? LIB_TAG_INDIRECT : LIB_TAG_EXTERN;
read_libblock(fd, mainl, bhead, tag | LIB_TAG_NEED_EXPAND , &id);
read_libblock(fd, mainl, bhead, tag | LIB_TAG_NEED_EXPAND, &id);
if (id) {
/* sort by name in list */

View File

@ -58,7 +58,8 @@ DepsgraphBuilder::DepsgraphBuilder(Main *bmain, Depsgraph *graph)
graph_(graph) {
}
bool DepsgraphBuilder::needPullBaseIntoGraph(struct Base *base) {
bool DepsgraphBuilder::needPullBaseIntoGraph(struct Base *base)
{
const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
if (base->flag & base_flag) {

View File

@ -251,8 +251,8 @@ static void set_wireframe_color(Object *ob, bGPDlayer *gpl, View3D *v3d,
{
float color[4];
if (((gp_style->stroke_rgba[3] < GPENCIL_ALPHA_OPACITY_THRESH) ||
(((gp_style->flag & GP_STYLE_STROKE_SHOW) == 0))) &&
(gp_style->fill_rgba[3] >= GPENCIL_ALPHA_OPACITY_THRESH))
(((gp_style->flag & GP_STYLE_STROKE_SHOW) == 0))) &&
(gp_style->fill_rgba[3] >= GPENCIL_ALPHA_OPACITY_THRESH))
{
copy_v4_v4(color, gp_style->fill_rgba);
}
@ -437,7 +437,7 @@ bool DRW_gpencil_onion_active(bGPdata *gpd)
DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps,
MaterialGPencilStyle *gp_style, int id,
MaterialGPencilStyle *gp_style, int id,
bool onion, const float scale, int shading_type)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
@ -547,8 +547,8 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
bGPdata *gpd, bGPDlayer *gpl,
MaterialGPencilStyle *gp_style, int id, bool onion,
const float scale, int shading_type)
MaterialGPencilStyle *gp_style, int id, bool onion,
const float scale, int shading_type)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const float *viewport_size = DRW_viewport_size_get();
@ -886,7 +886,7 @@ static void gpencil_draw_strokes(
/* if the fill has any value, it's considered a fill and is not drawn if simplify fill is enabled */
if ((stl->storage->simplify_fill) &&
(scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_REMOVE_FILL_LINE))
(scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_REMOVE_FILL_LINE))
{
if ((gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) ||
(gp_style->fill_style > GP_STYLE_FILL_STYLE_SOLID) ||
@ -917,8 +917,8 @@ static void gpencil_draw_strokes(
{
/* fill */
if ((gp_style->flag & GP_STYLE_FILL_SHOW) &&
(!stl->storage->simplify_fill) &&
((gps->flag & GP_STROKE_NOFILL) == 0))
(!stl->storage->simplify_fill) &&
((gps->flag & GP_STROKE_NOFILL) == 0))
{
gpencil_add_fill_vertexdata(
cache, ob, gpl, derived_gpf, gps,
@ -1481,7 +1481,7 @@ static void DRW_gpencil_shgroups_create(
shgrp = DRW_gpencil_shgroup_stroke_create(
e_data, vedata, stroke_pass, e_data->gpencil_stroke_sh,
ob, gpd, gpl, gps, gp_style, stl->storage->shgroup_id, elm->onion,
scale, cache_ob->shading_type);
scale, cache_ob->shading_type);
DRW_shgroup_call_range_add(
shgrp, cache->b_stroke.batch,
@ -1499,7 +1499,7 @@ static void DRW_gpencil_shgroups_create(
shgrp = DRW_gpencil_shgroup_point_create(
e_data, vedata, stroke_pass, e_data->gpencil_point_sh,
ob, gpd, gpl, gp_style, stl->storage->shgroup_id, elm->onion,
scale, cache_ob->shading_type);
scale, cache_ob->shading_type);
DRW_shgroup_call_range_add(
shgrp, cache->b_point.batch,
@ -1517,7 +1517,7 @@ static void DRW_gpencil_shgroups_create(
shgrp = DRW_gpencil_shgroup_fill_create(
e_data, vedata, stroke_pass, e_data->gpencil_fill_sh,
ob, gpd, gpl, gp_style, stl->storage->shgroup_id,
cache_ob->shading_type);
cache_ob->shading_type);
DRW_shgroup_call_range_add(
shgrp, cache->b_fill.batch,

View File

@ -94,7 +94,7 @@ typedef struct tGPencilObjectCache {
/* shading type */
int shading_type;
/* GPU data size */
int tot_vertex;
int tot_triangles;
@ -376,9 +376,9 @@ typedef struct GpencilBatchCache {
struct DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
struct GPENCIL_e_data *e_data, struct GPENCIL_Data *vedata, struct DRWPass *pass, struct GPUShader *shader,
struct Object *ob, struct bGPdata *gpd,
struct bGPDlayer *gpl, struct bGPDstroke *gps,
struct bGPDlayer *gpl, struct bGPDstroke *gps,
struct MaterialGPencilStyle *gp_style, int id, bool onion,
const float scale, int shading_type);
const float scale, int shading_type);
void DRW_gpencil_populate_datablock(
struct GPENCIL_e_data *e_data, void *vedata,
struct Object *ob, struct tGPencilObjectCache *cache_ob);

View File

@ -127,7 +127,8 @@ static void drw_shgroup_bone_octahedral(
g_data.passes.bone_outline, geom, sh_cfg);
}
if (g_data.bone_octahedral_solid == NULL &&
g_data.passes.bone_solid != NULL) {
g_data.passes.bone_solid != NULL)
{
struct GPUBatch *geom = DRW_cache_bone_octahedral_get();
g_data.bone_octahedral_solid = shgroup_instance_bone_shape_solid(
g_data.passes.bone_solid, geom, g_data.transparent, sh_cfg);

View File

@ -1244,7 +1244,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* post process stroke */
if ((p->brush->gpencil_settings->flag & GP_BRUSH_GROUP_SETTINGS) &&
p->brush->gpencil_settings->flag & GP_BRUSH_TRIM_STROKE) {
p->brush->gpencil_settings->flag & GP_BRUSH_TRIM_STROKE)
{
BKE_gpencil_trim_stroke(gps);
}

View File

@ -388,7 +388,9 @@ static float draw_seq_handle_size_get_clamped(Sequence *seq, const float pixelx)
}
/* draw a handle, for each end of a sequence strip */
static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_clamped, const short direction, unsigned int pos)
static void draw_seq_handle(
View2D *v2d, Sequence *seq, const float handsize_clamped,
const short direction, unsigned int pos)
{
float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect
float x1, x2, y1, y2;
@ -478,7 +480,10 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
}
/* draw info text on a sequence strip */
static void draw_seq_text(View2D *v2d, SpaceSeq *sseq, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3])
static void draw_seq_text(
View2D *v2d, SpaceSeq *sseq, Sequence *seq,
float x1, float x2, float y1, float y2,
const unsigned char background_col[3])
{
rctf rect;
char str[32 + FILE_MAX];
@ -697,7 +702,9 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
* ARegion is currently only used to get the windows width in pixels
* so wave file sample drawing precision is zoom adjusted
*/
static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx)
static void draw_seq_strip(
const bContext *C, SpaceSeq *sseq, Scene *scene, ARegion *ar, Sequence *seq,
int outline_tint, float pixelx)
{
View2D *v2d = &ar->v2d;
float x1, x2, y1, y2;
@ -1173,7 +1180,9 @@ static void sequencer_preview_clear(void)
GPU_clear(GPU_COLOR_BIT);
}
static void sequencer_preview_get_rect(rctf *preview, Scene *scene, ARegion *ar, SpaceSeq *sseq, bool draw_overlay, bool draw_backdrop)
static void sequencer_preview_get_rect(
rctf *preview, Scene *scene, ARegion *ar, SpaceSeq *sseq,
bool draw_overlay, bool draw_backdrop)
{
struct View2D *v2d = &ar->v2d;
float viewrect[2];
@ -1205,7 +1214,9 @@ static void sequencer_preview_get_rect(rctf *preview, Scene *scene, ARegion *ar,
}
}
static void sequencer_draw_display_buffer(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, ImBuf *ibuf, ImBuf *scope, bool draw_overlay, bool draw_backdrop)
static void sequencer_draw_display_buffer(
const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, ImBuf *ibuf, ImBuf *scope,
bool draw_overlay, bool draw_backdrop)
{
void *display_buffer;
@ -1321,41 +1332,41 @@ static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, boo
switch (sseq->mainb) {
case SEQ_DRAW_IMG_IMBUF:
if (!scopes->zebra_ibuf) {
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
case SEQ_DRAW_IMG_IMBUF:
if (!scopes->zebra_ibuf) {
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
if (display_ibuf->rect_float) {
IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
&scene->display_settings);
if (display_ibuf->rect_float) {
IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
&scene->display_settings);
}
scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
IMB_freeImBuf(display_ibuf);
}
scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
IMB_freeImBuf(display_ibuf);
}
scope = scopes->zebra_ibuf;
break;
case SEQ_DRAW_IMG_WAVEFORM:
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
if (!scopes->sep_waveform_ibuf)
scopes->sep_waveform_ibuf = sequencer_make_scope(scene, ibuf, make_sep_waveform_view_from_ibuf);
scope = scopes->sep_waveform_ibuf;
}
else {
if (!scopes->waveform_ibuf)
scopes->waveform_ibuf = sequencer_make_scope(scene, ibuf, make_waveform_view_from_ibuf);
scope = scopes->waveform_ibuf;
}
break;
case SEQ_DRAW_IMG_VECTORSCOPE:
if (!scopes->vector_ibuf)
scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
scope = scopes->vector_ibuf;
break;
case SEQ_DRAW_IMG_HISTOGRAM:
if (!scopes->histogram_ibuf)
scopes->histogram_ibuf = sequencer_make_scope(scene, ibuf, make_histogram_view_from_ibuf);
scope = scopes->histogram_ibuf;
break;
scope = scopes->zebra_ibuf;
break;
case SEQ_DRAW_IMG_WAVEFORM:
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
if (!scopes->sep_waveform_ibuf)
scopes->sep_waveform_ibuf = sequencer_make_scope(scene, ibuf, make_sep_waveform_view_from_ibuf);
scope = scopes->sep_waveform_ibuf;
}
else {
if (!scopes->waveform_ibuf)
scopes->waveform_ibuf = sequencer_make_scope(scene, ibuf, make_waveform_view_from_ibuf);
scope = scopes->waveform_ibuf;
}
break;
case SEQ_DRAW_IMG_VECTORSCOPE:
if (!scopes->vector_ibuf)
scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
scope = scopes->vector_ibuf;
break;
case SEQ_DRAW_IMG_HISTOGRAM:
if (!scopes->histogram_ibuf)
scopes->histogram_ibuf = sequencer_make_scope(scene, ibuf, make_histogram_view_from_ibuf);
scope = scopes->histogram_ibuf;
break;
}
/* future files may have new scopes we don't catch above */
@ -1367,7 +1378,9 @@ static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, boo
}
void sequencer_draw_preview(
const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, bool draw_overlay, bool draw_backdrop)
const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq,
int cfra, int frame_ofs,
bool draw_overlay, bool draw_backdrop)
{
struct Main *bmain = CTX_data_main(C);
struct Depsgraph *depsgraph = CTX_data_depsgraph(C);