Commit: 9895675b9bccd3821a2bdb505b89796717cd47d5 Author: Pablo Dobarro Date: Tue Jul 9 15:20:29 2019 +0200 Branches: sculpt-mode-features https://developer.blender.org/rB9895675b9bccd3821a2bdb505b89796717cd47d5
Fix formatting =================================================================== M source/blender/editors/object/object_blueprint.c M source/blender/editors/object/object_edit.c =================================================================== diff --git a/source/blender/editors/object/object_blueprint.c b/source/blender/editors/object/object_blueprint.c index 874ea86d085..1ffca8fbcb6 100644 --- a/source/blender/editors/object/object_blueprint.c +++ b/source/blender/editors/object/object_blueprint.c @@ -131,7 +131,6 @@ EnumPropertyItem prop_blueprint_draw_tool_types[] = { {0, NULL, 0, NULL, NULL}, }; - typedef struct BlueprintPolyPoint { struct BlueprintPolyPoint *next, *prev; @@ -160,8 +159,6 @@ typedef struct BlueprintCache { /* geometry creation context */ Object *ob; - - float plane_offset; int grid_snap; @@ -254,34 +251,34 @@ void blueprint_draw_poly_volume(uint pos3d, BlueprintCache *cache, float z) int point_count = cache->point_count; GPU_depth_test(true); immUniformColor4ubv(cache->color.geom_fill); - float z_base = 0.0f; - if (cache->flags & BLUEPRINT_SYMMETRICAL_EXTRUDE) { - z_base = -cache->extrudedist; - } + float z_base = 0.0f; + if (cache->flags & BLUEPRINT_SYMMETRICAL_EXTRUDE) { + z_base = -cache->extrudedist; + } - bool draw_fill = cache->flags & BLUEPRINT_ENABLE_GEOMETRY_FILL; + bool draw_fill = cache->flags & BLUEPRINT_ENABLE_GEOMETRY_FILL; if (point_count >= 3) { if (draw_fill) { - immBegin(GPU_PRIM_TRIS, point_count * 6); - LISTBASE_FOREACH (BlueprintPolyPoint *, p, &cache->poly) { - BlueprintPolyPoint *np; - if (p->next) { - np = p->next; - } - else { - np = cache->poly.first; - } + immBegin(GPU_PRIM_TRIS, point_count * 6); + LISTBASE_FOREACH (BlueprintPolyPoint *, p, &cache->poly) { + BlueprintPolyPoint *np; + if (p->next) { + np = p->next; + } + else { + np = cache->poly.first; + } - immVertex3f(pos3d, p->co[0], p->co[1], z_base); - immVertex3f(pos3d, p->co[0], p->co[1], z); - immVertex3f(pos3d, np->co[0], np->co[1], z); + immVertex3f(pos3d, p->co[0], p->co[1], z_base); + immVertex3f(pos3d, p->co[0], p->co[1], z); + immVertex3f(pos3d, np->co[0], np->co[1], z); - immVertex3f(pos3d, np->co[0], np->co[1], z_base); - immVertex3f(pos3d, p->co[0], p->co[1], z_base); - immVertex3f(pos3d, np->co[0], np->co[1], z); - } + immVertex3f(pos3d, np->co[0], np->co[1], z_base); + immVertex3f(pos3d, p->co[0], p->co[1], z_base); + immVertex3f(pos3d, np->co[0], np->co[1], z); + } - immEnd(); + immEnd(); } immUniformColor4ubv(cache->color.geom_stroke); @@ -372,51 +369,51 @@ void blueprint_draw_grid(uint pos3d, BlueprintCache *cache) /* backgroud */ if (cache->flags & BLUEPRINT_ENABLE_GRID_BACKGROUD) { - if (cache->state != BLUEPRINT_STATE_PLANE) { - immUniformColor4ubv(cache->color.bg); - immBegin(GPU_PRIM_TRIS, 6); - immVertex3f(pos3d, cache->grid_extends_min[0], cache->grid_extends_min[1], 0.0f); - immVertex3f(pos3d, cache->grid_extends_min[0], cache->grid_extends_max[1], 0.0f); - immVertex3f(pos3d, cache->grid_extends_max[0], cache->grid_extends_max[1], 0.0f); - - immVertex3f(pos3d, cache->grid_extends_min[0], cache->grid_extends_min[1], 0.0f); - immVertex3f(pos3d, cache->grid_extends_max[0], cache->grid_extends_min[1], 0.0f); - immVertex3f(pos3d, cache->grid_extends_max[0], cache->grid_extends_max[1], 0.0f); - immEnd(); - } + if (cache->state != BLUEPRINT_STATE_PLANE) { + immUniformColor4ubv(cache->color.bg); + immBegin(GPU_PRIM_TRIS, 6); + immVertex3f(pos3d, cache->grid_extends_min[0], cache->grid_extends_min[1], 0.0f); + immVertex3f(pos3d, cache->grid_extends_min[0], cache->grid_extends_max[1], 0.0f); + immVertex3f(pos3d, cache->grid_extends_max[0], cache->grid_extends_max[1], 0.0f); + + immVertex3f(pos3d, cache->grid_extends_min[0], cache->grid_extends_min[1], 0.0f); + immVertex3f(pos3d, cache->grid_extends_max[0], cache->grid_extends_min[1], 0.0f); + immVertex3f(pos3d, cache->grid_extends_max[0], cache->grid_extends_max[1], 0.0f); + immEnd(); + } } /* GRID */ if (cache->flags & BLUEPRINT_ENABLE_GRID) { - GPU_line_width(0.5f); - immUniformColor4ubv(cache->color.grid); - int x_it = (cache->grid_extends_max[0] - cache->grid_extends_min[0]) / cache->gridx_size; - immBegin(GPU_PRIM_LINES, 2 * x_it + 2); - for (int i = 0; i < x_it + 1; i++) { - immVertex3f(pos3d, - i * cache->gridx_size + cache->grid_extends_min[0], - cache->grid_extends_min[1], - 0.0f); - immVertex3f(pos3d, - i * cache->gridx_size + cache->grid_extends_min[0], - cache->grid_extends_max[1], - 0.0f); - } - immEnd(); + GPU_line_width(0.5f); + immUniformColor4ubv(cache->color.grid); + int x_it = (cache->grid_extends_max[0] - cache->grid_extends_min[0]) / cache->gridx_size; + immBegin(GPU_PRIM_LINES, 2 * x_it + 2); + for (int i = 0; i < x_it + 1; i++) { + immVertex3f(pos3d, + i * cache->gridx_size + cache->grid_extends_min[0], + cache->grid_extends_min[1], + 0.0f); + immVertex3f(pos3d, + i * cache->gridx_size + cache->grid_extends_min[0], + cache->grid_extends_max[1], + 0.0f); + } + immEnd(); - int y_it = (cache->grid_extends_max[1] - cache->grid_extends_min[1]) / cache->gridy_size; - immBegin(GPU_PRIM_LINES, 2 * y_it + 2); - for (int i = 0; i < y_it + 1; i++) { - immVertex3f(pos3d, - cache->grid_extends_min[0], - i * cache->gridy_size + cache->grid_extends_min[1], - 0.0f); - immVertex3f(pos3d, - cache->grid_extends_max[0], - i * cache->gridy_size + cache->grid_extends_min[1], - 0.0f); - } - immEnd(); + int y_it = (cache->grid_extends_max[1] - cache->grid_extends_min[1]) / cache->gridy_size; + immBegin(GPU_PRIM_LINES, 2 * y_it + 2); + for (int i = 0; i < y_it + 1; i++) { + immVertex3f(pos3d, + cache->grid_extends_min[0], + i * cache->gridy_size + cache->grid_extends_min[1], + 0.0f); + immVertex3f(pos3d, + cache->grid_extends_max[0], + i * cache->gridy_size + cache->grid_extends_min[1], + 0.0f); + } + immEnd(); } GPU_point_size(4); @@ -478,26 +475,21 @@ void blueprint_grid_extends_update(BlueprintCache *cache) blueprint_add_bb_point(pmin, pmax, cache->cursor); blueprint_add_bb_point(pmin, pmax, origin); if (cache->point_count > 0) { - LISTBASE_FOREACH (BlueprintPolyPoint *, p, &cache->poly) { - blueprint_add_bb_point(pmin, pmax, p->co); - } + LISTBASE_FOREACH (BlueprintPolyPoint *, p, &cache->poly) { + blueprint_add_bb_point(pmin, pmax, p->co); + } } cache->grid_extends_min[0] = pmin[0] - cache->grid_padding * cache->gridx_size; cache->grid_extends_min[1] = pmin[1] - cache->grid_padding * cache->gridy_size; cache->grid_extends_max[0] = pmax[0] + cache->grid_padding * cache->gridx_size; cache->grid_extends_max[1] = pmax[1] + cache->grid_padding * cache->gridy_size; - cache->grid_extends_min[0] = blueprint_snap_float(cache->grid_extends_min[0], - cache->gridx_size); - cache->grid_extends_min[1] = blueprint_snap_float(cache->grid_extends_min[1], - cache->gridx_size); - cache->grid_extends_max[0] = blueprint_snap_float(cache->grid_extends_max[0], - cache->gridy_size); - cache->grid_extends_max[1] = blueprint_snap_float(cache->grid_extends_max[1], - cache->gridy_size); + cache->grid_extends_min[0] = blueprint_snap_float(cache->grid_extends_min[0], cache->gridx_size); + cache->grid_extends_min[1] = blueprint_snap_float(cache->grid_extends_min[1], cache->gridx_size); + cache->grid_extends_max[0] = blueprint_snap_float(cache->grid_extends_max[0], cache->gridy_size); + cache->grid_extends_max[1] = blueprint_snap_float(cache->grid_extends_max[1], cache->gridy_size); } - void blueprint_triangulation_free(BlueprintCache *cache) { if (cache->coords) { @@ -528,10 +520,9 @@ void blueprint_triangulation_update(BlueprintCache *cache) void blueprint_draw_geometry(uint pos3d, BlueprintCache *cache) { - if (cache->state == BLUEPRINT_STATE_DRAW) { - blueprint_draw_poly_fill(pos3d, cache, 0.0f); - blueprint_draw_poly_stroke(pos3d, cache, 0.0f); + blueprint_draw_poly_fill(pos3d, cache, 0.0f); + blueprint_draw_poly_stroke(pos3d, cache, 0.0f); } if (cache->state == BLUEPRINT_STATE_EXTRUDE) { @@ -539,9 +530,9 @@ void blueprint_draw_geometry(uint pos3d, BlueprintCache *cache) if (cache->flags & BLUEPRINT_SYMMETRICAL_EXTRUDE) { z_base = -cache->extrudedist; } - blueprint_draw_poly_fill(pos3d, cache, z_base); - blueprint_draw_poly_stroke(pos3d, cache, z_base); - blueprint_draw_poly_fill(pos3d, cache, cache->extrudedist); + blueprint_draw_poly_fill(pos3d, cache, z_base); + blueprint_draw_poly_stroke(pos3d, cache, z_base); + blueprint_draw_poly_fill(pos3d, cache, cache->extrudedist); blueprint_draw_poly_volume(pos3d, cache, cache->extrudedist); blueprint_draw_poly_stroke(pos3d, cache, cache->extrudedist); } @@ -582,7 +573,6 @@ void blueprint_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) GPU_line_smooth(false); } - int blueprint_init(bContext *C, wmOperator *op, BlueprintConfig *config) { BlueprintCD *cd = MEM_callocN(sizeof(BlueprintCD), "CD"); @@ -639,7 +629,6 @@ int blueprint_init(bContext *C, wmOperator *op, BlueprintConfig *config) cache->freehand_step_threshold = 0.05f; - zero_v3(cache->cursor); zero_v3(cache->cursor_global); @@ -662,37 +651,89 @@ void blueprint_op_properties(wmOpe @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs