From 912f46d309b3c1c2ec581a44ec77fed38cbe6aad Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 7 Aug 2016 10:02:17 +0200 Subject: Fix pretty stupid mistake in last 'append fix' commit (rB50c017b6eabd). --- source/blender/blenkernel/intern/library.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c981edf1ba7..c5517265da3 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1662,12 +1662,12 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged /* Do not explicitly make local non-linkable IDs (shapekeys, in fact), they are assumed to be handled * by real datablocks responsible of them. */ - const bool do_skip = (id && BKE_idcode_is_linkable(GS(id->name))); + const bool do_skip = (id && !BKE_idcode_is_linkable(GS(id->name))); for (; id; id = id_next) { id->newid = NULL; id_next = id->next; /* id is possibly being inserted again */ - + /* The check on the second line (LIB_TAG_PRE_EXISTING) is done so its * possible to tag data you don't want to be made local, used for * appending data, so any libdata already linked wont become local -- cgit v1.2.3 From e1cdde5d147cb8928141441c102f3bbbd9e34cc7 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 7 Aug 2016 13:48:25 +0300 Subject: Particles: don't output nonsense UV data for Grid distribution particles. As reported in T48928, From Dupli UV is not supported for grid distribution, and running the normal code as usual simply produces nonsense data, because fuv is used to hold orco instead of interpolation factors for uv, and num is zero. Since support won't be added in 2.78, just stop outputting nonsense. --- source/blender/blenkernel/intern/particle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 42b818b35a5..4fb302c71ea 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4050,13 +4050,16 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, uv[0] = uv[1] = 0.f; + /* Grid distribution doesn't support UV or emit from vertex mode */ + bool is_grid = (part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT); + if (cpa) { if ((part->childtype == PART_CHILD_FACES) && (psmd->dm_final != NULL)) { CustomData *mtf_data = psmd->dm_final->getTessFaceDataLayout(psmd->dm_final); const int uv_idx = CustomData_get_render_layer(mtf_data, CD_MTFACE); mtface = CustomData_get_layer_n(mtf_data, CD_MTFACE, uv_idx); - if (mtface) { + if (mtface && !is_grid) { mface = psmd->dm_final->getTessFaceData(psmd->dm_final, cpa->num, CD_MFACE); mtface += cpa->num; psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv); @@ -4070,7 +4073,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, } } - if ((part->from == PART_FROM_FACE) && (psmd->dm_final != NULL)) { + if ((part->from == PART_FROM_FACE) && (psmd->dm_final != NULL) && !is_grid) { CustomData *mtf_data = psmd->dm_final->getTessFaceDataLayout(psmd->dm_final); const int uv_idx = CustomData_get_render_layer(mtf_data, CD_MTFACE); mtface = CustomData_get_layer_n(mtf_data, CD_MTFACE, uv_idx); -- cgit v1.2.3 From bc7d33176765c437031fae46330fde8b063e2665 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 7 Aug 2016 16:45:31 +0300 Subject: Don't hide on/off buttons of the Softbody modifier when there's Collision. From source code history, it seems this behavior is a relic of a very old limitation when the same object couldn't be both a Softbody and a Collision object. In those times if somehow both modifiers were added to an object, Softbody auto-disabled itself and buttons were hidden. Now however there is no problem having both modifiers on an object, so there is no point hiding the buttons. The same exact buttons are available on the physics tab in any case. --- source/blender/editors/interface/interface_templates.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 52283776816..241da5decc6 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -874,8 +874,8 @@ static uiLayout *draw_modifier( /* mode enabling buttons */ UI_block_align_begin(block); - /* Softbody not allowed in this situation, enforce! */ - if (((md->type != eModifierType_Softbody && md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && + /* Collision and Surface are always enabled, hide buttons! */ + if (((md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type != eModifierType_Surface) ) { uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE); -- cgit v1.2.3 From 945b9f4c3f93ff4ffcd9a1df2511957db4c66648 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Fri, 5 Aug 2016 18:12:17 +0200 Subject: GPencil: Do not disable continuous drawing if click out of drawing area Do not clear continuous drawing. This code was related to a previous test and must be removed. --- source/blender/editors/gpencil/gpencil_paint.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index eefdee70304..d637affe79d 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2390,9 +2390,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } else { /* printf("\t\tGP - end of stroke + op\n"); */ - /* disable paint session */ - p->scene->toolsettings->gpencil_flags &= ~GP_TOOL_FLAG_PAINTSESSIONS_ON; - p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; } @@ -2422,9 +2419,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) in_bounds = true; } else { - /* disable paint session */ - p->scene->toolsettings->gpencil_flags &= ~GP_TOOL_FLAG_PAINTSESSIONS_ON; - /* Out of bounds, or invalid in some other way */ p->status = GP_STATUS_ERROR; estate = OPERATOR_CANCELLED; @@ -2441,9 +2435,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) in_bounds = BLI_rcti_isect_pt_v(®ion_rect, event->mval); } else { - /* disable paint session */ - p->scene->toolsettings->gpencil_flags &= ~GP_TOOL_FLAG_PAINTSESSIONS_ON; - /* No region */ p->status = GP_STATUS_ERROR; estate = OPERATOR_CANCELLED; @@ -2471,9 +2462,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) p = gpencil_stroke_begin(C, op); if (p->status == GP_STATUS_ERROR) { - /* disable paint session */ - p->scene->toolsettings->gpencil_flags &= ~GP_TOOL_FLAG_PAINTSESSIONS_ON; - estate = OPERATOR_CANCELLED; } } @@ -2482,9 +2470,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) * NOTE: Don't eter this case if an error occurred while finding the * region (as above) */ - /* disable paint session */ - p->scene->toolsettings->gpencil_flags &= ~GP_TOOL_FLAG_PAINTSESSIONS_ON; - p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; } -- cgit v1.2.3 From 0e25dc4acc08e7c48588ec7dc27f3deea3a165ec Mon Sep 17 00:00:00 2001 From: Antonioya Date: Fri, 5 Aug 2016 21:09:30 +0200 Subject: GPencil: Fix error in arrange strokes During code review a field was renamed, but one line was missing. --- source/blender/editors/gpencil/gpencil_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 6f2ebbed7d7..876f873e5fa 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -747,7 +747,7 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) bGPDframe *gpf = gpl->actframe; /* temp listbase to store selected strokes */ ListBase selected = {NULL}; - const int direction = RNA_enum_get(op->ptr, "type"); + const int direction = RNA_enum_get(op->ptr, "direction"); /* verify if any selected stroke is in the extreme of the stack and select to move */ for (gps = gpf->strokes.first; gps; gps = gps->next) { -- cgit v1.2.3 From 97b0d23357b1f48f30d45f2f328707a7bdc40695 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Fri, 5 Aug 2016 23:03:51 +0200 Subject: GPencil: Add option to draw new strokes on back of layer For artist point of view is very useful to have an option to draw by default the new strokes on back of all strokes in the layer. --- source/blender/editors/gpencil/gpencil_paint.c | 13 +++++++++++-- source/blender/makesdna/DNA_scene_types.h | 2 ++ source/blender/makesrna/intern/rna_scene.c | 6 ++++++ 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index d637affe79d..cebcbfe9317 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -692,6 +692,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) bGPDspoint *pt; tGPspoint *ptc; bGPDbrush *brush = p->brush; + ToolSettings *ts = p->scene->toolsettings; int i, totelem; /* since strokes are so fine, when using their depth we need a margin otherwise they might get missed */ @@ -925,8 +926,16 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) gps->palcolor = palcolor; strcpy(gps->colorname, palcolor->info); - /* add stroke to frame */ - BLI_addtail(&p->gpf->strokes, gps); + /* add stroke to frame, usually on tail of the listbase, but if on back is enabled the stroke is added on listbase head + * because the drawing order is inverse and the head stroke is the first to draw. This is very useful for artist + * when drawing the background + */ + if (ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) { + BLI_addhead(&p->gpf->strokes, gps); + } + else { + BLI_addtail(&p->gpf->strokes, gps); + } gp_stroke_added_enable(p); } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 90e8d8b8270..a4934cc1f24 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -2088,6 +2088,8 @@ typedef enum eGPencil_Flags { GP_TOOL_FLAG_PAINTSESSIONS_ON = (1 << 0), /* When creating new frames, the last frame gets used as the basis for the new one */ GP_TOOL_FLAG_RETAIN_LAST = (1 << 1), + /* Add the strokes below all strokes in the layer */ + GP_TOOL_FLAG_PAINT_ONBACK = (1 << 2) } eGPencil_Flags; /* toolsettings->gpencil_src */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index abac6b98199..156c327f97c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2612,6 +2612,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) "are included as the basis for the new one"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "use_gpencil_draw_onback", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINT_ONBACK); + RNA_def_property_ui_text(prop, "Draw Strokes on Back", + "When draw new strokes, the new stroke is drawn below of all strokes in the layer"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "grease_pencil_source", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_src"); RNA_def_property_enum_items(prop, gpencil_source_3d_items); -- cgit v1.2.3 From fc9747fa89152251cf50b48db311622916d14f8f Mon Sep 17 00:00:00 2001 From: Antonioya Date: Sun, 7 Aug 2016 12:16:44 +0200 Subject: GPencil: Handle drawing on back for polygons The polygons must move the stroke to back only when polygon is complete --- source/blender/editors/gpencil/gpencil_paint.c | 36 +++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index cebcbfe9317..4e521b5909c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -930,7 +930,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) * because the drawing order is inverse and the head stroke is the first to draw. This is very useful for artist * when drawing the background */ - if (ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) { + if ((ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode != GP_PAINTMODE_DRAW_POLY)) { BLI_addhead(&p->gpf->strokes, gps); } else { @@ -2287,6 +2287,28 @@ static void gpencil_stroke_end(wmOperator *op) p->gpf = NULL; } +/* if drawing polygon and draw on back is enabled, move the stroke below all previous strokes */ +static void gpencil_move_polygon_stroke_to_back(bContext *C) +{ + /* move last stroke (the polygon) to head of the listbase stroke to draw on back of all previous strokes */ + bGPdata *gpd = ED_gpencil_data_get_active(C); + bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd); + + /* sanity checks */ + if (ELEM(NULL, gpd, gpl, gpl->actframe)) { + return; + } + + bGPDframe *gpf = gpl->actframe; + bGPDstroke *gps = gpf->strokes.last; + if (ELEM(NULL, gps)) { + return; + } + + BLI_remlink(&gpf->strokes, gps); + BLI_insertlinkbefore(&gpf->strokes, gpf->strokes.first, gps); +} + /* events handling during interactive drawing part of operator */ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) { @@ -2343,6 +2365,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) if (ELEM(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY, EKEY)) { /* exit() ends the current stroke before cleaning up */ /* printf("\t\tGP - end of paint op + end of stroke\n"); */ + /* if drawing polygon and enable on back, must move stroke */ + if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { + gpencil_move_polygon_stroke_to_back(C); + } p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; } @@ -2399,6 +2425,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } else { /* printf("\t\tGP - end of stroke + op\n"); */ + /* if drawing polygon and enable on back, must move stroke */ + if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { + gpencil_move_polygon_stroke_to_back(C); + } p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; } @@ -2479,6 +2509,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) * NOTE: Don't eter this case if an error occurred while finding the * region (as above) */ + /* if drawing polygon and enable on back, must move stroke */ + if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { + gpencil_move_polygon_stroke_to_back(C); + } p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; } -- cgit v1.2.3 From e635f0413d85ccf636d6abbfc3ed708fb7d68390 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 7 Aug 2016 20:46:05 +0200 Subject: Fix local view editing broken after changing object's layer from non-local view Wasn't copying back local view bytes to object after changing layer. Steps to reproduce were: * Split 3D view in default startup.blend * Enter local view in one of the 3D views * Move default cube to different layer *in the other 3D view* (the one that's not in local view) * Try transforming object from 3D View that's in local view (should lag) --- source/blender/editors/object/object_relations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 52fc07f3867..d5c7632765f 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1382,7 +1382,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) /* upper byte is used for local view */ local = base->lay & 0xFF000000; base->lay = lay + local; - base->object->lay = lay; + base->object->lay = base->lay; /* if (base->object->type == OB_LAMP) is_lamp = true; */ } CTX_DATA_END; -- cgit v1.2.3 From 31c34acff0b91444100095d9c2980273a4abd437 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Mon, 8 Aug 2016 11:21:44 +0200 Subject: GPencil: Move polygon to back only if something was drawn If the user enable polygon draw and press ESC before drawing something, the last stroke must not be moved back. --- source/blender/editors/gpencil/gpencil_paint.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 4e521b5909c..3afdd5772fc 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2367,7 +2367,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* printf("\t\tGP - end of paint op + end of stroke\n"); */ /* if drawing polygon and enable on back, must move stroke */ if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { - gpencil_move_polygon_stroke_to_back(C); + if (p->flags & GP_PAINTFLAG_STROKEADDED) { + gpencil_move_polygon_stroke_to_back(C); + } } p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; @@ -2427,7 +2429,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* printf("\t\tGP - end of stroke + op\n"); */ /* if drawing polygon and enable on back, must move stroke */ if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { - gpencil_move_polygon_stroke_to_back(C); + if (p->flags & GP_PAINTFLAG_STROKEADDED) { + gpencil_move_polygon_stroke_to_back(C); + } } p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; @@ -2511,7 +2515,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) */ /* if drawing polygon and enable on back, must move stroke */ if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { - gpencil_move_polygon_stroke_to_back(C); + if (p->flags & GP_PAINTFLAG_STROKEADDED) { + gpencil_move_polygon_stroke_to_back(C); + } } p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; -- cgit v1.2.3 From 444422120f25de84d02abc99b417bd3d6b85d55a Mon Sep 17 00:00:00 2001 From: Antonioya Date: Mon, 8 Aug 2016 11:26:00 +0200 Subject: GPencil: Cleanup - Rename function for better naming The old function name was not clear enough --- source/blender/editors/gpencil/gpencil_paint.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 3afdd5772fc..e7e39a85792 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2287,8 +2287,8 @@ static void gpencil_stroke_end(wmOperator *op) p->gpf = NULL; } -/* if drawing polygon and draw on back is enabled, move the stroke below all previous strokes */ -static void gpencil_move_polygon_stroke_to_back(bContext *C) +/* Move last stroke in the listbase to the head to be drawn below all previous strokes in the layer */ +static void gpencil_move_last_stroke_to_back(bContext *C) { /* move last stroke (the polygon) to head of the listbase stroke to draw on back of all previous strokes */ bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -2368,7 +2368,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* if drawing polygon and enable on back, must move stroke */ if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { if (p->flags & GP_PAINTFLAG_STROKEADDED) { - gpencil_move_polygon_stroke_to_back(C); + gpencil_move_last_stroke_to_back(C); } } p->status = GP_STATUS_DONE; @@ -2430,7 +2430,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* if drawing polygon and enable on back, must move stroke */ if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { if (p->flags & GP_PAINTFLAG_STROKEADDED) { - gpencil_move_polygon_stroke_to_back(C); + gpencil_move_last_stroke_to_back(C); } } p->status = GP_STATUS_DONE; @@ -2516,7 +2516,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* if drawing polygon and enable on back, must move stroke */ if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) { if (p->flags & GP_PAINTFLAG_STROKEADDED) { - gpencil_move_polygon_stroke_to_back(C); + gpencil_move_last_stroke_to_back(C); } } p->status = GP_STATUS_DONE; -- cgit v1.2.3 From f1040d7d9444ff6b0354b656e8265672f6600372 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Mon, 8 Aug 2016 13:48:03 +0300 Subject: Disable depth buffer writes while rendering smoke in the viewport. Depth buffer values are used by the viewport pan and zoom code to adjust response scaling factors between mouse and viewport movement. Letting smoke write to the buffer confuses it and causes the camera to get stuck and move very slowly inside smoke domains, because it thinks it is very close to an object. --- source/blender/editors/space_view3d/drawvolume.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index e93d840eddd..8dbc2788744 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -379,11 +379,13 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob, /* setup buffer and draw */ - int gl_depth = 0, gl_blend = 0; + int gl_depth = 0, gl_blend = 0, gl_depth_write = 0; glGetBooleanv(GL_BLEND, (GLboolean *)&gl_blend); glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth); + glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&gl_depth_write); glEnable(GL_DEPTH_TEST); + glDepthMask(GL_FALSE); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -422,6 +424,8 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob, GPU_shader_unbind(); + glDepthMask(gl_depth_write); + if (!gl_blend) { glDisable(GL_BLEND); } -- cgit v1.2.3 From b745a2401b6ccf75b1e90cf1c8fa648d99c81e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Mon, 8 Aug 2016 17:51:15 +0200 Subject: Fix ID types DAG update tagging. The first character of the ID type was used to tag IDs for updates which is weak since different IDs can have the same first character (for example meshes, materials and metaballs), causing unnecessary updates of unrelated IDs. Now we use a unique index per ID type to tag for updates, unifying IDs arrays indexing along the way. Reviewers: sergey, mont29 Differential Revision: https://developer.blender.org/D2139 --- source/blender/blenkernel/BKE_idcode.h | 2 + source/blender/blenkernel/BKE_main.h | 4 +- source/blender/blenkernel/intern/depsgraph.c | 17 ++--- source/blender/blenkernel/intern/idcode.c | 50 +++++++++++++ source/blender/blenkernel/intern/library.c | 84 +++++++++++----------- source/blender/depsgraph/intern/depsgraph_query.cc | 3 +- source/blender/depsgraph/intern/depsgraph_tag.cc | 17 ++--- source/blender/makesdna/DNA_ID.h | 40 +++++++++++ 8 files changed, 148 insertions(+), 69 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h index 6de0efe2709..964a49435f1 100644 --- a/source/blender/blenkernel/BKE_idcode.h +++ b/source/blender/blenkernel/BKE_idcode.h @@ -42,6 +42,8 @@ bool BKE_idcode_is_valid(short idcode); int BKE_idcode_to_idfilter(const short idcode); short BKE_idcode_from_idfilter(const int idfilter); +int BKE_idcode_to_index(const short idcode); + /** * Return an ID code and steps the index forward 1. * diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 29219a4f56e..a4f5c425282 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -42,6 +42,8 @@ */ #include "DNA_listBase.h" +#include "BKE_library.h" + #ifdef __cplusplus extern "C" { #endif @@ -104,7 +106,7 @@ typedef struct Main { ListBase linestyle; ListBase cachefiles; - char id_tag_update[256]; + char id_tag_update[MAX_LIBARRAY]; /* Evaluation context used by viewport */ struct EvaluationContext *eval_ctx; diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 986c1d88bc9..45a23c39910 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -67,6 +67,7 @@ #include "BKE_effect.h" #include "BKE_fcurve.h" #include "BKE_global.h" +#include "BKE_idcode.h" #include "BKE_image.h" #include "BKE_key.h" #include "BKE_library.h" @@ -2805,9 +2806,7 @@ void DAG_ids_flush_tagged(Main *bmain) ListBase *lb = lbarray[a]; ID *id = lb->first; - /* we tag based on first ID type character to avoid - * looping over all ID's in case there are no tags */ - if (id && bmain->id_tag_update[id->name[0]]) { + if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) { for (; id; id = id->next) { if (id->tag & (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA)) { @@ -2847,9 +2846,7 @@ void DAG_ids_check_recalc(Main *bmain, Scene *scene, bool time) ListBase *lb = lbarray[a]; ID *id = lb->first; - /* we tag based on first ID type character to avoid - * looping over all ID's in case there are no tags */ - if (id && bmain->id_tag_update[id->name[0]]) { + if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) { updated = true; break; } @@ -2930,9 +2927,7 @@ void DAG_ids_clear_recalc(Main *bmain) ListBase *lb = lbarray[a]; ID *id = lb->first; - /* we tag based on first ID type character to avoid - * looping over all ID's in case there are no tags */ - if (id && bmain->id_tag_update[id->name[0]]) { + if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) { for (; id; id = id->next) { if (id->tag & (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA)) id->tag &= ~(LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA); @@ -3053,12 +3048,12 @@ void DAG_id_type_tag(Main *bmain, short idtype) DAG_id_type_tag(bmain, ID_SCE); } - bmain->id_tag_update[((char *)&idtype)[0]] = 1; + bmain->id_tag_update[BKE_idcode_to_index(idtype)] = 1; } int DAG_id_type_tagged(Main *bmain, short idtype) { - return bmain->id_tag_update[((char *)&idtype)[0]]; + return bmain->id_tag_update[BKE_idcode_to_index(idtype)]; } #if 0 // UNUSED diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 1127d1d88da..70d037d85f3 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -261,6 +261,56 @@ short BKE_idcode_from_idfilter(const int idfilter) #undef CASE_IDFILTER } +/** + * Convert an idcode into an index (e.g. ID_OB -> INDEX_ID_OB). + */ +int BKE_idcode_to_index(const short idcode) +{ +#define CASE_IDINDEX(_id) case ID_##_id: return INDEX_ID_##_id + + switch ((ID_Type)idcode) { + CASE_IDINDEX(AC); + CASE_IDINDEX(AR); + CASE_IDINDEX(BR); + CASE_IDINDEX(CA); + CASE_IDINDEX(CF); + CASE_IDINDEX(CU); + CASE_IDINDEX(GD); + CASE_IDINDEX(GR); + CASE_IDINDEX(IM); + CASE_IDINDEX(KE); + CASE_IDINDEX(IP); + CASE_IDINDEX(LA); + CASE_IDINDEX(LI); + CASE_IDINDEX(LS); + CASE_IDINDEX(LT); + CASE_IDINDEX(MA); + CASE_IDINDEX(MB); + CASE_IDINDEX(MC); + CASE_IDINDEX(ME); + CASE_IDINDEX(MSK); + CASE_IDINDEX(NT); + CASE_IDINDEX(OB); + CASE_IDINDEX(PA); + CASE_IDINDEX(PAL); + CASE_IDINDEX(PC); + CASE_IDINDEX(SCE); + CASE_IDINDEX(SCR); + CASE_IDINDEX(SPK); + CASE_IDINDEX(SO); + CASE_IDINDEX(TE); + CASE_IDINDEX(TXT); + CASE_IDINDEX(VF); + CASE_IDINDEX(WM); + CASE_IDINDEX(WO); + } + + BLI_assert(0); + return -1; + +#undef CASE_IDINDEX +} + /** * Convert an idcode into a name (plural). * diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c5517265da3..6d94cd28b31 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -753,60 +753,56 @@ void BKE_main_lib_objects_recalc_all(Main *bmain) * \note MAX_LIBARRAY define should match this code */ int set_listbasepointers(Main *main, ListBase **lb) { - int a = 0; - /* BACKWARDS! also watch order of free-ing! (mesh<->mat), first items freed last. * This is important because freeing data decreases usercounts of other datablocks, * if this data is its self freed it can crash. */ - lb[a++] = &(main->library); /* Libraries may be accessed from pretty much any other ID... */ - lb[a++] = &(main->ipo); - lb[a++] = &(main->action); /* moved here to avoid problems when freeing with animato (aligorith) */ - lb[a++] = &(main->key); - lb[a++] = &(main->gpencil); /* referenced by nodes, objects, view, scene etc, before to free after. */ - lb[a++] = &(main->nodetree); - lb[a++] = &(main->image); - lb[a++] = &(main->tex); - lb[a++] = &(main->mat); - lb[a++] = &(main->vfont); + lb[INDEX_ID_LI] = &(main->library); /* Libraries may be accessed from pretty much any other ID... */ + lb[INDEX_ID_IP] = &(main->ipo); + lb[INDEX_ID_AC] = &(main->action); /* moved here to avoid problems when freeing with animato (aligorith) */ + lb[INDEX_ID_KE] = &(main->key); + lb[INDEX_ID_GD] = &(main->gpencil); /* referenced by nodes, objects, view, scene etc, before to free after. */ + lb[INDEX_ID_NT] = &(main->nodetree); + lb[INDEX_ID_IM] = &(main->image); + lb[INDEX_ID_TE] = &(main->tex); + lb[INDEX_ID_MA] = &(main->mat); + lb[INDEX_ID_VF] = &(main->vfont); /* Important!: When adding a new object type, * the specific data should be inserted here */ - lb[a++] = &(main->armature); - - lb[a++] = &(main->cachefiles); - lb[a++] = &(main->mesh); - lb[a++] = &(main->curve); - lb[a++] = &(main->mball); - - lb[a++] = &(main->latt); - lb[a++] = &(main->lamp); - lb[a++] = &(main->camera); - - lb[a++] = &(main->text); - lb[a++] = &(main->sound); - lb[a++] = &(main->group); - lb[a++] = &(main->palettes); - lb[a++] = &(main->paintcurves); - lb[a++] = &(main->brush); - lb[a++] = &(main->particle); - lb[a++] = &(main->speaker); - - lb[a++] = &(main->world); - lb[a++] = &(main->movieclip); - lb[a++] = &(main->screen); - lb[a++] = &(main->object); - lb[a++] = &(main->linestyle); /* referenced by scenes */ - lb[a++] = &(main->scene); - lb[a++] = &(main->wm); - lb[a++] = &(main->mask); + lb[INDEX_ID_AR] = &(main->armature); + + lb[INDEX_ID_CF] = &(main->cachefiles); + lb[INDEX_ID_ME] = &(main->mesh); + lb[INDEX_ID_CU] = &(main->curve); + lb[INDEX_ID_MB] = &(main->mball); + + lb[INDEX_ID_LT] = &(main->latt); + lb[INDEX_ID_LA] = &(main->lamp); + lb[INDEX_ID_CA] = &(main->camera); + + lb[INDEX_ID_TXT] = &(main->text); + lb[INDEX_ID_SO] = &(main->sound); + lb[INDEX_ID_GR] = &(main->group); + lb[INDEX_ID_PAL] = &(main->palettes); + lb[INDEX_ID_PC] = &(main->paintcurves); + lb[INDEX_ID_BR] = &(main->brush); + lb[INDEX_ID_PA] = &(main->particle); + lb[INDEX_ID_SPK] = &(main->speaker); + + lb[INDEX_ID_WO] = &(main->world); + lb[INDEX_ID_MC] = &(main->movieclip); + lb[INDEX_ID_SCR] = &(main->screen); + lb[INDEX_ID_OB] = &(main->object); + lb[INDEX_ID_LS] = &(main->linestyle); /* referenced by scenes */ + lb[INDEX_ID_SCE] = &(main->scene); + lb[INDEX_ID_WM] = &(main->wm); + lb[INDEX_ID_MSK] = &(main->mask); - lb[a] = NULL; - - BLI_assert(a + 1 == MAX_LIBARRAY); + lb[INDEX_ID_NULL] = NULL; - return a; + return (MAX_LIBARRAY - 1); } /* *********** ALLOC AND FREE ***************** diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index cac4eaae215..7f2f6a65f5e 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -33,6 +33,7 @@ #include "MEM_guardedalloc.h" extern "C" { +#include "BKE_idcode.h" #include "BKE_main.h" #include "DEG_depsgraph_query.h" @@ -42,7 +43,7 @@ extern "C" { bool DEG_id_type_tagged(Main *bmain, short idtype) { - return bmain->id_tag_update[((unsigned char *)&idtype)[0]] != 0; + return bmain->id_tag_update[BKE_idcode_to_index(idtype)] != 0; } short DEG_get_eval_flags_for_id(Depsgraph *graph, ID *id) diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index ea5afaab3f7..b7b62bd59f9 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -44,6 +44,7 @@ extern "C" { #include "BLI_task.h" +#include "BKE_idcode.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_node.h" @@ -259,10 +260,8 @@ void DEG_id_type_tag(Main *bmain, short idtype) DEG_id_type_tag(bmain, ID_WO); DEG_id_type_tag(bmain, ID_SCE); } - /* We tag based on first ID type character to avoid - * looping over all ID's in case there are no tags. - */ - bmain->id_tag_update[((unsigned char *)&idtype)[0]] = 1; + + bmain->id_tag_update[BKE_idcode_to_index(idtype)] = 1; } /* Recursively push updates out to all nodes dependent on this, @@ -373,10 +372,7 @@ void DEG_ids_check_recalc(Main *bmain, Scene *scene, bool time) ListBase *lb = lbarray[a]; ID *id = (ID *)lb->first; - /* We tag based on first ID type character to avoid - * looping over all ID's in case there are no tags. - */ - if (id && bmain->id_tag_update[(unsigned char)id->name[0]]) { + if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) { updated = true; break; } @@ -401,10 +397,7 @@ void DEG_ids_clear_recalc(Main *bmain) ListBase *lb = lbarray[a]; ID *id = (ID *)lb->first; - /* We tag based on first ID type character to avoid - * looping over all ID's in case there are no tags. - */ - if (id && bmain->id_tag_update[(unsigned char)id->name[0]]) { + if (id && bmain->id_tag_update[BKE_idcode_to_index(GS(id->name))]) { for (; id; id = (ID *)id->next) { id->tag &= ~(LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA); diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 0f8cc8fa105..5c1bfc229da 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -381,6 +381,46 @@ enum { FILTER_ID_CF = (1 << 28), }; +/* IMPORTANT: this enum matches the order currently use in set_lisbasepointers, + * keep them in sync! */ +enum { + INDEX_ID_LI = 0, + INDEX_ID_IP, + INDEX_ID_AC, + INDEX_ID_KE, + INDEX_ID_GD, + INDEX_ID_NT, + INDEX_ID_IM, + INDEX_ID_TE, + INDEX_ID_MA, + INDEX_ID_VF, + INDEX_ID_AR, + INDEX_ID_CF, + INDEX_ID_ME, + INDEX_ID_CU, + INDEX_ID_MB, + INDEX_ID_LT, + INDEX_ID_LA, + INDEX_ID_CA, + INDEX_ID_TXT, + INDEX_ID_SO, + INDEX_ID_GR, + INDEX_ID_PAL, + INDEX_ID_PC, + INDEX_ID_BR, + INDEX_ID_PA, + INDEX_ID_SPK, + INDEX_ID_WO, + INDEX_ID_MC, + INDEX_ID_SCR, + INDEX_ID_OB, + INDEX_ID_LS, + INDEX_ID_SCE, + INDEX_ID_WM, + INDEX_ID_MSK, + INDEX_ID_NULL, +}; + #ifdef __cplusplus } #endif -- cgit v1.2.3 From d1b9306cd5a04f149c748880e907c2375e01f4a5 Mon Sep 17 00:00:00 2001 From: lazydodo Date: Mon, 8 Aug 2016 16:57:04 -0600 Subject: Alembic: fix finding boost headers for win32 --- source/blender/alembic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt index f579a3b200a..42bd6a9c340 100644 --- a/source/blender/alembic/CMakeLists.txt +++ b/source/blender/alembic/CMakeLists.txt @@ -40,7 +40,7 @@ set(INC_SYS ${HDF5_INCLUDE_DIRS} ${OPENEXR_INCLUDE_DIRS} ) -if(APPLE) +if(APPLE OR WIN32) list(APPEND INC_SYS ${BOOST_INCLUDE_DIR} ) -- cgit v1.2.3 From 151390069a5bbddb15d1362ec1ac5722090e9231 Mon Sep 17 00:00:00 2001 From: Alexander Romanov Date: Tue, 9 Aug 2016 12:29:14 +0300 Subject: Bugfix. glDisable with bad enum argument in GPU_texture_unbind Reported by @panzergame in D1414. `glDisable` calls with bad enum argument `GL_TEXTURE_2D_MULTISAMPLE` that came from this line: `tex->target = (n == 1) ? GL_TEXTURE_1D : (samples ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D);` Reviewers: brecht Reviewed By: brecht Subscribers: AlexKowel, yurikovelenov, panzergame Differential Revision: https://developer.blender.org/D2145 --- source/blender/gpu/intern/gpu_texture.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source/blender') diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 827c52c9a5f..54f0003c086 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -55,7 +55,8 @@ struct GPUTexture { int number; /* number for multitexture binding */ int refcount; /* reference count */ GLenum target; /* GL_TEXTURE_* */ - GLenum target_base; /* same as target, (but no multisample) */ + GLenum target_base; /* same as target, (but no multisample) + * use it for unbinding */ GLuint bindcode; /* opengl identifier for texture */ int fromblender; /* we got the texture from Blender */ @@ -374,6 +375,9 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int textarget GLint bindcode = GPU_verify_image(ima, iuser, textarget, 0, 0, mipmap, is_data); GPU_update_image_time(ima, time); + /* see GPUInput::textarget: it can take two values - GL_TEXTURE_2D and GL_TEXTURE_CUBE_MAP + * these values are correct for glDisable, so textarget can be safely used in + * GPU_texture_bind/GPU_texture_unbind through tex->target_base */ if (textarget == GL_TEXTURE_2D) gputt = TEXTARGET_TEXTURE_2D; else @@ -390,7 +394,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int textarget tex->number = -1; tex->refcount = 1; tex->target = textarget; - tex->target_base = GL_TEXTURE_2D; + tex->target_base = textarget; tex->fromblender = 1; ima->gputexture[gputt] = tex; @@ -626,11 +630,11 @@ void GPU_texture_bind(GPUTexture *tex, int number) GLenum arbnumber = (GLenum)((GLuint)GL_TEXTURE0 + number); if (number != 0) glActiveTexture(arbnumber); if (tex->bindcode != 0) { - glBindTexture(tex->target, tex->bindcode); + glBindTexture(tex->target_base, tex->bindcode); } else - GPU_invalid_tex_bind(tex->target); - glEnable(tex->target); + GPU_invalid_tex_bind(tex->target_base); + glEnable(tex->target_base); if (number != 0) glActiveTexture(GL_TEXTURE0); tex->number = number; @@ -652,8 +656,6 @@ void GPU_texture_unbind(GPUTexture *tex) GLenum arbnumber = (GLenum)((GLuint)GL_TEXTURE0 + tex->number); if (tex->number != 0) glActiveTexture(arbnumber); - glBindTexture(tex->target, 0); - glDisable(tex->target); glBindTexture(tex->target_base, 0); glDisable(tex->target_base); if (tex->number != 0) glActiveTexture(GL_TEXTURE0); -- cgit v1.2.3 From 1647d89cf14b0286043b5d54398ecde8e132d042 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 9 Aug 2016 14:33:00 +0200 Subject: Fix T49027: Sequence uses too much memory when rendering scene with lots of movie strips Now we free sequencer cache and close all unneeded FFmpeg handles when rendering. This is the same logic as image sequence memory freeding. --- source/blender/blenkernel/BKE_sequencer.h | 2 ++ source/blender/blenkernel/intern/sequencer.c | 28 ++++++++++++++++++++++++++ source/blender/render/intern/source/pipeline.c | 1 + 3 files changed, 31 insertions(+) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 30bb6954019..811e9136fc9 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -477,4 +477,6 @@ struct ImBuf *BKE_sequencer_render_mask_input( int cfra, int fra_offset, bool make_float); void BKE_sequencer_color_balance_apply(struct StripColorBalance *cb, struct ImBuf *ibuf, float mul, bool make_float, struct ImBuf *mask_input); +void BKE_sequencer_all_free_anim_ibufs(int cfra); + #endif /* __BKE_SEQUENCER_H__ */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 6067a8b2d9b..b2a19c59084 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -5595,3 +5595,31 @@ int BKE_sequencer_find_next_prev_edit( return best_frame; } + +static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int cfra) +{ + for (Sequence *seq = seqbase->first; seq != NULL; seq = seq->next) { + if (seq->enddisp < cfra || seq->startdisp > cfra) { + BKE_sequence_free_anim(seq); + } + if (seq->type == SEQ_TYPE_META) { + sequencer_all_free_anim_ibufs(&seq->seqbase, cfra); + } + } +} + +void BKE_sequencer_all_free_anim_ibufs(int cfra) +{ + BKE_sequencer_cache_cleanup(); + for (Scene *scene = G.main->scene.first; + scene != NULL; + scene = scene->id.next) + { + Editing *ed = BKE_sequencer_editing_get(scene, false); + if (ed == NULL) { + /* Ignore scenes without sequencer. */ + continue; + } + sequencer_all_free_anim_ibufs(&ed->seqbase, cfra); + } +} diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 604693f486e..ec629aa2863 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2785,6 +2785,7 @@ static void do_render_all_options(Render *re) /* ensure no images are in memory from previous animated sequences */ BKE_image_all_free_anim_ibufs(re->r.cfra); + BKE_sequencer_all_free_anim_ibufs(re->r.cfra); if (RE_engine_render(re, 1)) { /* in this case external render overrides all */ -- cgit v1.2.3 From d5a0ae00d08897f7066c6f69e130e717dd5654c1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 9 Aug 2016 14:58:34 +0200 Subject: Fix T48916: Proxy Custom File is broken --- source/blender/blenkernel/intern/sequencer.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b2a19c59084..c240aa27343 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1656,6 +1656,9 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render else if ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE)) { BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); } + else if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { + BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); + } else if (sanim && sanim->anim && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR)) { char fname[FILE_MAXFILE]; BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); @@ -1675,13 +1678,21 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render if (view_id > 0) BLI_snprintf(suffix, sizeof(suffix), "_%d", view_id); - if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE && sanim && sanim->anim && + if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE && ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE) { - BLI_join_dirfile(name, PROXY_MAXFILE, - dir, proxy->file); - BLI_path_abs(name, G.main->name); - BLI_snprintf(name, PROXY_MAXFILE, "%s_%s", name, suffix); + char fname[FILE_MAXFILE]; + BLI_join_dirfile(fname, PROXY_MAXFILE, dir, proxy->file); + BLI_path_abs(fname, G.main->name); + if (suffix[0] != '\0') { + /* TODO(sergey): This will actually append suffix after extension + * which is weird but how was originally coded in multiview branch. + */ + BLI_snprintf(name, PROXY_MAXFILE, "%s_%s", fname, suffix); + } + else { + BLI_strncpy(name, fname, PROXY_MAXFILE); + } return true; } -- cgit v1.2.3 From 3bbf8fbaeb0dff1aaacdfe97154c3706424da9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Tue, 9 Aug 2016 15:32:58 +0200 Subject: Fix for isfinite breaking builds when WITH_CXX11 is enabled. This happens when cmath.h is included after math.h in cpp code. Kudos to Sergey for pointing this out. --- source/blender/render/intern/raytrace/rayobject_rtbuild.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender') diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp index 02a49fc3c8f..6abe1061247 100644 --- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp +++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp @@ -42,6 +42,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +using std::isfinite; + static bool selected_node(RTBuilder::Object *node) { return node->selected; -- cgit v1.2.3 From 02719521d2e25abcc8ffcccc086d3a651986f52f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 9 Aug 2016 15:47:51 +0200 Subject: Attempt to fix previous commit for non-c++11 builds --- source/blender/render/intern/raytrace/rayobject_rtbuild.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender') diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp index 6abe1061247..724a809077e 100644 --- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp +++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp @@ -42,7 +42,9 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#if __cplusplus >= 201103L using std::isfinite; +#endif static bool selected_node(RTBuilder::Object *node) { -- cgit v1.2.3 From c19d527ed86aaa2a43581e2099e82b89b5fe4f23 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 9 Aug 2016 20:00:53 +0200 Subject: Fix crash in id remapping of Graph editor. dopsheet data pointer is not guaranteed to be set it seems... --- source/blender/editors/space_graph/space_graph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 2582ba4be8d..b35d1b2c777 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -687,7 +687,7 @@ static void graph_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID return; } - if ((ID *)sgraph->ads->filter_grp == old_id) { + if (sgraph->ads && (ID *)sgraph->ads->filter_grp == old_id) { sgraph->ads->filter_grp = (Group *)new_id; } } -- cgit v1.2.3 From 774beb7c3cf04cc42703a4a6ebb9a4836690b060 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Wed, 10 Aug 2016 12:20:02 +0200 Subject: GPencil: Rename color name property to keep consistency in naming --- source/blender/makesrna/intern/rna_gpencil.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 80f4d5d05b6..7424c190501 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -1381,8 +1381,9 @@ static void rna_def_gpencil_palettecolor(BlenderRNA *brna) RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); /* Name */ - prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Info", "Color name"); + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "info"); + RNA_def_property_ui_text(prop, "Name", "Color name"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilPaletteColor_info_set"); RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); -- cgit v1.2.3