[Bf-blender-cvs] [90a06259eeb] master: Fix T63503: Set parent menu shown twice

2019-04-28 Thread Campbell Barton
Commit: 90a06259eeb6101673160ca7bce591e0c272e303
Author: Campbell Barton
Date:   Mon Apr 29 15:40:50 2019 +1000
Branches: master
https://developer.blender.org/rB90a06259eeb6101673160ca7bce591e0c272e303

Fix T63503: Set parent menu shown twice

When the 'type' property is set,
execute the operation instead of showing the menu.

===

M   source/blender/editors/object/object_relations.c

===

diff --git a/source/blender/editors/object/object_relations.c 
b/source/blender/editors/object/object_relations.c
index bf74c17c361..a62c0add521 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -994,15 +994,13 @@ static int parent_set_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
-static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const 
wmEvent *UNUSED(event))
+static int parent_set_invoke_menu(bContext *C, wmOperatorType *ot)
 {
   Object *parent = ED_object_active_context(C);
   uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), 
ICON_NONE);
   uiLayout *layout = UI_popup_menu_layout(pup);
 
-  wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", true);
   PointerRNA opptr;
-
 #if 0
   uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_OBJECT);
 #else
@@ -1072,6 +1070,14 @@ static int parent_set_invoke(bContext *C, wmOperator 
*UNUSED(op), const wmEvent
   return OPERATOR_INTERFACE;
 }
 
+static int parent_set_invoke(bContext *C, wmOperator *op, const wmEvent 
*UNUSED(event))
+{
+  if (RNA_property_is_set(op->ptr, op->type->prop)) {
+return parent_set_exec(C, op);
+  }
+  return parent_set_invoke_menu(C, op->type);
+}
+
 static bool parent_set_poll_property(const bContext *UNUSED(C),
  wmOperator *op,
  const PropertyRNA *prop)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d2859237fa1] master: Fix T63898: "Open on Mouse Over" causes inconsistent draw-style

2019-04-28 Thread Campbell Barton
Commit: d2859237fa108f77814a6270d592b55a2b63c255
Author: Campbell Barton
Date:   Mon Apr 29 15:25:56 2019 +1000
Branches: master
https://developer.blender.org/rBd2859237fa108f77814a6270d592b55a2b63c255

Fix T63898: "Open on Mouse Over" causes inconsistent draw-style

===

M   source/blender/editors/interface/interface_region_popover.c

===

diff --git a/source/blender/editors/interface/interface_region_popover.c 
b/source/blender/editors/interface/interface_region_popover.c
index 110c8827849..f149ccd626c 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -257,6 +257,8 @@ static void ui_block_free_func_POPOVER(uiPopupBlockHandle 
*UNUSED(handle), void
 uiPopupBlockHandle *ui_popover_panel_create(
 bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, 
void *arg)
 {
+  wmWindow *window = CTX_wm_window(C);
+
   /* Create popover, buttons are created from callback. */
   uiPopover *pup = MEM_callocN(sizeof(uiPopover), __func__);
   pup->but = but;
@@ -271,7 +273,11 @@ uiPopupBlockHandle *ui_popover_panel_create(
   pup->menu_arg = arg;
 
 #ifdef USE_UI_POPOVER_ONCE
-  pup->is_once = true;
+  {
+/* Ideally this would be passed in. */
+const wmEvent *event = window->eventstate;
+pup->is_once = (event->type == LEFTMOUSE) && (event->val == KM_PRESS);
+  }
 #endif
 
   /* Create popup block. */
@@ -283,7 +289,6 @@ uiPopupBlockHandle *ui_popover_panel_create(
   /* Add handlers. If attached to a button, the button will already
* add a modal handler and pass on events. */
   if (!but) {
-wmWindow *window = CTX_wm_window(C);
 UI_popup_handlers_add(C, >modalhandlers, handle, 0);
 WM_event_add_mousemove(C);
 handle->popup = true;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [14897fb6533] master: Cleanup: spelling

2019-04-28 Thread Campbell Barton
Commit: 14897fb6533a6fcfdb665a215b8daf72b6550574
Author: Campbell Barton
Date:   Mon Apr 29 14:14:14 2019 +1000
Branches: master
https://developer.blender.org/rB14897fb6533a6fcfdb665a215b8daf72b6550574

Cleanup: spelling

===

M   intern/cycles/blender/blender_curves.cpp
M   intern/cycles/blender/blender_sync.cpp
M   source/blender/blenkernel/intern/paint.c
M   source/blender/editors/animation/keyframes_draw.c
M   source/blender/editors/gpencil/gpencil_brush.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_select.c
M   source/blender/editors/include/BIF_glutil.h
M   source/blender/editors/include/ED_screen_types.h
M   source/blender/editors/include/UI_resources.h
M   source/blender/editors/object/object_collection.c
M   source/blender/editors/sculpt_paint/paint_cursor.c
M   source/blender/editors/sculpt_paint/paint_ops.c
M   source/blender/editors/sculpt_paint/paint_utils.c
M   source/blender/editors/space_file/file_ops.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/gpu/intern/gpu_select_pick.c
M   source/blender/gpu/intern/gpu_uniformbuffer.c
M   source/blender/makesdna/DNA_brush_types.h
M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index 636b8e42481..1a36376f36e 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -766,7 +766,7 @@ static void ExportCurveSegmentsMotion(Mesh *mesh, 
ParticleCurveData *CData, int
 }
   }
   else {
-/* Number of keys has changed. Genereate an interpolated version
+/* Number of keys has changed. Generate an interpolated version
  * to preserve motion blur. */
 const float step_size = num_center_curve_keys > 1 ? 1.0f / 
(num_center_curve_keys - 1) :
 0.0f;
diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index 0ab6d88487e..8d93d517d4e 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -583,7 +583,7 @@ vector 
BlenderSync::sync_render_passes(BL::RenderLayer _rlay, BL::ViewLa
   }
 
   /* Cryptomatte stores two ID/weight pairs per RGBA layer.
-   * User facing paramter is the number of pairs. */
+   * User facing parameter is the number of pairs. */
   int crypto_depth = min(16, get_int(crp, "pass_crypto_depth")) / 2;
   scene->film->cryptomatte_depth = crypto_depth;
   scene->film->cryptomatte_passes = CRYPT_NONE;
diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index 7a36ff4e380..c52f8277b6b 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -506,7 +506,7 @@ void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve 
*pc, const int add_inde
   pc->add_index = (add_index || pc->tot_points == 1) ? (add_index + 1) : 0;
 }
 
-/* remove colour from palette. Must be certain color is inside the palette! */
+/** Remove color from palette. Must be certain color is inside the palette! */
 void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
 {
   if (BLI_listbase_count_at_most(>colors, palette->active_color) ==
diff --git a/source/blender/editors/animation/keyframes_draw.c 
b/source/blender/editors/animation/keyframes_draw.c
index 22350f997f3..678afef5773 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -715,7 +715,7 @@ static void draw_keylist(View2D *v2d,
 float sel_mhcol[4], unsel_mhcol[4];
 float ipo_color[4], ipo_color_mix[4];
 
-/* cache colours first */
+/* cache colors first */
 UI_GetThemeColor4fv(TH_STRIP_SELECT, sel_color);
 UI_GetThemeColor4fv(TH_STRIP, unsel_color);
 UI_GetThemeColor4fv(TH_DOPESHEET_IPOLINE, ipo_color);
diff --git a/source/blender/editors/gpencil/gpencil_brush.c 
b/source/blender/editors/gpencil/gpencil_brush.c
index f9a5ff3a0cf..bc98cb5226b 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -969,7 +969,7 @@ typedef struct tGPSB_CloneBrushData {
   /* for "stamp" mode, the currently pasted brushes */
   bGPDstroke **new_strokes;
 
-  /* mapping from colors referenced per stroke, to the new colours in the 
"pasted" strokes */
+  /** Mapping from colors referenced per stroke, to the new colors in the 
"pasted" strokes. */
   GHash *new_colors;
 } tGPSB_CloneBrushData;
 
@@ -1017,7 +1017,7 @@ static void gp_brush_clone_init(bContext *C, 
tGP_BrushEditData *gso)
   }
 
   /* Init colormap for mapping between the pasted stroke's source color (names)

[Bf-blender-cvs] [dc2ce40c951] master: Docs: expand action-zone type comments

2019-04-28 Thread Campbell Barton
Commit: dc2ce40c9518ef8b57c39f18f93e2993c7cb3270
Author: Campbell Barton
Date:   Mon Apr 29 13:45:49 2019 +1000
Branches: master
https://developer.blender.org/rBdc2ce40c9518ef8b57c39f18f93e2993c7cb3270

Docs: expand action-zone type comments

===

M   source/blender/editors/include/ED_screen_types.h

===

diff --git a/source/blender/editors/include/ED_screen_types.h 
b/source/blender/editors/include/ED_screen_types.h
index 3cbeab247ef..a584ce4cca0 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -108,15 +108,29 @@ typedef struct AZone {
   float alpha;
 } AZone;
 
-/* actionzone type */
+/** Action-Zone Type: #AZone.type */
 enum {
-  /* corner widgets for splitting areas */
+  /**
+   * Corner widgets for:
+   * - Splitting areas.
+   * - Swapping areas (Ctrl).
+   * - Copying the area into a new window (Shift).
+   */
   AZONE_AREA = 1,
-  /* when a region is collapsed, draw a handle to expose */
+  /**
+   * Use for region show/hide state:
+   * - When a region is collapsed, draw a handle to expose.
+   * - When a region is expanded, use the the action zone to resize the region.
+   */
   AZONE_REGION,
-  /* when in editor fullscreen draw a corner to go to normal mode */
+  /**
+   * Used when in editor fullscreen draw a corner to return to normal mode.
+   */
   AZONE_FULLSCREEN,
-  /* Hotspot azone around scrollbars to show/hide them. */
+  /**
+   * Hotspot azone around scrollbars to show/hide them.
+   * Only show the scrull-bars when the cursor is close.
+   */
   AZONE_REGION_SCROLL,
 };

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8821757d0dd] master: Fix region action zone not working when hidden

2019-04-28 Thread Campbell Barton
Commit: 8821757d0dd038de15ccec6df595b3496d120167
Author: Campbell Barton
Date:   Mon Apr 29 13:47:11 2019 +1000
Branches: master
https://developer.blender.org/rB8821757d0dd038de15ccec6df595b3496d120167

Fix region action zone not working when hidden

Introduced in recent fix for T61554

===

M   source/blender/editors/screen/screen_ops.c

===

diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index 8e7475ec511..7e6f1dd2e4f 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -728,7 +728,9 @@ static bool azone_clipped_rect_calc(const AZone *az, rcti 
*r_rect_clip)
   const ARegion *ar = az->ar;
   *r_rect_clip = az->rect;
   if (az->type == AZONE_REGION) {
-if (ar->overlap && (ar->v2d.keeptot != V2D_KEEPTOT_STRICT)) {
+if (ar->overlap && (ar->v2d.keeptot != V2D_KEEPTOT_STRICT) &&
+/* Only when this isn't hidden (where it's displayed as an button that 
expands). */
+((az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) == 0)) {
   /* A floating region to be resized, clip by the visible region. */
   switch (az->edge) {
 case AE_TOP_TO_BOTTOMRIGHT:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bdefce0b213] master: GTest: BLI_path_util tests

2019-04-28 Thread Campbell Barton
Commit: bdefce0b213b5b032376c58bf7bcbb0af886ded3
Author: Campbell Barton
Date:   Mon Apr 29 12:49:56 2019 +1000
Branches: master
https://developer.blender.org/rBbdefce0b213b5b032376c58bf7bcbb0af886ded3

GTest: BLI_path_util tests

Unit tests for:

- BLI_path_extension_check
- BLI_path_frame_check_chars
- BLI_path_frame_range
- BLI_path_frame_get

D4749 by @zazizizou

===

M   tests/gtests/blenlib/BLI_path_util_test.cc

===

diff --git a/tests/gtests/blenlib/BLI_path_util_test.cc 
b/tests/gtests/blenlib/BLI_path_util_test.cc
index a9ac5816380..c07ff2b0b05 100644
--- a/tests/gtests/blenlib/BLI_path_util_test.cc
+++ b/tests/gtests/blenlib/BLI_path_util_test.cc
@@ -487,3 +487,134 @@ TEST(path_util, PathFrameStrip)
   PATH_FRAME_STRIP("/ext/shorter/somefile.123001.abc", 
"/ext/shorter/somefile.##", ".abc");
 }
 #undef PATH_FRAME_STRIP
+
+#define PATH_EXTENSION_CHECK(input_path, input_ext, expect_ext) \
+  { \
+const bool ret = BLI_path_extension_check(input_path, input_ext); \
+if (strcmp(input_ext, expect_ext) == 0) { \
+  EXPECT_TRUE(ret); \
+} \
+else { \
+  EXPECT_FALSE(ret); \
+} \
+  } \
+  ((void)0)
+
+/* BLI_path_extension_check */
+TEST(path_util, PathExtensionCheck)
+{
+  PATH_EXTENSION_CHECK("a/b/c.exe", ".exe", ".exe");
+  PATH_EXTENSION_CHECK("correct/path/to/file.h", ".h", ".h");
+  PATH_EXTENSION_CHECK("correct/path/to/file.BLEND", ".BLEND", ".BLEND");
+  PATH_EXTENSION_CHECK("../tricky/path/to/file.h", ".h", ".h");
+  PATH_EXTENSION_CHECK("../dirty//../path\\to/file.h", ".h", ".h");
+  PATH_EXTENSION_CHECK("a/b/c.veryveryverylonglonglongextension",
+   ".veryveryverylonglonglongextension",
+   ".veryveryverylonglonglongextension");
+  PATH_EXTENSION_CHECK("filename.PNG", "pnG", "pnG");
+  PATH_EXTENSION_CHECK("a/b/c.h.exe", ".exe", ".exe");
+  PATH_EXTENSION_CHECK("a/b/c.h.exe", "exe", "exe");
+  PATH_EXTENSION_CHECK("a/b/c.exe", "c.exe", "c.exe");
+  PATH_EXTENSION_CHECK("a/b/noext", "noext", "noext");
+
+  PATH_EXTENSION_CHECK("a/b/c.exe", ".png", ".exe");
+  PATH_EXTENSION_CHECK("a/b/c.exe", "c.png", ".exe");
+  PATH_EXTENSION_CHECK("a/b/s.l", "l.s", "s.l");
+  PATH_EXTENSION_CHECK(".hiddenfolder", "", ".hiddenfolder");
+  PATH_EXTENSION_CHECK("../dirty//../path\\to/actual.h.file.ext", ".h", 
".ext");
+  PATH_EXTENSION_CHECK("..\\dirty//../path//to/.hiddenfile.JPEG", 
".hiddenfile", ".JPEG");
+}
+#undef PATH_EXTENSION_CHECK
+
+#define PATH_FRAME_CHECK_CHARS(input_path, expect_hasChars) \
+  { \
+const bool ret = BLI_path_frame_check_chars(input_path); \
+if (expect_hasChars) { \
+  EXPECT_TRUE(ret); \
+} \
+else { \
+  EXPECT_FALSE(ret); \
+} \
+  } \
+  ((void)0)
+
+/* BLI_path_frame_check_chars */
+TEST(path_util, PathFrameCheckChars)
+{
+  PATH_FRAME_CHECK_CHARS("a#", true);
+  PATH_FRAME_CHECK_CHARS("a#", true);
+  PATH_FRAME_CHECK_CHARS("#a", true);
+  PATH_FRAME_CHECK_CHARS("a##.###", true);
+  PATH_FRAME_CHECK_CHARS(".abc#", true);
+  PATH_FRAME_CHECK_CHARS("path/to/chars/a#", true);
+  PATH_FRAME_CHECK_CHARS("path/to/chars/123#123.exe", true);
+
+  PATH_FRAME_CHECK_CHARS("&", false);
+  PATH_FRAME_CHECK_CHARS("\35", false);
+  PATH_FRAME_CHECK_CHARS("path#/to#/chars#/$.h", false);
+  PATH_FRAME_CHECK_CHARS("path#/to#/chars#/nochars.h", false);
+  PATH_FRAME_CHECK_CHARS("..\\dirty\\path#/..//to#\\chars#/nochars.h", false);
+  PATH_FRAME_CHECK_CHARS("..\\dirty\\path#/..//to#/chars#\\nochars.h", false);
+}
+#undef PATH_FRAME_CHECK_CHARS
+
+#define PATH_FRAME_RANGE(input_path, sta, end, digits, expect_outpath) \
+  { \
+char path[FILE_MAX]; \
+bool ret; \
+BLI_strncpy(path, input_path, FILE_MAX); \
+ret = BLI_path_frame_range(path, sta, end, digits); \
+if (expect_outpath == NULL) { \
+  EXPECT_FALSE(ret); \
+} \
+else { \
+  EXPECT_TRUE(ret); \
+  EXPECT_STREQ(path, expect_outpath); \
+} \
+  } \
+  ((void)0)
+
+/* BLI_path_frame_range */
+TEST(path_util, PathFrameRange)
+{
+  int dummy = -1;
+  PATH_FRAME_RANGE("#", 1, 2, dummy, "1-2");
+  PATH_FRAME_RANGE("##", 1, 2, dummy, "01-02");
+  PATH_FRAME_RANGE("##", 1000, 2000, dummy, "1000-2000");
+  PATH_FRAME_RANGE("###", 100, 200, dummy, "100-200");
+  PATH_FRAME_RANGE("###", 8, 9, dummy, "008-009");
+
+  PATH_FRAME_RANGE("", 100, 200, 1, "100-200");
+  PATH_FRAME_RANGE("", 123, 321, 4, "0123-0321");
+  PATH_FRAME_RANGE("", 1, 0, 20, "0001-");
+}
+#undef PATH_FRAME_RANGE
+
+#define PATH_FRAME_GET(input_path, expect_frame, expect_numdigits, 
expect_pathisvalid) \
+  { \
+char path[FILE_MAX]; \
+int out_frame = -1, out_numdigits = -1; \
+BLI_strncpy(path, input_path, FILE_MAX); \
+const bool ret = BLI_path_frame_get(path, _frame, _numdigits); \
+if (expect_pathisvalid) { \
+  EXPECT_TRUE(ret); \
+  

[Bf-blender-cvs] [8b11b8b3cf4] master: Fix shift-click to select multiple reports

2019-04-28 Thread Campbell Barton
Commit: 8b11b8b3cf470c4610a2de9a9deee0b81516727b
Author: Campbell Barton
Date:   Mon Apr 29 12:56:45 2019 +1000
Branches: master
https://developer.blender.org/rB8b11b8b3cf470c4610a2de9a9deee0b81516727b

Fix shift-click to select multiple reports

D4751 by @Poulpator

===

M   source/blender/editors/space_info/info_report.c

===

diff --git a/source/blender/editors/space_info/info_report.c 
b/source/blender/editors/space_info/info_report.c
index f7499313a4a..4c00512d838 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -194,9 +194,11 @@ void INFO_OT_select_pick(wmOperatorType *ot)
   /* ot->flag = OPTYPE_REGISTER; */
 
   /* properties */
+  PropertyRNA *prop;
   RNA_def_int(
   ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the 
report", 0, INT_MAX);
-  RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend report 
selection");
+  prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend report 
selection");
+  RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 static int report_select_all_exec(bContext *C, wmOperator *op)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f2acf3bab68] master: Cleanup: use 'use_' prefix for RNA booleans

2019-04-28 Thread Campbell Barton
Commit: f2acf3bab68ab44396599d7998d34a2c4c3946e4
Author: Campbell Barton
Date:   Mon Apr 29 11:26:17 2019 +1000
Branches: master
https://developer.blender.org/rBf2acf3bab68ab44396599d7998d34a2c4c3946e4

Cleanup: use 'use_' prefix for RNA booleans

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/makesrna/intern/rna_sequencer.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index bd3eb2bc304..bc21daa2043 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1177,10 +1177,10 @@ class 
SEQUENCER_PT_cache_settings(SequencerButtonsPanel, Panel):
 layout = self.layout
 ed = context.scene.sequence_editor
 
-layout.prop(ed, "cache_raw")
-layout.prop(ed, "cache_preprocessed")
-layout.prop(ed, "cache_composite")
-layout.prop(ed, "cache_final")
+layout.prop(ed, "use_cache_raw")
+layout.prop(ed, "use_cache_preprocessed")
+layout.prop(ed, "use_cache_composite")
+layout.prop(ed, "use_cache_final")
 layout.separator()
 layout.prop(ed, "recycle_max_cost")
 
@@ -1285,9 +1285,9 @@ class SEQUENCER_PT_strip_cache(SequencerButtonsPanel, 
Panel):
 strip = act_strip(context)
 layout.active = strip.override_cache_settings
 
-layout.prop(strip, "cache_raw")
-layout.prop(strip, "cache_preprocessed")
-layout.prop(strip, "cache_composite")
+layout.prop(strip, "use_cache_raw")
+layout.prop(strip, "use_cache_preprocessed")
+layout.prop(strip, "use_cache_composite")
 
 
 class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
diff --git a/source/blender/makesrna/intern/rna_sequencer.c 
b/source/blender/makesrna/intern/rna_sequencer.c
index 7daf4474eb6..0b1e35e3a74 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1726,21 +1726,21 @@ static void rna_def_sequence(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting this 
strip");
   rna_def_sequence_modifiers(brna, prop);
 
-  prop = RNA_def_property(srna, "cache_raw", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_cache_raw", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_RAW);
   RNA_def_property_ui_text(prop,
"Cache Raw",
"Cache raw images read from disk, for faster 
tweaking of strip "
"parameters at the cost of memory usage");
 
-  prop = RNA_def_property(srna, "cache_preprocessed", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_cache_preprocessed", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", 
SEQ_CACHE_STORE_PREPROCESSED);
   RNA_def_property_ui_text(
   prop,
   "Cache Rreprocessed",
   "Cache preprocessed images, for faster tweaking of effects at the cost 
of memory usage");
 
-  prop = RNA_def_property(srna, "cache_composite", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_cache_composite", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", 
SEQ_CACHE_STORE_COMPOSITE);
   RNA_def_property_ui_text(prop,
"Cache Composite",
@@ -1862,28 +1862,28 @@ static void rna_def_editor(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Composite Images", "Visualize cached 
composite images");
   RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
 
-  prop = RNA_def_property(srna, "cache_raw", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_cache_raw", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_RAW);
   RNA_def_property_ui_text(prop,
"Cache Raw",
"Cache raw images read from disk, for faster 
tweaking of strip "
"parameters at the cost of memory usage");
 
-  prop = RNA_def_property(srna, "cache_preprocessed", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_cache_preprocessed", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", 
SEQ_CACHE_STORE_PREPROCESSED);
   RNA_def_property_ui_text(
   prop,
   "Cache Preprocessed",
   "Cache preprocessed images, for faster tweaking of effects at the cost 
of memory usage");
 
-  prop = RNA_def_property(srna, "cache_composite", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_cache_composite", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", 
SEQ_CACHE_STORE_COMPOSITE);
   RNA_def_property_ui_text(prop,

[Bf-blender-cvs] [b66ecaf40cb] sculpt-mode-features: Fix crash on mesh filters

2019-04-28 Thread Pablo Dobarro
Commit: b66ecaf40cb867c3ba344fc6becb8a3e40b0a13b
Author: Pablo Dobarro
Date:   Mon Apr 29 03:48:34 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rBb66ecaf40cb867c3ba344fc6becb8a3e40b0a13b

Fix crash on mesh filters

===

M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 8f6e1f3af41..03e65635e07 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -7476,7 +7476,6 @@ int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
   }
 
   BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, mode == 
MESH_FILTER_SMOOTH, true);
-  sculpt_restore_mesh(sd, ob);
   if (BKE_pbvh_type(pbvh) == PBVH_FACES && mode == MESH_FILTER_SMOOTH && 
!ob->sculpt->pmap) {
 ss->use_orco = false;
 return OPERATOR_CANCELLED;
@@ -7494,6 +7493,8 @@ int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
 sculpt_undo_push_begin("mesh filter fill");
   }
 
+  paint_mesh_restore_co(sd, ob);
+
   float len = event->prevclickx - event->mval[0];
   filter_strength = filter_strength * -len * 0.001f;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [337cac760ba] master: VSE: Cache rewrite

2019-04-28 Thread Richard Antalik
Commit: 337cac760ba9d198fc45459f4274a94a87558528
Author: Richard Antalik
Date:   Sun Apr 28 14:13:41 2019 -0700
Branches: master
https://developer.blender.org/rB337cac760ba9d198fc45459f4274a94a87558528

VSE: Cache rewrite

This patch implements new cache system.
Aim is to give user more control over cache, so it can be maximally
utilized. This is done through sequencer timeline side panel
in category proxy & cache.
Cached images are also visualized in timeline, controled by
sequencer timeline view->cache menu

Functional changes:
 - NOT use IMB_moviecache API
 - refactor names of cached image types
 - each scene owns 1 sequencer cache
 - merge preprocess cache into per-sequencer cache
 - cache links images rendered per frame in order as they are created
 - add cache content visualization tool
 - add RNA properties to control the cache

More info can be found in design notes in blenkernel/intern/seqcache.c
and in https://developer.blender.org/D4443

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D4443

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/BKE_sequencer.h
M   source/blender/blenkernel/intern/blender.c
M   source/blender/blenkernel/intern/seqcache.c
M   source/blender/blenkernel/intern/sequencer.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/editors/transform/transform_generics.c
M   source/blender/imbuf/IMB_imbuf.h
M   source/blender/imbuf/intern/allocimbuf.c
M   source/blender/imbuf/intern/moviecache.c
M   source/blender/makesdna/DNA_sequence_types.h
M   source/blender/makesrna/intern/rna_camera.c
M   source/blender/makesrna/intern/rna_color.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/makesrna/intern/rna_sequencer.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 87ebf365a1e..bd3eb2bc304 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -159,6 +159,25 @@ class SEQUENCER_MT_view_toggle(Menu):
 layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW'
 
 
+class SEQUENCER_MT_view_cache(Menu):
+bl_label = "Cache"
+
+def draw(self, context):
+layout = self.layout
+
+ed = context.scene.sequence_editor
+layout.prop(ed, "show_cache")
+layout.separator()
+
+col = layout.column()
+col.enabled = ed.show_cache
+
+col.prop(ed, "show_cache_final_out")
+col.prop(ed, "show_cache_raw")
+col.prop(ed, "show_cache_preprocessed")
+col.prop(ed, "show_cache_composite")
+
+
 class SEQUENCER_MT_view(Menu):
 bl_label = "View"
 
@@ -212,6 +231,7 @@ class SEQUENCER_MT_view(Menu):
 layout.prop(st, "show_frame_indicator")
 layout.prop(st, "show_strip_offset")
 layout.prop(st, "show_marker_lines")
+layout.menu("SEQUENCER_MT_view_cache")
 
 layout.prop_menu_enum(st, "waveform_display_type")
 
@@ -1145,9 +1165,29 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
 layout.prop(strip, "use_float", text="Convert to Float")
 
 
+class SEQUENCER_PT_cache_settings(SequencerButtonsPanel, Panel):
+bl_label = "Cache Settings"
+bl_category = "Proxy & Cache"
+
+@classmethod
+def poll(cls, context):
+return cls.has_sequencer(context)
+
+def draw(self, context):
+layout = self.layout
+ed = context.scene.sequence_editor
+
+layout.prop(ed, "cache_raw")
+layout.prop(ed, "cache_preprocessed")
+layout.prop(ed, "cache_composite")
+layout.prop(ed, "cache_final")
+layout.separator()
+layout.prop(ed, "recycle_max_cost")
+
+
 class SEQUENCER_PT_proxy_settings(SequencerButtonsPanel, Panel):
-bl_label = "Proxy settings"
-bl_category = "Proxy"
+bl_label = "Proxy Settings"
+bl_category = "Proxy & Cache"
 @classmethod
 def poll(cls, context):
 return cls.has_sequencer(context)
@@ -1168,8 +1208,8 @@ class SEQUENCER_PT_proxy_settings(SequencerButtonsPanel, 
Panel):
 
 
 class SEQUENCER_PT_strip_proxy(SequencerButtonsPanel, Panel):
-bl_label = "Strip Proxy/Timecode"
-bl_category = "Proxy"
+bl_label = "Strip Proxy & Timecode"
+bl_category = "Proxy & Cache"
 
 @classmethod
 def poll(cls, context):
@@ -1225,8 +1265,33 @@ class SEQUENCER_PT_strip_proxy(SequencerButtonsPanel, 
Panel):

[Bf-blender-cvs] [1aa827d496a] functions: extract method that ensures required inputs

2019-04-28 Thread Jacques Lucke
Commit: 1aa827d496a6542589badf484065e15e7deb5bf8
Author: Jacques Lucke
Date:   Sun Apr 28 19:23:59 2019 +0200
Branches: functions
https://developer.blender.org/rB1aa827d496a6542589badf484065e15e7deb5bf8

extract method that ensures required inputs

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 3bfaeb13215..e1ef711d0c4 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -297,16 +297,8 @@ class ExecuteFGraph : public TupleCallBody {
 LazyInTupleCallBody *body = (LazyInTupleCallBody 
*)m_node_info[node_id].body;
 
 if (lazy_states.empty() || lazy_states.peek().node_id != node_id) {
-
-  bool required_inputs_computed = true;
-
-  for (uint input_index : body->always_required()) {
-uint input_id = m_graph->id_of_node_input(node_id, 
input_index);
-if (!storage.is_input_initialized(input_id)) {
-  sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-  required_inputs_computed = false;
-}
-  }
+  bool required_inputs_computed = this->ensure_required_inputs(
+  body, node_id, storage, sockets_to_compute);
 
   if (required_inputs_computed) {
 void *user_data = alloca(body->user_data_size());
@@ -381,6 +373,22 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
 
+  bool ensure_required_inputs(LazyInTupleCallBody *body,
+  uint node_id,
+  SocketValueStorage ,
+  SocketsToComputeStack _to_compute) const
+  {
+bool required_inputs_computed = true;
+for (uint input_index : body->always_required()) {
+  uint input_id = m_graph->id_of_node_input(node_id, input_index);
+  if (!storage.is_input_initialized(input_id)) {
+sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
+required_inputs_computed = false;
+  }
+}
+return required_inputs_computed;
+  }
+
   void push_requested_inputs_to_stack(LazyState ,
   uint node_id,
   SocketValueStorage ,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8f70d4986e2] functions: splitup forwarding function

2019-04-28 Thread Jacques Lucke
Commit: 8f70d4986e2468105ec41c9706c13609d1b32ef9
Author: Jacques Lucke
Date:   Sun Apr 28 21:15:43 2019 +0200
Branches: functions
https://developer.blender.org/rB8f70d4986e2468105ec41c9706c13609d1b32ef9

splitup forwarding function

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index b4e3d6b8e2e..70d384a8b9f 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -440,47 +440,96 @@ class ExecuteFGraph : public TupleCallBody {
 
 SocketInfo _info = m_output_info[output_id];
 CPPTypeInfo *type_info = output_info.type;
-void *value_src = storage.output_value_ptr(output_id);
 
 uint *target_ids = BLI_array_alloca(target_ids, 
possible_target_ids.size());
+uint target_amount = this->filter_uninitialized_targets(
+possible_target_ids, storage, target_ids);
+
+this->forward_output_to_targets(output_id, target_ids, target_amount, 
type_info, storage);
+this->copy_targets_to_final_output_if_necessary(target_ids, target_amount, 
storage, fn_out);
+  }
+
+  uint filter_uninitialized_targets(ArrayRef _target_ids,
+SocketValueStorage ,
+uint *r_target_ids) const
+  {
 uint target_amount = 0;
 for (uint possible_target_id : possible_target_ids) {
   if (!storage.is_input_initialized(possible_target_id)) {
-target_ids[target_amount] = possible_target_id;
+r_target_ids[target_amount] = possible_target_id;
 target_amount++;
   }
 }
+return target_amount;
+  }
 
+  void forward_output_to_targets(uint output_id,
+ uint *target_ids,
+ uint target_amount,
+ CPPTypeInfo *type_info,
+ SocketValueStorage ) const
+  {
 if (target_amount == 0) {
-  type_info->destruct_type(value_src);
-  storage.set_output_initialized(output_id, false);
+  this->destruct_output(output_id, type_info, storage);
 }
 else if (target_amount == 1) {
-  uint target_id = target_ids[0];
-  void *value_dst = storage.input_value_ptr(target_id);
-  type_info->relocate_to_uninitialized(value_src, value_dst);
-  storage.set_output_initialized(output_id, false);
-  storage.set_input_initialized(target_id, true);
+  this->relocate_output_to_input(output_id, target_ids[0], type_info, 
storage);
 }
 else {
-  for (uint i = 1; i < target_amount; i++) {
-uint target_id = target_ids[i];
-void *value_dst = storage.input_value_ptr(target_id);
-type_info->copy_to_uninitialized(value_src, value_dst);
-storage.set_input_initialized(target_id, true);
-  }
+  this->forward_output_to_multiple_inputs(
+  output_id, target_ids, target_amount, type_info, storage);
+}
+  }
+
+  void destruct_output(uint output_id, CPPTypeInfo *type_info, 
SocketValueStorage ) const
+  {
+void *value_ptr = storage.output_value_ptr(output_id);
+type_info->destruct_type(value_ptr);
+storage.set_output_initialized(output_id, false);
+  }
+
+  void relocate_output_to_input(uint output_id,
+uint target_id,
+CPPTypeInfo *type_info,
+SocketValueStorage ) const
+  {
+void *value_src = storage.output_value_ptr(output_id);
+void *value_dst = storage.input_value_ptr(target_id);
+type_info->relocate_to_uninitialized(value_src, value_dst);
+storage.set_output_initialized(output_id, false);
+storage.set_input_initialized(target_id, true);
+  }
+
+  void forward_output_to_multiple_inputs(uint output_id,
+ uint *target_ids,
+ uint target_amount,
+ CPPTypeInfo *type_info,
+ SocketValueStorage ) const
+  {
+void *value_src = storage.output_value_ptr(output_id);
 
-  uint target_id = target_ids[0];
+for (uint i = 1; i < target_amount; i++) {
+  uint target_id = target_ids[i];
   void *value_dst = storage.input_value_ptr(target_id);
   type_info->copy_to_uninitialized(value_src, value_dst);
-  storage.set_output_initialized(output_id, false);
   storage.set_input_initialized(target_id, true);
 }
 
+uint target_id = target_ids[0];
+void *value_dst = storage.input_value_ptr(target_id);
+type_info->copy_to_uninitialized(value_src, value_dst);
+storage.set_output_initialized(output_id, 

[Bf-blender-cvs] [b287de4e68a] functions: deduplicate stack setup code

2019-04-28 Thread Jacques Lucke
Commit: b287de4e68a259fc69d72f02024738e61153d55f
Author: Jacques Lucke
Date:   Sun Apr 28 19:20:24 2019 +0200
Branches: functions
https://developer.blender.org/rBb287de4e68a259fc69d72f02024738e61153d55f

deduplicate stack setup code

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M   source/blender/functions/backends/tuple_call/tuple_call.hpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 5bbe7a9f444..3bfaeb13215 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -315,10 +315,8 @@ class ExecuteFGraph : public TupleCallBody {
 
 SETUP_SUB_TUPLES(node_id, body, body_in, body_out);
 
-SourceInfoStackFrame 
frame(m_graph->source_info_of_node(node_id));
-ctx.stack().push();
-body->call(body_in, body_out, ctx, state);
-ctx.stack().pop();
+SourceInfo *source_info = 
m_graph->source_info_of_node(node_id);
+body->call__setup_stack(body_in, body_out, ctx, state, 
source_info);
 
 if (state.is_done()) {
   this->destruct_remaining_node_inputs(node_id, storage);
@@ -338,10 +336,8 @@ class ExecuteFGraph : public TupleCallBody {
 
   SETUP_SUB_TUPLES(node_id, body, body_in, body_out);
 
-  SourceInfoStackFrame 
frame(m_graph->source_info_of_node(node_id));
-  ctx.stack().push();
-  body->call(body_in, body_out, ctx, state);
-  ctx.stack().pop();
+  SourceInfo *source_info = m_graph->source_info_of_node(node_id);
+  body->call__setup_stack(body_in, body_out, ctx, state, 
source_info);
 
   if (state.is_done()) {
 this->destruct_remaining_node_inputs(node_id, storage);
diff --git a/source/blender/functions/backends/tuple_call/tuple_call.hpp 
b/source/blender/functions/backends/tuple_call/tuple_call.hpp
index 0fb383e0f90..50c43cf7501 100644
--- a/source/blender/functions/backends/tuple_call/tuple_call.hpp
+++ b/source/blender/functions/backends/tuple_call/tuple_call.hpp
@@ -129,6 +129,38 @@ class LazyInTupleCallBody : public TupleCallBodyBase {
 Tuple _out,
 ExecutionContext ,
 LazyState ) const = 0;
+
+  inline void call__setup_stack(Tuple _in,
+Tuple _out,
+ExecutionContext ,
+LazyState ) const
+  {
+TextStackFrame frame(this->owner()->name().c_str());
+ctx.stack().push();
+this->call(fn_in, fn_out, ctx, state);
+ctx.stack().pop();
+  }
+
+  inline void call__setup_stack(Tuple _in,
+Tuple _out,
+ExecutionContext ,
+LazyState ,
+StackFrame _frame) const
+  {
+ctx.stack().push(_frame);
+this->call__setup_stack(fn_in, fn_out, ctx, state);
+ctx.stack().pop();
+  }
+
+  inline void call__setup_stack(Tuple _in,
+Tuple _out,
+ExecutionContext ,
+LazyState ,
+SourceInfo *source_info) const
+  {
+SourceInfoStackFrame frame(source_info);
+this->call__setup_stack(fn_in, fn_out, ctx, state, frame);
+  }
 };
 
 } /* namespace FN */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [26ce24b9283] functions: better type names

2019-04-28 Thread Jacques Lucke
Commit: 26ce24b92837ab13bb0455267e6152bd65fe5b22
Author: Jacques Lucke
Date:   Sun Apr 28 19:12:26 2019 +0200
Branches: functions
https://developer.blender.org/rB26ce24b92837ab13bb0455267e6152bd65fe5b22

better type names

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index cfdf627d0e2..d10f5d7235e 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -233,11 +233,11 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
 
-  struct LazyStateOnStack {
+  struct LazyStateOfNode {
 uint node_id;
 LazyState state;
 
-LazyStateOnStack(uint node_id, LazyState state) : node_id(node_id), 
state(state)
+LazyStateOfNode(uint node_id, LazyState state) : node_id(node_id), 
state(state)
 {
 }
   };
@@ -254,12 +254,15 @@ class ExecuteFGraph : public TupleCallBody {
  true, \
  false);
 
+  using SocketsToComputeStack = SmallStack;
+  using LazyStatesStack = SmallStack;
+
   void evaluate_graph_to_compute_outputs(SocketValueStorage ,
  Tuple _out,
  ExecutionContext ) const
   {
-SmallStack sockets_to_compute;
-SmallStack lazy_states;
+SocketsToComputeStack sockets_to_compute;
+LazyStatesStack lazy_states;
 
 for (auto socket : m_fgraph.outputs()) {
   sockets_to_compute.push(socket);
@@ -329,7 +332,7 @@ class ExecuteFGraph : public TupleCallBody {
   
sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
 }
   }
-  lazy_states.push(LazyStateOnStack(node_id, state));
+  lazy_states.push(LazyStateOfNode(node_id, state));
 }
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f16e64435fc] functions: deduplicate some code

2019-04-28 Thread Jacques Lucke
Commit: f16e64435fcee4e48f0824152768744297ee2284
Author: Jacques Lucke
Date:   Sun Apr 28 19:15:57 2019 +0200
Branches: functions
https://developer.blender.org/rBf16e64435fcee4e48f0824152768744297ee2284

deduplicate some code

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index d10f5d7235e..5bbe7a9f444 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -326,12 +326,8 @@ class ExecuteFGraph : public TupleCallBody {
   sockets_to_compute.pop();
 }
 else {
-  for (uint requested_input_index : state.requested_inputs()) {
-uint input_id = m_graph->id_of_node_input(node_id, 
requested_input_index);
-if (!storage.is_input_initialized(input_id)) {
-  
sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-}
-  }
+  this->push_requested_inputs_to_stack(
+  state, node_id, storage, sockets_to_compute);
   lazy_states.push(LazyStateOfNode(node_id, state));
 }
   }
@@ -354,12 +350,7 @@ class ExecuteFGraph : public TupleCallBody {
 lazy_states.pop();
   }
   else {
-for (uint requested_input_index : state.requested_inputs()) {
-  uint input_id = m_graph->id_of_node_input(node_id, 
requested_input_index);
-  if (!storage.is_input_initialized(input_id)) {
-
sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-  }
-}
+this->push_requested_inputs_to_stack(state, node_id, storage, 
sockets_to_compute);
   }
 }
   }
@@ -394,6 +385,19 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
 
+  void push_requested_inputs_to_stack(LazyState ,
+  uint node_id,
+  SocketValueStorage ,
+  SocketsToComputeStack 
_to_compute) const
+  {
+for (uint requested_input_index : state.requested_inputs()) {
+  uint input_id = m_graph->id_of_node_input(node_id, 
requested_input_index);
+  if (!storage.is_input_initialized(input_id)) {
+sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
+  }
+}
+  }
+
   void copy_outputs_to_final_output_if_necessary(uint node_id,
  SocketValueStorage ,
  Tuple _out) const

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6c1e5d7f349] functions: extract method that ensure all inputs

2019-04-28 Thread Jacques Lucke
Commit: 6c1e5d7f3493c442f1caf1d406c85a3224e0e4d2
Author: Jacques Lucke
Date:   Sun Apr 28 19:30:39 2019 +0200
Branches: functions
https://developer.blender.org/rB6c1e5d7f3493c442f1caf1d406c85a3224e0e4d2

extract method that ensure all inputs

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index e1ef711d0c4..b4e3d6b8e2e 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -343,14 +343,8 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
   else {
-bool all_inputs_computed = true;
-
-for (uint input_id : m_graph->input_ids_of_node(node_id)) {
-  if (!storage.is_input_initialized(input_id)) {
-sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-all_inputs_computed = false;
-  }
-}
+bool all_inputs_computed = this->ensure_all_inputs(
+node_id, storage, sockets_to_compute);
 
 if (all_inputs_computed) {
   BLI_assert(!m_node_info[node_id].is_lazy);
@@ -402,6 +396,20 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
 
+  bool ensure_all_inputs(uint node_id,
+ SocketValueStorage ,
+ SocketsToComputeStack _to_compute) const
+  {
+bool all_inputs_computed = true;
+for (uint input_id : m_graph->input_ids_of_node(node_id)) {
+  if (!storage.is_input_initialized(input_id)) {
+sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
+all_inputs_computed = false;
+  }
+}
+return all_inputs_computed;
+  }
+
   void copy_outputs_to_final_output_if_necessary(uint node_id,
  SocketValueStorage ,
  Tuple _out) const

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1b65ec0a9b9] master: GPencil: Cleanup - Rename annotation drawing function names

2019-04-28 Thread Antonioya
Commit: 1b65ec0a9b9be2aef7db88be3c6deaaa135ab382
Author: Antonioya
Date:   Sun Apr 28 20:14:20 2019 +0200
Branches: master
https://developer.blender.org/rB1b65ec0a9b9be2aef7db88be3c6deaaa135ab382

GPencil: Cleanup - Rename annotation drawing function names

Actually, the static functions had the same name used for grease pencil.

Now, the annotation functions have a different prefix.

===

M   source/blender/editors/gpencil/annotate_draw.c

===

diff --git a/source/blender/editors/gpencil/annotate_draw.c 
b/source/blender/editors/gpencil/annotate_draw.c
index 84dc29afab3..9cd1cf91476 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -91,12 +91,12 @@ typedef enum eDrawStrokeFlags {
 /* - Tool Buffer Drawing -- */
 
 /* draw stroke defined in buffer (simple ogl lines/points for now, as dotted 
lines) */
-static void gp_draw_stroke_buffer(const tGPspoint *points,
-  int totpoints,
-  short thickness,
-  short dflag,
-  short sflag,
-  float ink[4])
+static void annotation_draw_stroke_buffer(const tGPspoint *points,
+  int totpoints,
+  short thickness,
+  short dflag,
+  short sflag,
+  float ink[4])
 {
   int draw_points = 0;
 
@@ -181,7 +181,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points,
 
 /* - 2D Stroke Drawing Helpers - */
 /* change in parameter list */
-static void gp_calc_2d_stroke_fxy(
+static void annotation_calc_2d_stroke_fxy(
 const float pt[3], short sflag, int offsx, int offsy, int winx, int winy, 
float r_co[2])
 {
   if (sflag & GP_STROKE_2DSPACE) {
@@ -207,15 +207,15 @@ static void gp_calc_2d_stroke_fxy(
 /* - Existing Strokes Drawing (3D and Point) -- */
 
 /* draw a given stroke - just a single dot (only one point) */
-static void gp_draw_stroke_point(const bGPDspoint *points,
- short thickness,
- short UNUSED(dflag),
- short sflag,
- int offsx,
- int offsy,
- int winx,
- int winy,
- const float ink[4])
+static void annotation_draw_stroke_point(const bGPDspoint *points,
+ short thickness,
+ short UNUSED(dflag),
+ short sflag,
+ int offsx,
+ int offsy,
+ int winx,
+ int winy,
+ const float ink[4])
 {
   const bGPDspoint *pt = points;
 
@@ -234,7 +234,7 @@ static void gp_draw_stroke_point(const bGPDspoint *points,
 
 /* get 2D coordinates of point */
 float co[3] = {0.0f};
-gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, co);
+annotation_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, co);
 copy_v3_v3(fpt, co);
   }
 
@@ -252,12 +252,12 @@ static void gp_draw_stroke_point(const bGPDspoint *points,
 }
 
 /* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */
-static void gp_draw_stroke_3d(const bGPDspoint *points,
-  int totpoints,
-  short thickness,
-  short UNUSED(sflag),
-  const float ink[4],
-  bool cyclic)
+static void annotation_draw_stroke_3d(const bGPDspoint *points,
+  int totpoints,
+  short thickness,
+  short UNUSED(sflag),
+  const float ink[4],
+  bool cyclic)
 {
   float curpressure = points[0].pressure;
   float cyclic_fpt[3];
@@ -336,16 +336,16 @@ static void gp_draw_stroke_3d(const bGPDspoint *points,
 /* - Fancy 2D-Stroke Drawing -- */
 
 /* draw a given stroke in 2d */
-static void gp_draw_stroke_2d(const bGPDspoint *points,
-  int totpoints,
-  short thickness_s,
-  short dflag,
-  short sflag,
-  int offsx,
-  int offsy,
-  int 

[Bf-blender-cvs] [049d66aa80e] functions: initial support for lazy inputs in new fgraph evaluation

2019-04-28 Thread Jacques Lucke
Commit: 049d66aa80e5276e545d013ab366f1f5cdb05516
Author: Jacques Lucke
Date:   Sun Apr 28 18:25:29 2019 +0200
Branches: functions
https://developer.blender.org/rB049d66aa80e5276e545d013ab366f1f5cdb05516

initial support for lazy inputs in new fgraph evaluation

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M   source/blender/functions/core/data_flow_graph.hpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 7e9f6af2630..c5b3b6f57d1 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -29,24 +29,14 @@ class ExecuteFGraph : public TupleCallBody {
   DataFlowGraph *m_graph;
 
   struct NodeInfo {
-union {
-  TupleCallBody *direct;
-  LazyInTupleCallBody *lazy;
-} body;
+TupleCallBodyBase *body;
 uint input_start;
 uint output_start;
 bool is_lazy;
 
-NodeInfo(TupleCallBody *body, uint input_start, uint output_start)
-: input_start(input_start), output_start(output_start), is_lazy(false)
+NodeInfo(TupleCallBodyBase *body, bool is_lazy, uint input_start, uint 
output_start)
+: body(body), input_start(input_start), output_start(output_start), 
is_lazy(is_lazy)
 {
-  this->body.direct = body;
-}
-
-NodeInfo(LazyInTupleCallBody *body, uint input_start, uint output_start)
-: input_start(input_start), output_start(output_start), is_lazy(true)
-{
-  this->body.lazy = body;
 }
   };
 
@@ -76,8 +66,20 @@ class ExecuteFGraph : public TupleCallBody {
   {
 for (uint node_id : m_graph->node_ids()) {
   SharedFunction  = m_graph->function_of_node(node_id);
-  TupleCallBody *body = fn->body();
-  m_node_info.append(NodeInfo(body, m_inputs_buffer_size, 
m_outputs_buffer_size));
+
+  TupleCallBodyBase *body;
+  bool is_lazy_body;
+  if (fn->has_body()) {
+body = fn->body();
+is_lazy_body = true;
+  }
+  else {
+body = fn->body();
+is_lazy_body = false;
+  }
+
+  m_node_info.append(
+  NodeInfo(body, is_lazy_body, m_inputs_buffer_size, 
m_outputs_buffer_size));
 
   m_inputs_init_buffer_size += fn->signature().inputs().size();
   m_outputs_init_buffer_size += fn->signature().outputs().size();
@@ -231,11 +233,21 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
 
+  struct LazyStateOnStack {
+uint node_id;
+LazyState state;
+
+LazyStateOnStack(uint node_id, LazyState state) : node_id(node_id), 
state(state)
+{
+}
+  };
+
   void evaluate_graph_to_compute_outputs(SocketValueStorage ,
  Tuple _out,
  ExecutionContext ) const
   {
 SmallStack sockets_to_compute;
+SmallStack lazy_states;
 
 for (auto socket : m_fgraph.outputs()) {
   sockets_to_compute.push(socket);
@@ -264,44 +276,134 @@ class ExecuteFGraph : public TupleCallBody {
   sockets_to_compute.pop();
 }
 else {
-  bool all_inputs_computed = true;
   uint node_id = m_graph->node_id_of_output(socket.id());
 
-  for (uint input_id : m_graph->input_ids_of_node(node_id)) {
-if (!storage.is_input_initialized(input_id)) {
-  sockets_to_compute.push(DFGraphSocket::FromInput(input_id));
-  all_inputs_computed = false;
-}
-  }
-
-  if (all_inputs_computed) {
-BLI_assert(!m_node_info[node_id].is_lazy);
-TupleCallBody *body = m_node_info[node_id].body.direct;
-BLI_assert(body);
+  if (m_node_info[node_id].is_lazy) {
+LazyInTupleCallBody *body = (LazyInTupleCallBody 
*)m_node_info[node_id].body;
 
 Tuple body_in(body->meta_in(),
   storage.node_input_values_ptr(node_id),
   storage.node_input_inits_ptr(node_id),
   true,
-  true);
+  false);
 Tuple body_out(body->meta_out(),
storage.node_output_values_ptr(node_id),
storage.node_output_inits_ptr(node_id),
true,
false);
 
-SourceInfoStackFrame frame(m_graph->source_info_of_node(node_id));
-body->call__setup_stack(body_in, body_out, ctx, frame);
-BLI_assert(body_out.all_initialized());
+if (lazy_states.empty() || lazy_states.peek().node_id != node_id) {
+
+  bool required_inputs_computed = true;
+
+  for (uint input_index : body->always_required()) {
+

[Bf-blender-cvs] [64210d66827] functions: simplify stack info setup

2019-04-28 Thread Jacques Lucke
Commit: 64210d6682756c4f16a67bfeee59f0867d390fbc
Author: Jacques Lucke
Date:   Sun Apr 28 18:33:36 2019 +0200
Branches: functions
https://developer.blender.org/rB64210d6682756c4f16a67bfeee59f0867d390fbc

simplify stack info setup

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M   source/blender/functions/backends/tuple_call/tuple_call.hpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index c5b3b6f57d1..7e135762286 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -391,8 +391,8 @@ class ExecuteFGraph : public TupleCallBody {
  true,
  false);
 
-  SourceInfoStackFrame 
frame(m_graph->source_info_of_node(node_id));
-  body->call__setup_stack(body_in, body_out, ctx, frame);
+  SourceInfo *source_info = m_graph->source_info_of_node(node_id);
+  body->call__setup_stack(body_in, body_out, ctx, source_info);
   BLI_assert(body_out.all_initialized());
 
   for (uint output_id : m_graph->output_ids_of_node(node_id)) {
diff --git a/source/blender/functions/backends/tuple_call/tuple_call.hpp 
b/source/blender/functions/backends/tuple_call/tuple_call.hpp
index 38d68772e5f..0fb383e0f90 100644
--- a/source/blender/functions/backends/tuple_call/tuple_call.hpp
+++ b/source/blender/functions/backends/tuple_call/tuple_call.hpp
@@ -51,6 +51,15 @@ class TupleCallBody : public TupleCallBodyBase {
 ctx.stack().pop();
   }
 
+  inline void call__setup_stack(Tuple _in,
+Tuple _out,
+ExecutionContext ,
+SourceInfo *source_info) const
+  {
+SourceInfoStackFrame frame(source_info);
+this->call__setup_stack(fn_in, fn_out, ctx, frame);
+  }
+
   inline void call__setup_execution_context(Tuple _in, Tuple _out) const
   {
 ExecutionStack stack;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e80d9a53916] functions: destruct unused values as early as possible

2019-04-28 Thread Jacques Lucke
Commit: e80d9a53916991ec488325f59bff9d4244afe355
Author: Jacques Lucke
Date:   Sun Apr 28 18:56:16 2019 +0200
Branches: functions
https://developer.blender.org/rBe80d9a53916991ec488325f59bff9d4244afe355

destruct unused values as early as possible

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 1830514ba22..cfdf627d0e2 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -318,6 +318,7 @@ class ExecuteFGraph : public TupleCallBody {
 ctx.stack().pop();
 
 if (state.is_done()) {
+  this->destruct_remaining_node_inputs(node_id, storage);
   this->copy_outputs_to_final_output_if_necessary(node_id, 
storage, fn_out);
   sockets_to_compute.pop();
 }
@@ -344,11 +345,10 @@ class ExecuteFGraph : public TupleCallBody {
   ctx.stack().pop();
 
   if (state.is_done()) {
+this->destruct_remaining_node_inputs(node_id, storage);
 this->copy_outputs_to_final_output_if_necessary(node_id, 
storage, fn_out);
 sockets_to_compute.pop();
 lazy_states.pop();
-
-// TODO: destruct inputs
   }
   else {
 for (uint requested_input_index : state.requested_inputs()) {
@@ -381,6 +381,7 @@ class ExecuteFGraph : public TupleCallBody {
   body->call__setup_stack(body_in, body_out, ctx, source_info);
   BLI_assert(body_out.all_initialized());
 
+  this->destruct_remaining_node_inputs(node_id, storage);
   this->copy_outputs_to_final_output_if_necessary(node_id, 
storage, fn_out);
   sockets_to_compute.pop();
 }
@@ -402,6 +403,17 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
 
+  void destruct_remaining_node_inputs(uint node_id, SocketValueStorage 
) const
+  {
+for (uint input_id : m_graph->input_ids_of_node(node_id)) {
+  if (storage.is_input_initialized(input_id)) {
+CPPTypeInfo *type_info = m_input_info[input_id].type;
+type_info->destruct_type(storage.input_value_ptr(input_id));
+storage.set_input_initialized(input_id, false);
+  }
+}
+  }
+
   void forward_output(uint output_id, SocketValueStorage , Tuple 
_out) const
   {
 BLI_assert(storage.is_output_initialized(output_id));

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f48b9823a4f] functions: deduplicate code to setup tuples

2019-04-28 Thread Jacques Lucke
Commit: f48b9823a4f67660a785025540b8e19343f89d02
Author: Jacques Lucke
Date:   Sun Apr 28 18:45:09 2019 +0200
Branches: functions
https://developer.blender.org/rBf48b9823a4f67660a785025540b8e19343f89d02

deduplicate code to setup tuples

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 982135a39ae..1830514ba22 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -242,6 +242,18 @@ class ExecuteFGraph : public TupleCallBody {
 }
   };
 
+#define SETUP_SUB_TUPLES(node_id, body, body_in, body_out) \
+  Tuple body_in(body->meta_in(), \
+storage.node_input_values_ptr(node_id), \
+storage.node_input_inits_ptr(node_id), \
+true, \
+false); \
+  Tuple body_out(body->meta_out(), \
+ storage.node_output_values_ptr(node_id), \
+ storage.node_output_inits_ptr(node_id), \
+ true, \
+ false);
+
   void evaluate_graph_to_compute_outputs(SocketValueStorage ,
  Tuple _out,
  ExecutionContext ) const
@@ -281,17 +293,6 @@ class ExecuteFGraph : public TupleCallBody {
   if (m_node_info[node_id].is_lazy) {
 LazyInTupleCallBody *body = (LazyInTupleCallBody 
*)m_node_info[node_id].body;
 
-Tuple body_in(body->meta_in(),
-  storage.node_input_values_ptr(node_id),
-  storage.node_input_inits_ptr(node_id),
-  true,
-  false);
-Tuple body_out(body->meta_out(),
-   storage.node_output_values_ptr(node_id),
-   storage.node_output_inits_ptr(node_id),
-   true,
-   false);
-
 if (lazy_states.empty() || lazy_states.peek().node_id != node_id) {
 
   bool required_inputs_computed = true;
@@ -309,6 +310,8 @@ class ExecuteFGraph : public TupleCallBody {
 LazyState state(user_data);
 state.start_next_entry();
 
+SETUP_SUB_TUPLES(node_id, body, body_in, body_out);
+
 SourceInfoStackFrame 
frame(m_graph->source_info_of_node(node_id));
 ctx.stack().push();
 body->call(body_in, body_out, ctx, state);
@@ -333,6 +336,8 @@ class ExecuteFGraph : public TupleCallBody {
   LazyState  = lazy_states.peek().state;
   state.start_next_entry();
 
+  SETUP_SUB_TUPLES(node_id, body, body_in, body_out);
+
   SourceInfoStackFrame 
frame(m_graph->source_info_of_node(node_id));
   ctx.stack().push();
   body->call(body_in, body_out, ctx, state);
@@ -370,16 +375,7 @@ class ExecuteFGraph : public TupleCallBody {
   TupleCallBody *body = (TupleCallBody *)m_node_info[node_id].body;
   BLI_assert(body);
 
-  Tuple body_in(body->meta_in(),
-storage.node_input_values_ptr(node_id),
-storage.node_input_inits_ptr(node_id),
-true,
-true);
-  Tuple body_out(body->meta_out(),
- storage.node_output_values_ptr(node_id),
- storage.node_output_inits_ptr(node_id),
- true,
- false);
+  SETUP_SUB_TUPLES(node_id, body, body_in, body_out);
 
   SourceInfo *source_info = m_graph->source_info_of_node(node_id);
   body->call__setup_stack(body_in, body_out, ctx, source_info);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [da3d297b3f3] functions: subscript operator for range

2019-04-28 Thread Jacques Lucke
Commit: da3d297b3f3dc89c67a78b2aa3bf97eb705e4323
Author: Jacques Lucke
Date:   Sun Apr 28 17:50:44 2019 +0200
Branches: functions
https://developer.blender.org/rBda3d297b3f3dc89c67a78b2aa3bf97eb705e4323

subscript operator for range

===

M   source/blender/blenlib/BLI_range.hpp
M   tests/gtests/blenlib/BLI_range_test.cc

===

diff --git a/source/blender/blenlib/BLI_range.hpp 
b/source/blender/blenlib/BLI_range.hpp
index 0959b0f0743..0253aededc0 100644
--- a/source/blender/blenlib/BLI_range.hpp
+++ b/source/blender/blenlib/BLI_range.hpp
@@ -54,6 +54,12 @@ template class Range {
 return RangeIterator(*this, m_one_after_last);
   }
 
+  T operator[](uint index) const
+  {
+BLI_assert(index < this->size());
+return m_start + index;
+  }
+
   uint size() const
   {
 return m_one_after_last - m_start;
diff --git a/tests/gtests/blenlib/BLI_range_test.cc 
b/tests/gtests/blenlib/BLI_range_test.cc
index e8d66cc1854..a1e6fdb66a0 100644
--- a/tests/gtests/blenlib/BLI_range_test.cc
+++ b/tests/gtests/blenlib/BLI_range_test.cc
@@ -47,3 +47,11 @@ TEST(range, MultipleElementRange)
 EXPECT_EQ(vector[i], i + 6);
   }
 }
+
+TEST(range, SubscriptOperator)
+{
+  IntRange range(5, 10);
+  EXPECT_EQ(range[0], 5);
+  EXPECT_EQ(range[1], 6);
+  EXPECT_EQ(range[2], 7);
+}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2b32296e178] sculpt-mode-features: Fix crash on remesh operator with a multi user mesh data.

2019-04-28 Thread Pablo Dobarro
Commit: 2b32296e178262109f3d927a60b9068c8d632cc2
Author: Pablo Dobarro
Date:   Sun Apr 28 18:53:05 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rB2b32296e178262109f3d927a60b9068c8d632cc2

Fix crash on remesh operator with a multi user mesh data.

I also added some error messages.

===

M   source/blender/editors/object/object_edit.c

===

diff --git a/source/blender/editors/object/object_edit.c 
b/source/blender/editors/object/object_edit.c
index 2cd870cfb24..122bd9208ee 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1807,6 +1807,17 @@ static int remesh_exec(bContext *C, wmOperator *op)
 linked_data = true;
 return OPERATOR_CANCELLED;
   }
+
+  if (ID_REAL_USERS(data) != 1) {
+BKE_report(op->reports, RPT_ERROR, "Remesh cannot run on mesh data with 
multiple users");
+return OPERATOR_CANCELLED;
+  }
+
+  if (BKE_object_is_in_editmode(ob)) {
+BKE_report(op->reports, RPT_ERROR, "Remesh cannot run from edit mode");
+return OPERATOR_CANCELLED;
+  }
+
   if (ob->type == OB_MESH) {
 Mesh *mesh = ob->data;
 Mesh *newMesh;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1242de1b6d0] functions: deduplicate some code

2019-04-28 Thread Jacques Lucke
Commit: 1242de1b6d0cfa5196bb982726eaef55067e1a7f
Author: Jacques Lucke
Date:   Sun Apr 28 18:38:47 2019 +0200
Branches: functions
https://developer.blender.org/rB1242de1b6d0cfa5196bb982726eaef55067e1a7f

deduplicate some code

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 7e135762286..982135a39ae 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -315,12 +315,7 @@ class ExecuteFGraph : public TupleCallBody {
 ctx.stack().pop();
 
 if (state.is_done()) {
-  for (uint output_id : m_graph->output_ids_of_node(node_id)) {
-if (m_output_info[output_id].is_fn_output) {
-  uint index = 
m_fgraph.outputs().index(DFGraphSocket::FromOutput(output_id));
-  fn_out.copy_in__dynamic(index, 
storage.output_value_ptr(output_id));
-}
-  }
+  this->copy_outputs_to_final_output_if_necessary(node_id, 
storage, fn_out);
   sockets_to_compute.pop();
 }
 else {
@@ -344,12 +339,7 @@ class ExecuteFGraph : public TupleCallBody {
   ctx.stack().pop();
 
   if (state.is_done()) {
-for (uint output_id : m_graph->output_ids_of_node(node_id)) {
-  if (m_output_info[output_id].is_fn_output) {
-uint index = 
m_fgraph.outputs().index(DFGraphSocket::FromOutput(output_id));
-fn_out.copy_in__dynamic(index, 
storage.output_value_ptr(output_id));
-  }
-}
+this->copy_outputs_to_final_output_if_necessary(node_id, 
storage, fn_out);
 sockets_to_compute.pop();
 lazy_states.pop();
 
@@ -395,13 +385,7 @@ class ExecuteFGraph : public TupleCallBody {
   body->call__setup_stack(body_in, body_out, ctx, source_info);
   BLI_assert(body_out.all_initialized());
 
-  for (uint output_id : m_graph->output_ids_of_node(node_id)) {
-if (m_output_info[output_id].is_fn_output) {
-  uint index = 
m_fgraph.outputs().index(DFGraphSocket::FromOutput(output_id));
-  fn_out.copy_in__dynamic(index, 
storage.output_value_ptr(output_id));
-}
-  }
-
+  this->copy_outputs_to_final_output_if_necessary(node_id, 
storage, fn_out);
   sockets_to_compute.pop();
 }
   }
@@ -410,6 +394,18 @@ class ExecuteFGraph : public TupleCallBody {
 }
   }
 
+  void copy_outputs_to_final_output_if_necessary(uint node_id,
+ SocketValueStorage ,
+ Tuple _out) const
+  {
+for (uint output_id : m_graph->output_ids_of_node(node_id)) {
+  if (m_output_info[output_id].is_fn_output) {
+uint index = 
m_fgraph.outputs().index(DFGraphSocket::FromOutput(output_id));
+fn_out.copy_in__dynamic(index, storage.output_value_ptr(output_id));
+  }
+}
+  }
+
   void forward_output(uint output_id, SocketValueStorage , Tuple 
_out) const
   {
 BLI_assert(storage.is_output_initialized(output_id));

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7b75b665d35] functions: group node info into a struct

2019-04-28 Thread Jacques Lucke
Commit: 7b75b665d3518472e3f19c394ff2677835d56671
Author: Jacques Lucke
Date:   Sun Apr 28 15:06:23 2019 +0200
Branches: functions
https://developer.blender.org/rB7b75b665d3518472e3f19c394ff2677835d56671

group node info into a struct

===

M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp

===

diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 6b7ce6fe1dd..7e9f6af2630 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -28,9 +28,29 @@ class ExecuteFGraph : public TupleCallBody {
   FunctionGraph m_fgraph;
   DataFlowGraph *m_graph;
 
-  SmallVector m_bodies;
-  SmallVector m_input_starts;
-  SmallVector m_output_starts;
+  struct NodeInfo {
+union {
+  TupleCallBody *direct;
+  LazyInTupleCallBody *lazy;
+} body;
+uint input_start;
+uint output_start;
+bool is_lazy;
+
+NodeInfo(TupleCallBody *body, uint input_start, uint output_start)
+: input_start(input_start), output_start(output_start), is_lazy(false)
+{
+  this->body.direct = body;
+}
+
+NodeInfo(LazyInTupleCallBody *body, uint input_start, uint output_start)
+: input_start(input_start), output_start(output_start), is_lazy(true)
+{
+  this->body.lazy = body;
+}
+  };
+
+  SmallVector m_node_info;
 
   struct SocketInfo {
 CPPTypeInfo *type;
@@ -57,14 +77,11 @@ class ExecuteFGraph : public TupleCallBody {
 for (uint node_id : m_graph->node_ids()) {
   SharedFunction  = m_graph->function_of_node(node_id);
   TupleCallBody *body = fn->body();
-  m_bodies.append(body);
+  m_node_info.append(NodeInfo(body, m_inputs_buffer_size, 
m_outputs_buffer_size));
 
   m_inputs_init_buffer_size += fn->signature().inputs().size();
   m_outputs_init_buffer_size += fn->signature().outputs().size();
 
-  m_input_starts.append(m_inputs_buffer_size);
-  m_output_starts.append(m_outputs_buffer_size);
-
   if (body == nullptr) {
 for (auto param : fn->signature().inputs()) {
   CPPTypeInfo *type_info = param.type()->extension();
@@ -132,12 +149,12 @@ class ExecuteFGraph : public TupleCallBody {
 
 void *node_input_values_ptr(uint node_id)
 {
-  return POINTER_OFFSET(m_input_values, m_parent.m_input_starts[node_id]);
+  return POINTER_OFFSET(m_input_values, 
m_parent.m_node_info[node_id].input_start);
 }
 
 void *node_output_values_ptr(uint node_id)
 {
-  return POINTER_OFFSET(m_output_values, 
m_parent.m_output_starts[node_id]);
+  return POINTER_OFFSET(m_output_values, 
m_parent.m_node_info[node_id].output_start);
 }
 
 bool *node_input_inits_ptr(uint node_id)
@@ -258,7 +275,8 @@ class ExecuteFGraph : public TupleCallBody {
   }
 
   if (all_inputs_computed) {
-TupleCallBody *body = m_bodies[node_id];
+BLI_assert(!m_node_info[node_id].is_lazy);
+TupleCallBody *body = m_node_info[node_id].body.direct;
 BLI_assert(body);
 
 Tuple body_in(body->meta_in(),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9e3246ce6e9] master: Fix T63794: duplicating an armature clears B-Bones' custom handle references.

2019-04-28 Thread Tomoaki Kawada
Commit: 9e3246ce6e9767148e4394dc7acbec04a7d69163
Author: Tomoaki Kawada
Date:   Sun Apr 28 16:19:45 2019 +0300
Branches: master
https://developer.blender.org/rB9e3246ce6e9767148e4394dc7acbec04a7d69163

Fix T63794: duplicating an armature clears B-Bones' custom handle references.

This patch fixes T63794 by updating duplicated bones' custom handle references
to point to the new armature's bones.

The problem occurs because B-Bones of a duplicated armature keep pointing to
the old armature's bones. The references are cleared upon entering Edit Mode
because there are no matching `EditBone` for such bones, and `find_ebone_link`
just returns `NULL` in such cases.

Reviewers: mont29, angavrilov

Maniphest Tasks: T63794

Differential Revision: https://developer.blender.org/D4726

===

M   source/blender/blenkernel/intern/armature.c

===

diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index 97238020f29..7f374c1d66e 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -169,6 +169,28 @@ static void copy_bonechildren(Bone *bone_dst,
   }
 }
 
+static void copy_bonechildren_custom_handles(Bone *bone_dst, bArmature 
*arm_dst, GHash **bone_hash)
+{
+  Bone *bone_dst_child;
+
+  /* Lazily create the name -> bone hashtable. */
+  if ((bone_dst->bbone_prev || bone_dst->bbone_next) && *bone_hash == NULL) {
+*bone_hash = BKE_armature_bone_from_name_map(arm_dst);
+  }
+
+  if (bone_dst->bbone_prev) {
+bone_dst->bbone_prev = BLI_ghash_lookup(*bone_hash, 
bone_dst->bbone_prev->name);
+  }
+  if (bone_dst->bbone_next) {
+bone_dst->bbone_next = BLI_ghash_lookup(*bone_hash, 
bone_dst->bbone_next->name);
+  }
+
+  for (bone_dst_child = bone_dst->childbase.first; bone_dst_child;
+   bone_dst_child = bone_dst_child->next) {
+copy_bonechildren_custom_handles(bone_dst_child, arm_dst, bone_hash);
+  }
+}
+
 /**
  * Only copy internal data of Armature ID from source
  * to already allocated/initialized destination.
@@ -202,6 +224,17 @@ void BKE_armature_copy_data(Main *UNUSED(bmain),
 
   arm_dst->act_bone = bone_dst_act;
 
+  /* Fix custom handle references. */
+  GHash *bone_hash = NULL; /* lazily created */
+
+  for (bone_dst = arm_dst->bonebase.first; bone_dst; bone_dst = 
bone_dst->next) {
+copy_bonechildren_custom_handles(bone_dst, arm_dst, _hash);
+  }
+
+  if (bone_hash) {
+BLI_ghash_free(bone_hash, NULL, NULL);
+  }
+
   arm_dst->edbo = NULL;
   arm_dst->act_edbone = NULL;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c9eb9f4ad1e] functions: fix error in last merge

2019-04-28 Thread Jacques Lucke
Commit: c9eb9f4ad1ee1e66fe4da6f7d16bfcd9d6612af2
Author: Jacques Lucke
Date:   Sun Apr 28 14:49:59 2019 +0200
Branches: functions
https://developer.blender.org/rBc9eb9f4ad1ee1e66fe4da6f7d16bfcd9d6612af2

fix error in last merge

===

M   source/blender/blenkernel/BKE_fcurve.h

===

diff --git a/source/blender/blenkernel/BKE_fcurve.h 
b/source/blender/blenkernel/BKE_fcurve.h
index c1232addee3..f09b7e9d5c1 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -253,6 +253,8 @@ struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, 
const char rna_path[]);
 struct FCurve *id_data_find_fcurve(
 ID *id, void *data, struct StructRNA *type, const char *prop_name, int 
index, bool *r_driven);
 
+void *get_driver_variable_function(struct DriverVar *dvar);
+
 /* Get list of LinkData's containing pointers to the F-Curves which control 
the types of data
  * indicated
  * e.g.  numMatches = list_find_data_fcurves(matches, >curves, 
"pose.bones[", "MyFancyBone");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [df0b4a4d0eb] functions: Merge branch 'master' into functions

2019-04-28 Thread Jacques Lucke
Commit: df0b4a4d0ebbf8e8bcfd5d36b5c2a1ccf885ba78
Author: Jacques Lucke
Date:   Sun Apr 28 14:42:08 2019 +0200
Branches: functions
https://developer.blender.org/rBdf0b4a4d0ebbf8e8bcfd5d36b5c2a1ccf885ba78

Merge branch 'master' into functions

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [91bb8da59fe] master: Cleanup: clangg-format for rB157cc54ed521

2019-04-28 Thread Jörg Müller
Commit: 91bb8da59fe16e711e44d8fb0ff6422277b2d742
Author: Jörg Müller
Date:   Sun Apr 28 11:47:21 2019 +0200
Branches: master
https://developer.blender.org/rB91bb8da59fe16e711e44d8fb0ff6422277b2d742

Cleanup: clangg-format for rB157cc54ed521

===

M   intern/audaspace/intern/AUD_PyInit.cpp

===

diff --git a/intern/audaspace/intern/AUD_PyInit.cpp 
b/intern/audaspace/intern/AUD_PyInit.cpp
index f184f61f4ae..843fe1e6cf1 100644
--- a/intern/audaspace/intern/AUD_PyInit.cpp
+++ b/intern/audaspace/intern/AUD_PyInit.cpp
@@ -34,11 +34,11 @@ extern void *BKE_sound_get_factory(void *sound);
 
 static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
 {
-  PyObject* lptr = NULL;
+  PyObject *lptr = NULL;
 
   if (PyArg_Parse(args, "O:_sound_from_pointer", )) {
 if (lptr) {
-  AUD_Sound* sound = BKE_sound_get_factory(PyLong_AsVoidPtr(lptr));
+  AUD_Sound *sound = BKE_sound_get_factory(PyLong_AsVoidPtr(lptr));
 
   if (sound) {
 Sound *obj = (Sound *)Sound_empty();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs