[Bf-blender-cvs] [25b794a39d8] master: Cycles: support animated object scale in motion blur.

2018-01-10 Thread Stefan Werner
Commit: 25b794a39d8cff87b6df2338d020e8d4ba90eeef
Author: Stefan Werner
Date:   Sat Dec 2 03:28:13 2017 +0100
Branches: master
https://developer.blender.org/rB25b794a39d8cff87b6df2338d020e8d4ba90eeef

Cycles: support animated object scale in motion blur.

This was disabled previously due to CUDA compiler bugs, see T32900.

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

===

M   intern/cycles/kernel/geom/geom_attribute.h
M   intern/cycles/kernel/geom/geom_object.h
M   intern/cycles/kernel/kernel_camera.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/render/camera.cpp
M   intern/cycles/render/object.cpp
M   intern/cycles/util/util_transform.cpp
M   intern/cycles/util/util_transform.h

===

diff --git a/intern/cycles/kernel/geom/geom_attribute.h 
b/intern/cycles/kernel/geom/geom_attribute.h
index 18f5c813cc8..c72595eed10 100644
--- a/intern/cycles/kernel/geom/geom_attribute.h
+++ b/intern/cycles/kernel/geom/geom_attribute.h
@@ -53,7 +53,7 @@ ccl_device_inline AttributeDescriptor attribute_not_found()
 
 ccl_device_inline uint object_attribute_map_offset(KernelGlobals *kg, int 
object)
 {
-   int offset = object*OBJECT_SIZE + 11;
+   int offset = object*OBJECT_SIZE + 15;
float4 f = kernel_tex_fetch(__objects, offset);
return __float_as_uint(f.y);
 }
diff --git a/intern/cycles/kernel/geom/geom_object.h 
b/intern/cycles/kernel/geom/geom_object.h
index a276096a745..d77c40f2348 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -28,11 +28,12 @@ CCL_NAMESPACE_BEGIN
 
 enum ObjectTransform {
OBJECT_TRANSFORM = 0,
-   OBJECT_TRANSFORM_MOTION_PRE = 0,
OBJECT_INVERSE_TRANSFORM = 4,
-   OBJECT_TRANSFORM_MOTION_POST = 4,
-   OBJECT_PROPERTIES = 8,
-   OBJECT_DUPLI = 9
+   OBJECT_TRANSFORM_MOTION_PRE = 0,
+   OBJECT_TRANSFORM_MOTION_MID = 4,
+   OBJECT_TRANSFORM_MOTION_POST = 8,
+   OBJECT_PROPERTIES = 12,
+   OBJECT_DUPLI = 13
 };
 
 enum ObjectVectorTransform {
@@ -90,19 +91,24 @@ ccl_device_inline Transform 
object_fetch_vector_transform(KernelGlobals *kg, int
 #ifdef __OBJECT_MOTION__
 ccl_device_inline Transform object_fetch_transform_motion(KernelGlobals *kg, 
int object, float time)
 {
-   DecompMotionTransform motion;
+   MotionTransform motion;
 
int offset = object*OBJECT_SIZE + (int)OBJECT_TRANSFORM_MOTION_PRE;
 
-   motion.mid.x = kernel_tex_fetch(__objects, offset + 0);
-   motion.mid.y = kernel_tex_fetch(__objects, offset + 1);
-   motion.mid.z = kernel_tex_fetch(__objects, offset + 2);
-   motion.mid.w = kernel_tex_fetch(__objects, offset + 3);
+   motion.pre.x = kernel_tex_fetch(__objects, offset + 0);
+   motion.pre.y = kernel_tex_fetch(__objects, offset + 1);
+   motion.pre.z = kernel_tex_fetch(__objects, offset + 2);
+   motion.pre.w = kernel_tex_fetch(__objects, offset + 3);
+
+   motion.mid.x = kernel_tex_fetch(__objects, offset + 4);
+   motion.mid.y = kernel_tex_fetch(__objects, offset + 5);
+   motion.mid.z = kernel_tex_fetch(__objects, offset + 6);
+   motion.mid.w = kernel_tex_fetch(__objects, offset + 7);
 
-   motion.pre_x = kernel_tex_fetch(__objects, offset + 4);
-   motion.pre_y = kernel_tex_fetch(__objects, offset + 5);
-   motion.post_x = kernel_tex_fetch(__objects, offset + 6);
-   motion.post_y = kernel_tex_fetch(__objects, offset + 7);
+   motion.post.x = kernel_tex_fetch(__objects, offset + 8);
+   motion.post.y = kernel_tex_fetch(__objects, offset + 9);
+   motion.post.z = kernel_tex_fetch(__objects, offset + 10);
+   motion.post.w = kernel_tex_fetch(__objects, offset + 11);
 
Transform tfm;
transform_motion_interpolate(, , time);
@@ -328,7 +334,7 @@ ccl_device_inline uint 
object_patch_map_offset(KernelGlobals *kg, int object)
if(object == OBJECT_NONE)
return 0;
 
-   int offset = object*OBJECT_SIZE + 11;
+   int offset = object*OBJECT_SIZE + 15;
float4 f = kernel_tex_fetch(__objects, offset);
return __float_as_uint(f.x);
 }
diff --git a/intern/cycles/kernel/kernel_camera.h 
b/intern/cycles/kernel/kernel_camera.h
index 0df5217d97a..77e3446329a 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -95,11 +95,11 @@ ccl_device void camera_sample_perspective(KernelGlobals 
*kg, float raster_x, flo
 #  ifdef __KERNEL_OPENCL__
const MotionTransform tfm = kernel_data.cam.motion;
transform_motion_interpolate(,
-((const 
DecompMotionTransform*)),
+,
 ray->time);
 #  else

[Bf-blender-cvs] [717090f40e1] master: UI: option not to show screen splitting widgets

2018-01-10 Thread Campbell Barton
Commit: 717090f40e1aa12be26522df350d01a50d7b6316
Author: Campbell Barton
Date:   Thu Jan 11 16:08:55 2018 +1100
Branches: master
https://developer.blender.org/rB717090f40e1aa12be26522df350d01a50d7b6316

UI: option not to show screen splitting widgets

Request for simplified Blender template,
this may be extended to limit access to other UI changes
that could be pressed by accident.

===

M   release/scripts/startup/bl_ui/space_userpref.py
M   source/blender/blenkernel/intern/blender.c
M   source/blender/editors/interface/resources.c
M   source/blender/editors/screen/area.c
M   source/blender/makesdna/DNA_userdef_types.h
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/release/scripts/startup/bl_ui/space_userpref.py 
b/release/scripts/startup/bl_ui/space_userpref.py
index 5ba1f0b8dcb..3d44c624a7b 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -316,6 +316,9 @@ class USERPREF_PT_interface(Panel):
 col.separator()
 col.separator()
 
+col.label(text="Screen:")
+col.prop(view, "show_layout_ui")
+
 col.prop(view, "show_splash")
 
 
diff --git a/source/blender/blenkernel/intern/blender.c 
b/source/blender/blenkernel/intern/blender.c
index 7a61ef2abac..bc47cfde143 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -258,6 +258,16 @@ void BKE_blender_userdef_app_template_data_swap(UserDef 
*userdef_a, UserDef *use
SWAP(ListBase, userdef_a->id, userdef_b->id); \
 } ((void)0)
 
+#define FLAG_SWAP(id, ty, flags) { \
+   CHECK_TYPE(&(userdef_a->id), ty *); \
+   const ty f = flags; \
+   const ty a = userdef_a->id; \
+   const ty b = userdef_b->id; \
+userdef_a->id = (userdef_a->id & ~f) | (b & f); \
+userdef_b->id = (userdef_b->id & ~f) | (a & f); \
+} ((void)0)
+
+
LIST_SWAP(uistyles);
LIST_SWAP(uifonts);
LIST_SWAP(themes);
@@ -270,9 +280,11 @@ void BKE_blender_userdef_app_template_data_swap(UserDef 
*userdef_a, UserDef *use
DATA_SWAP(font_path_ui_mono);
DATA_SWAP(keyconfigstr);
 
-#undef SWAP_TYPELESS
-#undef LIST_SWAP
+   FLAG_SWAP(uiflag, int, USER_LOCK_UI_LAYOUT);
+
 #undef DATA_SWAP
+#undef LIST_SWAP
+#undef FLAG_SWAP
 }
 
 void BKE_blender_userdef_app_template_data_set(UserDef *userdef)
diff --git a/source/blender/editors/interface/resources.c 
b/source/blender/editors/interface/resources.c
index d12e7cc036b..09b0906f134 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -2765,7 +2765,7 @@ void init_userdef_do_versions(void)
USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 |
USER_FLAG_DEPRECATED_9 | USER_FLAG_DEPRECATED_10);
U.uiflag &= ~(
-   USER_UIFLAG_DEPRECATED_7);
+   USER_LOCK_UI_LAYOUT);
U.transopts &= ~(
USER_TR_DEPRECATED_2 | USER_TR_DEPRECATED_3 | 
USER_TR_DEPRECATED_4 |
USER_TR_DEPRECATED_6 | USER_TR_DEPRECATED_7);
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 9cfaf3b4c1d..e8dc220667a 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -666,6 +666,10 @@ static void area_azone_initialize(wmWindow *win, bScreen 
*screen, ScrArea *sa)
return;
}
 
+   if (U.uiflag & USER_LOCK_UI_LAYOUT) {
+   return;
+   }
+
/* can't click on bottom corners on OS X, already used for resizing */
 #ifdef __APPLE__
if (!(sa->totrct.xmin == 0 && sa->totrct.ymin == 0) || 
WM_window_is_fullscreen(win))
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index ae6907d256a..93fab4da566 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -668,7 +668,9 @@ typedef enum eUserpref_UI_Flag {
USER_DRAWVIEWINFO   = (1 << 4),
USER_PLAINMENUS = (1 << 5),
USER_LOCK_CURSOR_ADJUST = (1 << 6),
-   USER_UIFLAG_DEPRECATED_7= (1 << 7),  /* cleared */
+   /* Avoid accidentally adjusting the layout
+* (exact behavior may change based on whats considered reasonable to 
lock down). */
+   USER_LOCK_UI_LAYOUT = (1 << 7),
USER_ALLWINCODECS   = (1 << 8),
USER_MENUOPENAUTO   = (1 << 9),
USER_ZBUF_CURSOR= (1 << 10),
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index 71c53579585..3aed3a1edb1 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ 

[Bf-blender-cvs] [9d62e6e782a] master: UI: don't draw outline when it's not calculated

2018-01-10 Thread Campbell Barton
Commit: 9d62e6e782addd16323bd95ed70f86fcb077fd84
Author: Campbell Barton
Date:   Thu Jan 11 13:20:08 2018 +1100
Branches: master
https://developer.blender.org/rB9d62e6e782addd16323bd95ed70f86fcb077fd84

UI: don't draw outline when it's not calculated

Outline drawing was running even when there were no verts to draw.
Causes an assert in 2.8.

===

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

===

diff --git a/source/blender/editors/interface/interface_widgets.c 
b/source/blender/editors/interface/interface_widgets.c
index 39ee8e2885d..b25e1130c60 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -685,6 +685,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, 
uiWidgetColors *wcol)
 
/* backdrop non AA */
if (wtb->draw_inner) {
+   BLI_assert(wtb->totvert != 0);
if (wcol->shaded == 0) {
if (wcol->alpha_check) {
float inner_v_half[WIDGET_SIZE_MAX][2];
@@ -764,6 +765,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, 
uiWidgetColors *wcol)

/* for each AA step */
if (wtb->draw_outline) {
+   BLI_assert(wtb->totvert != 0);
float triangle_strip[WIDGET_SIZE_MAX * 2 + 2][2]; /* + 2 
because the last pair is wrapped */
float triangle_strip_emboss[WIDGET_SIZE_MAX * 2][2]; /* only 
for emboss */
 
@@ -2680,6 +2682,10 @@ static void widget_numbut_draw(uiWidgetColors *wcol, 
rcti *rect, int state, int
if (!emboss) {
round_box_edges(, roundboxalign, rect, rad);
}
+   else {
+   wtb.draw_inner = false;
+   wtb.draw_outline = false;
+   }
 
/* decoration */
if (!(state & UI_STATE_TEXT_INPUT)) {

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


[Bf-blender-cvs] [1ceff9329c6] asset-engine: Fix generating dummy pixel data

2018-01-10 Thread Campbell Barton
Commit: 1ceff9329c6d5c6b085781deea6335031ef517a2
Author: Campbell Barton
Date:   Thu Jan 11 12:40:52 2018 +1100
Branches: asset-engine
https://developer.blender.org/rB1ceff9329c6d5c6b085781deea6335031ef517a2

Fix generating dummy pixel data

Range was for an unsigned int instead of an int,
caused overflow error

===

M   release/scripts/modules/amber/engine.py

===

diff --git a/release/scripts/modules/amber/engine.py 
b/release/scripts/modules/amber/engine.py
index 9b1733cad13..5130a168b82 100644
--- a/release/scripts/modules/amber/engine.py
+++ b/release/scripts/modules/amber/engine.py
@@ -152,7 +152,7 @@ class AmberJobPreviews(AmberJob):
 #~ time.sleep(0.1)  # 100% Artificial Lag (c)
 w = random.randint(8, 32)
 h = random.randint(8, 32)
-return [w, h, [random.getrandbits(32) for i in range(w * h)]]
+return [w, h, [random.randint(-2147483647, 2147483647) for i in 
range(w * h)]]
 
 def start(self, uuids):
 self.nbr = 0

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


[Bf-blender-cvs] [9c91c75ea65] blender2.8: Merge branch 'master' into blender2.8

2018-01-10 Thread Campbell Barton
Commit: 9c91c75ea6514bbc500ae69083f25874b60e1470
Author: Campbell Barton
Date:   Thu Jan 11 13:24:41 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB9c91c75ea6514bbc500ae69083f25874b60e1470

Merge branch 'master' into blender2.8

===



===

diff --cc source/blender/editors/interface/interface_widgets.c
index cc4f53cbabf,b25e1130c60..3afae5ed8d4
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@@ -777,13 -753,19 +778,14 @@@ static void widgetbase_draw(uiWidgetBas
round_box_shade_col4_r(col_pt, col1, col2, 
wtb->inner_uv[a][wtb->draw_shadedir ? 1 : 0]);
}
  
 -  glEnableClientState(GL_VERTEX_ARRAY);
 -  glEnableClientState(GL_COLOR_ARRAY);
 -  glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
 -  glColorPointer(4, GL_UNSIGNED_BYTE, 0, col_array);
 -  glDrawArrays(GL_POLYGON, 0, wtb->totvert);
 -  glDisableClientState(GL_VERTEX_ARRAY);
 -  glDisableClientState(GL_COLOR_ARRAY);
 +  widget_draw_vertex_buffer(pos, col, GL_TRIANGLE_FAN, 
wtb->inner_v, col_array, wtb->totvert);
 +  immUnbindProgram();
}
}
 -  
 +
/* for each AA step */
if (wtb->draw_outline) {
+   BLI_assert(wtb->totvert != 0);
float triangle_strip[WIDGET_SIZE_MAX * 2 + 2][2]; /* + 2 
because the last pair is wrapped */
float triangle_strip_emboss[WIDGET_SIZE_MAX * 2][2]; /* only 
for emboss */

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


[Bf-blender-cvs] [288e30ead0c] asset-engine: Merge branch 'blender2.8' into asset-engine

2018-01-10 Thread Campbell Barton
Commit: 288e30ead0caa2f3400e5568bcb25b14ecd12ee5
Author: Campbell Barton
Date:   Thu Jan 11 13:27:36 2018 +1100
Branches: asset-engine
https://developer.blender.org/rB288e30ead0caa2f3400e5568bcb25b14ecd12ee5

Merge branch 'blender2.8' into asset-engine

===



===



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


[Bf-blender-cvs] [6dd164a1888] master: Fix T53755: Cycles OpenCL lamp shaders have incorrect normal.

2018-01-10 Thread Brecht Van Lommel
Commit: 6dd164a1888d8e6c2328267e6584575f77527c35
Author: Brecht Van Lommel
Date:   Thu Jan 11 08:42:57 2018 +0100
Branches: master
https://developer.blender.org/rB6dd164a1888d8e6c2328267e6584575f77527c35

Fix T53755: Cycles OpenCL lamp shaders have incorrect normal.

===

M   intern/cycles/kernel/geom/geom_object.h

===

diff --git a/intern/cycles/kernel/geom/geom_object.h 
b/intern/cycles/kernel/geom/geom_object.h
index d77c40f2348..fa0dff4bd57 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -175,6 +175,10 @@ ccl_device_inline void 
object_inverse_normal_transform(KernelGlobals *kg, const
Transform tfm = object_fetch_transform(kg, sd->object, 
OBJECT_TRANSFORM);
*N = normalize(transform_direction_transposed(, *N));
}
+   else if(sd->type == PRIMITIVE_LAMP) {
+   Transform tfm = lamp_fetch_transform(kg, sd->lamp, false);
+   *N = normalize(transform_direction_transposed(, *N));
+   }
 #endif
 }

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


[Bf-blender-cvs] [682685ba222] greasepencil-object: End operator if click out of panel

2018-01-10 Thread Antonio Vazquez
Commit: 682685ba222f8b0bffa03a2c59621aee42d05d36
Author: Antonio Vazquez
Date:   Wed Jan 10 19:15:52 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB682685ba222f8b0bffa03a2c59621aee42d05d36

End operator if click out of panel

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
index 15a48461b87..569fcf8f41e 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -397,6 +397,13 @@ static int gpencil_colorpick_invoke(bContext *C, 
wmOperator *op, const wmEvent *
 static bool set_color(const wmEvent *event, tGPDpick *tgpk)
 {
tGPDpickColor *tcol = tgpk->colors;
+   /* if click out of panel end */
+   if ((event->mval[0] <= tgpk->panel.xmin) || (event->mval[0] >= 
tgpk->panel.xmax) ||
+   (event->mval[1] <= tgpk->panel.ymin) || (event->mval[1] >= 
tgpk->panel.ymax))
+   {
+   return true;
+   }
+
for (int i = 0; i < tgpk->totcolor; i++, tcol++) {
if ((event->mval[0] >= tcol->rect.xmin) && (event->mval[0] <= 
tcol->rect.xmax) &&
(event->mval[1] >= tcol->rect.ymin) && (event->mval[1] 
<= tcol->rect.ymax))

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


[Bf-blender-cvs] [b929682dab2] greasepencil-object: Remove header text functions

2018-01-10 Thread Antonio Vazquez
Commit: b929682dab27e9b19e53076b3a42f18d0601f38c
Author: Antonio Vazquez
Date:   Wed Jan 10 19:12:17 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBb929682dab27e9b19e53076b3a42f18d0601f38c

Remove header text functions

This text is not used in this operator

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
index fab0e262ace..15a48461b87 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -161,15 +161,6 @@ static void gp_draw_fill_box(rcti *box, float ink[4], 
float fill[4], int offset)
 
 /* --- */
 /* Drawing */
-/* Helper: Draw status message while the user is running the operator */
-static void gpencil_colorpick_status_indicators(tGPDpick *tgpk)
-{
-   Scene *scene = tgpk->scene;
-   char status_str[UI_MAX_DRAW_STR];
-
-   BLI_snprintf(status_str, sizeof(status_str), IFACE_("Select: ESC/RMB 
cancel, LMB Select color"));
-   ED_area_headerprint(tgpk->sa, status_str);
-}
 
 /* draw a toolbar with all colors of the palette */
 static void gpencil_draw_color_table(const bContext *UNUSED(C), tGPDpick *tgpk)
@@ -335,9 +326,6 @@ static void gpencil_colorpick_exit(bContext *C, wmOperator 
*op)
 
/* don't assume that operator data exists at all */
if (tgpk) {
-   /* clear status message area */
-   ED_area_headerprint(tgpk->sa, NULL);
-
/* remove drawing handler */
if (tgpk->draw_handle_3d) {
ED_region_draw_cb_exit(tgpk->ar->type, 
tgpk->draw_handle_3d);
@@ -397,8 +385,6 @@ static int gpencil_colorpick_invoke(bContext *C, wmOperator 
*op, const wmEvent *
/* Enable custom drawing handlers */
tgpk->draw_handle_3d = ED_region_draw_cb_activate(tgpk->ar->type, 
gpencil_colorpick_draw_3d, tgpk, REGION_DRAW_POST_PIXEL);
 
-   gpencil_colorpick_status_indicators(tgpk);
-
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
 
/* add a modal handler for this operator*/

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


[Bf-blender-cvs] [b8475a1d4c7] greasepencil-object: Replace reverse findlink

2018-01-10 Thread Antonio Vazquez
Commit: b8475a1d4c713621cdc3c8f8e3643fa859cf02b5
Author: Antonio Vazquez
Date:   Wed Jan 10 14:20:28 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBb8475a1d4c713621cdc3c8f8e3643fa859cf02b5

Replace reverse findlink

Fix error in previous commit using reverse find

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
index c6baaa7a433..a3cc9d6486b 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -224,10 +224,10 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, 
wmOperator *op)
 
/* load color table */
tGPDpickColor *col = tgpk->colors;
-   int idx = tgpk->totcolor - 1;
+   int idx = 0;
for (int r = 0; r < tgpk->row; r++) {
for (int c = 0; c < tgpk->col; c++, col++) {
-   PaletteColor *palcol = 
BLI_rfindlink(>palette->colors, idx);
+   PaletteColor *palcol = 
BLI_findlink(>palette->colors, idx);

/* exit if colors completed */
if (!palcol) {
@@ -250,7 +250,7 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, 
wmOperator *op)
col->rect.ymax = tgpk->panel.ymax - (tgpk->boxsize[1] * 
r) - GP_BOX_GAP;
col->rect.ymin = col->rect.ymax - tgpk->boxsize[0] + 
(GP_BOX_GAP * 2);
 
-   idx--;
+   idx++;
}
}

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


[Bf-blender-cvs] [88381086b2b] greasepencil-object: Cleanup code

2018-01-10 Thread Antonio Vazquez
Commit: 88381086b2b02cb0a662c247d87ba004ee88cf61
Author: Antonio Vazquez
Date:   Wed Jan 10 14:22:49 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB88381086b2b02cb0a662c247d87ba004ee88cf61

Cleanup code

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
index a3cc9d6486b..6bef982da78 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -223,10 +223,10 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, 
wmOperator *op)
tgpk->panel.ymax = tgpk->rect.ymax;
 
/* load color table */
-   tGPDpickColor *col = tgpk->colors;
+   tGPDpickColor *tcolor = tgpk->colors;
int idx = 0;
-   for (int r = 0; r < tgpk->row; r++) {
-   for (int c = 0; c < tgpk->col; c++, col++) {
+   for (int a = 0; a < tgpk->row; a++) {
+   for (int b = 0; b < tgpk->col; b++, tcolor++) {
PaletteColor *palcol = 
BLI_findlink(>palette->colors, idx);

/* exit if colors completed */
@@ -234,21 +234,21 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, 
wmOperator *op)
break;
}
 
-   col->index = idx;
-   copy_v4_v4(col->rgba, palcol->rgb);
+   tcolor->index = idx;
+   copy_v4_v4(tcolor->rgba, palcol->rgb);
if (palcol->fill[3] > 0.0f) {
-   copy_v4_v4(col->fill, palcol->fill);
+   copy_v4_v4(tcolor->fill, palcol->fill);
}
else {
-   copy_v4_v4(col->fill, palcol->rgb);
+   copy_v4_v4(tcolor->fill, palcol->rgb);
}

/* box position */
-   col->rect.xmin = tgpk->panel.xmin + (tgpk->boxsize[0] * 
c) + GP_BOX_GAP;
-   col->rect.xmax = col->rect.xmin + tgpk->boxsize[0] - 
(GP_BOX_GAP * 2);
+   tcolor->rect.xmin = tgpk->panel.xmin + 
(tgpk->boxsize[0] * b) + GP_BOX_GAP;
+   tcolor->rect.xmax = tcolor->rect.xmin + 
tgpk->boxsize[0] - (GP_BOX_GAP * 2);
 
-   col->rect.ymax = tgpk->panel.ymax - (tgpk->boxsize[1] * 
r) - GP_BOX_GAP;
-   col->rect.ymin = col->rect.ymax - tgpk->boxsize[0] + 
(GP_BOX_GAP * 2);
+   tcolor->rect.ymax = tgpk->panel.ymax - 
(tgpk->boxsize[1] * a) - GP_BOX_GAP;
+   tcolor->rect.ymin = tcolor->rect.ymax - 
tgpk->boxsize[0] + (GP_BOX_GAP * 2);
 
idx++;
}

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


[Bf-blender-cvs] [f9426cd6864] greasepencil-object: WIP: Redo colorpicker drawing and mouse cursor

2018-01-10 Thread Antonio Vazquez
Commit: f9426cd686412135e9d33b29dc8073c108eccfde
Author: Antonio Vazquez
Date:   Wed Jan 10 18:06:05 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf9426cd686412135e9d33b29dc8073c108eccfde

WIP: Redo colorpicker drawing and mouse cursor

===

M   source/blender/editors/gpencil/gpencil_colorpick.c
M   source/blender/editors/include/ED_gpencil.h

===

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
index 6bef982da78..460869481c3 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -75,40 +75,85 @@
 #include "gpencil_intern.h"
 
 #define GP_BOX_SIZE 24
-#define GP_BOX_GAP 4
+#define GP_BOX_GAP 6
 
- /* draw a filled box */
-static void gp_draw_fill_box(rcti *box, float ink[4], float fill[4])
+ /* draw a box with lines */
+static void gp_draw_boxlines(rcti *box, float ink[4])
 {
Gwn_VertFormat *format = immVertexFormat();
unsigned pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, 
GWN_FETCH_FLOAT);
unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 
4, GWN_FETCH_FLOAT);
 
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
-   
+
/* draw stroke curve */
glLineWidth(1.0f);
-   immBeginAtMost(GWN_PRIM_TRIS, 6);
+   immBeginAtMost(GWN_PRIM_LINES, 8);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmin, box->ymax - 1);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmax, box->ymax - 1);
 
-   /* First triangle */
immAttrib4fv(color, ink);
immVertex2f(pos, box->xmin, box->ymin);
 
immAttrib4fv(color, ink);
-   immVertex2f(pos, box->xmin, box->ymax);
+   immVertex2f(pos, box->xmax, box->ymin);
 
immAttrib4fv(color, ink);
immVertex2f(pos, box->xmax, box->ymax);
 
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmax, box->ymin);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmin, box->ymax);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmin, box->ymin);
+
+   immEnd();
+   immUnbindProgram();
+}
+
+/* draw a filled box */
+static void gp_draw_fill_box(rcti *box, float ink[4], float fill[4], int 
offset)
+{
+   Gwn_VertFormat *format = immVertexFormat();
+   unsigned pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, 
GWN_FETCH_FLOAT);
+   unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 
4, GWN_FETCH_FLOAT);
+   int gap = 0;
+   if (offset > 0) {
+   gap = 1;
+   }
+
+   immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+
+   /* draw stroke curve */
+   glLineWidth(1.0f);
+   immBeginAtMost(GWN_PRIM_TRIS, 6);
+
+   /* First triangle */
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmin - offset, box->ymin - offset);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmin - offset, box->ymax + offset);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmax + offset + gap, box->ymax + offset);
+
/* Second triangle */
immAttrib4fv(color, fill);
-   immVertex2f(pos, box->xmin, box->ymin);
+   immVertex2f(pos, box->xmin - offset, box->ymin - offset);
 
immAttrib4fv(color, fill);
-   immVertex2f(pos, box->xmax, box->ymax);
+   immVertex2f(pos, box->xmax + offset + gap, box->ymax + offset);
 
immAttrib4fv(color, fill);
-   immVertex2f(pos, box->xmax, box->ymin);
+   immVertex2f(pos, box->xmax + offset + gap, box->ymin - offset);
 
immEnd();
immUnbindProgram();
@@ -134,25 +179,41 @@ static void gpencil_draw_color_table(const bContext 
*UNUSED(C), tGPDpick *tgpk)
}
 
float ink[4];
-   
+   float select[4];
+   float line[4];
+
+   UI_GetThemeColor3fv(TH_SELECT, select);
+   select[3] = 1.0f;
+
+   UI_GetThemeColor3fv(TH_TAB_OUTLINE, line);
+   line[3] = 1.0f;
+
/* draw panel background */
UI_GetThemeColor4fv(TH_PANEL_BACK, ink);
-   gp_draw_fill_box(>panel, ink, ink);
+   gp_draw_fill_box(>panel, ink, ink, 0);
 
/* draw color boxes */
tGPDpickColor *col = tgpk->colors;
for (int i = 0; i < tgpk->totcolor; i++, col++) {
-   gp_draw_fill_box(>rect, col->rgba, col->fill);
-   }
-
+   /* focus to current color */
+   if (tgpk->palette->active_color == i) {
+   gp_draw_fill_box(>rect, select, select, 2);
+   }
 
+   gp_draw_fill_box(>rect, col->rgba, col->fill, 0);
+   gp_draw_boxlines(>rect, line);
+   }
 }
 
 /* Drawing callback for modal operator in 3d mode */
 static void 

[Bf-blender-cvs] [5d2975382c4] greasepencil-object: Set color function

2018-01-10 Thread Antonio Vazquez
Commit: 5d2975382c41fe5eb7ed583dab93fc0ab9d6af5a
Author: Antonio Vazquez
Date:   Wed Jan 10 19:09:36 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5d2975382c41fe5eb7ed583dab93fc0ab9d6af5a

Set color function

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
index 460869481c3..fab0e262ace 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -407,6 +407,22 @@ static int gpencil_colorpick_invoke(bContext *C, 
wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL;
 }
 
+/* set active color */
+static bool set_color(const wmEvent *event, tGPDpick *tgpk)
+{
+   tGPDpickColor *tcol = tgpk->colors;
+   for (int i = 0; i < tgpk->totcolor; i++, tcol++) {
+   if ((event->mval[0] >= tcol->rect.xmin) && (event->mval[0] <= 
tcol->rect.xmax) &&
+   (event->mval[1] >= tcol->rect.ymin) && (event->mval[1] 
<= tcol->rect.ymax))
+   {
+   tgpk->palette->active_color = tcol->index;
+   return true;
+   }
+   }
+
+   return false;
+}
+
 /* events handling during interactive part of operator */
 static int gpencil_colorpick_modal(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
@@ -432,7 +448,9 @@ static int gpencil_colorpick_modal(bContext *C, wmOperator 
*op, const wmEvent *e
}
break;
case LEFTMOUSE:
-   estate = OPERATOR_FINISHED;
+   if (set_color(event, tgpk) == true) {
+   estate = OPERATOR_FINISHED;
+   }
break;
}
/* process last operations before exiting */

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


[Bf-blender-cvs] [2549076da17] greasepencil-object: WIP: Basic structure for new Color PIcker

2018-01-10 Thread Antonio Vazquez
Commit: 2549076da179695ec571c635472203e001c11749
Author: Antonio Vazquez
Date:   Tue Jan 9 19:36:27 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB2549076da179695ec571c635472203e001c11749

WIP: Basic structure for new Color PIcker

This operator is enabled using F6.

===

M   source/blender/editors/gpencil/CMakeLists.txt
A   source/blender/editors/gpencil/gpencil_colorpick.c
M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_ops.c
M   source/blender/editors/include/ED_gpencil.h

===

diff --git a/source/blender/editors/gpencil/CMakeLists.txt 
b/source/blender/editors/gpencil/CMakeLists.txt
index f6dd388b129..b7c39b8f2f2 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -51,6 +51,7 @@ set(SRC
gpencil_ops.c
gpencil_paint.c
gpencil_fill.c
+   gpencil_colorpick.c
gpencil_select.c
gpencil_undo.c
gpencil_utils.c
diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
new file mode 100644
index 000..c230274ad7f
--- /dev/null
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -0,0 +1,339 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2017, Blender Foundation, Joshua Leung
+ * This is a new part of Blender
+ *
+ * Contributor(s): Antonio Vazquez
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+/** \file blender/editors/gpencil/gpencil_colorpick.c
+ *  \ingroup edgpencil
+ */
+
+#include 
+
+#include "MEM_guardedalloc.h" 
+
+#include "BLI_utildefines.h"
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "BLI_stack.h"
+
+#include "BLT_translation.h"
+
+#include "DNA_object_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "BKE_main.h" 
+#include "BKE_image.h" 
+#include "BKE_gpencil.h"
+#include "BKE_context.h"
+#include "BKE_screen.h"
+#include "BKE_paint.h" 
+#include "BKE_report.h" 
+
+#include "ED_gpencil.h"
+#include "ED_screen.h"
+#include "ED_space_api.h" 
+#include "ED_view3d.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+#include "GPU_immediate.h"
+#include "GPU_draw.h"
+#include "GPU_matrix.h"
+#include "GPU_framebuffer.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "gpencil_intern.h"
+
+ /* draw a filled box */
+static void gp_draw_fill_box(rcti *box, float ink[4], float fill[4])
+{
+   Gwn_VertFormat *format = immVertexFormat();
+   unsigned pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, 
GWN_FETCH_FLOAT);
+   unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 
4, GWN_FETCH_FLOAT);
+
+   immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+   
+   /* draw stroke curve */
+   glLineWidth(1.0f);
+   immBeginAtMost(GWN_PRIM_TRIS, 6);
+
+   /* First triangle */
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmin, box->ymin);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmin, box->ymax);
+
+   immAttrib4fv(color, ink);
+   immVertex2f(pos, box->xmax, box->ymax);
+
+   /* Second triangle */
+   immAttrib4fv(color, fill);
+   immVertex2f(pos, box->xmin, box->ymin);
+
+   immAttrib4fv(color, fill);
+   immVertex2f(pos, box->xmax, box->ymax);
+
+   immAttrib4fv(color, fill);
+   immVertex2f(pos, box->xmax, box->ymin);
+
+   immEnd();
+   immUnbindProgram();
+}
+
+/* --- */
+/* Drawing */
+/* Helper: Draw status message while the user is running the operator */
+static void gpencil_colorpick_status_indicators(tGPDpick *tgpk)
+{
+   Scene *scene = tgpk->scene;
+   char status_str[UI_MAX_DRAW_STR];
+
+   BLI_snprintf(status_str, sizeof(status_str), IFACE_("Select: ESC/RMB 
cancel, LMB Select color"));
+   ED_area_headerprint(tgpk->sa, status_str);
+}
+
+/* draw a 

[Bf-blender-cvs] [3138d4468eb] greasepencil-object: WIP: Display colors bar

2018-01-10 Thread Antonio Vazquez
Commit: 3138d4468ebc90b844c47bbc1234d1a8fe3ef1c2
Author: Antonio Vazquez
Date:   Wed Jan 10 11:17:36 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB3138d4468ebc90b844c47bbc1234d1a8fe3ef1c2

WIP: Display colors bar

Basic display of colors.

Still the selector is not working.

===

M   source/blender/editors/gpencil/gpencil_colorpick.c
M   source/blender/editors/include/ED_gpencil.h

===

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c 
b/source/blender/editors/gpencil/gpencil_colorpick.c
index c230274ad7f..c6baaa7a433 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -74,6 +74,9 @@
 
 #include "gpencil_intern.h"
 
+#define GP_BOX_SIZE 24
+#define GP_BOX_GAP 4
+
  /* draw a filled box */
 static void gp_draw_fill_box(rcti *box, float ink[4], float fill[4])
 {
@@ -129,17 +132,20 @@ static void gpencil_draw_color_table(const bContext 
*UNUSED(C), tGPDpick *tgpk)
if (!tgpk->palette) {
return;
}
-   rcti box;
-   box.xmin = tgpk->rect.xmax - 100;
-   box.ymin = tgpk->rect.ymin;
-   box.xmax = tgpk->rect.xmax;
-   box.ymax = tgpk->rect.ymax;
 
float ink[4];
+   
+   /* draw panel background */
UI_GetThemeColor4fv(TH_PANEL_BACK, ink);
+   gp_draw_fill_box(>panel, ink, ink);
+
+   /* draw color boxes */
+   tGPDpickColor *col = tgpk->colors;
+   for (int i = 0; i < tgpk->totcolor; i++, col++) {
+   gp_draw_fill_box(>rect, col->rgba, col->fill);
+   }
+
 
-   //float ink[4] = { 1.0, 0.0f, 0.0f, 1.0f };
-   gp_draw_fill_box(, ink, ink);
 }
 
 /* Drawing callback for modal operator in 3d mode */
@@ -184,11 +190,6 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, 
wmOperator *op)
tgpk->ob = CTX_data_active_object(C);
tgpk->sa = CTX_wm_area(C);
tgpk->ar = CTX_wm_region(C);
-   tgpk->eval_ctx = bmain->eval_ctx;
-   tgpk->rv3d = tgpk->ar->regiondata;
-   tgpk->v3d = tgpk->sa->spacedata.first;
-   tgpk->graph = CTX_data_depsgraph(C);
-   tgpk->win = CTX_wm_window(C);
 
ED_region_visible_rect(tgpk->ar, >rect);
 
@@ -196,6 +197,63 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, 
wmOperator *op)
bGPDpaletteref *palslot = BKE_gpencil_paletteslot_validate(bmain, gpd);
tgpk->palette = palslot->palette;
 
+   /* allocate color table */
+   tgpk->totcolor = BLI_listbase_count(>palette->colors);
+   if (tgpk->totcolor > 0) {
+   tgpk->colors = MEM_callocN(sizeof(tGPDpickColor) * 
tgpk->totcolor, "gp_colorpicker");
+   }
+
+   /* set size of color box */
+   tgpk->boxsize[0] = GP_BOX_SIZE + GP_BOX_GAP;
+   tgpk->boxsize[1] = GP_BOX_SIZE + GP_BOX_GAP;
+
+   /* get number of rows and columns */
+   tgpk->row = (tgpk->rect.ymax - tgpk->rect.ymin - GP_BOX_GAP) / 
tgpk->boxsize[1];
+   CLAMP_MIN(tgpk->row, 1);
+   tgpk->col = tgpk->totcolor / tgpk->row;
+   if (tgpk->totcolor % tgpk->row > 0) {
+   tgpk->col++;
+   }
+   CLAMP_MIN(tgpk->col, 1);
+
+   /* define panel size (vertical right) */
+   tgpk->panel.xmin = tgpk->rect.xmax - (GP_BOX_SIZE * tgpk->col ) - 
(GP_BOX_GAP * 2);
+   tgpk->panel.ymin = tgpk->rect.ymin;
+   tgpk->panel.xmax = tgpk->rect.xmax;
+   tgpk->panel.ymax = tgpk->rect.ymax;
+
+   /* load color table */
+   tGPDpickColor *col = tgpk->colors;
+   int idx = tgpk->totcolor - 1;
+   for (int r = 0; r < tgpk->row; r++) {
+   for (int c = 0; c < tgpk->col; c++, col++) {
+   PaletteColor *palcol = 
BLI_rfindlink(>palette->colors, idx);
+   
+   /* exit if colors completed */
+   if (!palcol) {
+   break;
+   }
+
+   col->index = idx;
+   copy_v4_v4(col->rgba, palcol->rgb);
+   if (palcol->fill[3] > 0.0f) {
+   copy_v4_v4(col->fill, palcol->fill);
+   }
+   else {
+   copy_v4_v4(col->fill, palcol->rgb);
+   }
+   
+   /* box position */
+   col->rect.xmin = tgpk->panel.xmin + (tgpk->boxsize[0] * 
c) + GP_BOX_GAP;
+   col->rect.xmax = col->rect.xmin + tgpk->boxsize[0] - 
(GP_BOX_GAP * 2);
+
+   col->rect.ymax = tgpk->panel.ymax - (tgpk->boxsize[1] * 
r) - GP_BOX_GAP;
+   col->rect.ymin = col->rect.ymax - tgpk->boxsize[0] + 
(GP_BOX_GAP * 2);
+
+   idx--;
+   }
+   }
+
/* return context data 

[Bf-blender-cvs] [50da4885c9a] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

2018-01-10 Thread Antonio Vazquez
Commit: 50da4885c9af4f4883388ac0cd1e951bc867b945
Author: Antonio Vazquez
Date:   Wed Jan 10 19:27:26 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB50da4885c9af4f4883388ac0cd1e951bc867b945

Merge branch 'blender2.8' into greasepencil-object

===



===



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


[Bf-blender-cvs] [f0610563ee5] master: math utils: Add size_t version of min and max functions

2018-01-10 Thread Sergey Sharybin
Commit: f0610563ee5055a668be9a01f81bfe59b76355b0
Author: Sergey Sharybin
Date:   Thu Dec 21 10:39:15 2017 +0100
Branches: master
https://developer.blender.org/rBf0610563ee5055a668be9a01f81bfe59b76355b0

math utils: Add size_t version of min and max functions

===

M   source/blender/blenlib/BLI_math_base.h
M   source/blender/blenlib/intern/math_base_inline.c

===

diff --git a/source/blender/blenlib/BLI_math_base.h 
b/source/blender/blenlib/BLI_math_base.h
index e6a72298ae7..cb3dc960042 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -129,6 +129,9 @@ MINLINE int max_iii(int a, int b, int c);
 MINLINE int min_(int a, int b, int c, int d);
 MINLINE int max_(int a, int b, int c, int d);
 
+MINLINE size_t min_zz(size_t a, size_t b);
+MINLINE size_t max_zz(size_t a, size_t b);
+
 MINLINE int compare_ff(float a, float b, const float max_diff);
 MINLINE int compare_ff_relative(float a, float b, const float max_diff, const 
int max_ulps);
 
diff --git a/source/blender/blenlib/intern/math_base_inline.c 
b/source/blender/blenlib/intern/math_base_inline.c
index 749c18fc0ce..9202efce7b4 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -315,6 +315,15 @@ MINLINE int max_(int a, int b, int c, int d)
return max_ii(max_iii(a, b, c), d);
 }
 
+MINLINE size_t min_zz(size_t a, size_t b)
+{
+   return (a < b) ? a : b;
+}
+MINLINE size_t max_zz(size_t a, size_t b)
+{
+   return (b < a) ? a : b;
+}
+
 /**
  * Almost-equal for IEEE floats, using absolute difference method.
  *

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


[Bf-blender-cvs] [f68b2fd2331] master: RNA: Increase memory limit settings to their possible max on platform

2018-01-10 Thread Sergey Sharybin
Commit: f68b2fd23312910fac1241d90f211b1bd41fc83c
Author: Sergey Sharybin
Date:   Thu Dec 21 11:07:59 2017 +0100
Branches: master
https://developer.blender.org/rBf68b2fd23312910fac1241d90f211b1bd41fc83c

RNA: Increase memory limit settings to their possible max on platform

This is quite common to have 64GB memory now, and even 128. There is no reason
to add any artificial caps on the cache and undo memory here. We can not protect
against using too much memory in one cases and allow use of full computer
potential in others.

Now 32 bit will use 2GB max (as it used to be), but 64bit will use whatever
number of megabytes fits into integer.

Reviewers: campbellbarton, mont29

Subscribers: sebastian_k

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

===

M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index f0313601c3a..71c53579585 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -24,6 +24,7 @@
  *  \ingroup RNA
  */
 
+#include 
 #include 
 
 #include "DNA_curve_types.h"
@@ -34,6 +35,7 @@
 #include "DNA_scene_types.h"
 
 #include "BLI_utildefines.h"
+#include "BLI_math_base.h"
 
 #include "BKE_appdir.h"
 #include "BKE_DerivedMesh.h"
@@ -670,6 +672,27 @@ static StructRNA *rna_AddonPref_refine(PointerRNA *ptr)
 
 #else
 
+/* TODO(sergey): This technically belongs to blenlib, but we don't link
+ * makesrna against it.
+ */
+
+/* Get maximum addressable memory in megabytes, */
+static size_t max_memory_in_megabytes(void)
+{
+   /* Maximum addressable bytes on this platform. */
+   const size_t limit_bytes = (((size_t)1) << ((sizeof(size_t) * 8) - 1));
+   /* Convert it to megabytes and return. */
+   return (limit_bytes >> 20);
+}
+
+/* Same as above, but clipped to int capacity. */
+static int max_memory_in_megabytes_int(void)
+{
+   const size_t limit_megabytes = max_memory_in_megabytes();
+   /* NOTE: The result will fit into integer. */
+   return (int)min_zz(limit_megabytes, (size_t)INT_MAX);
+}
+
 static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
 {
StructRNA *srna;
@@ -3644,7 +3667,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 
prop = RNA_def_property(srna, "undo_memory_limit", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "undomemory");
-   RNA_def_property_range(prop, 0, 32767);
+   RNA_def_property_range(prop, 0, max_memory_in_megabytes_int());
RNA_def_property_ui_text(prop, "Undo Memory Size", "Maximum memory 
usage in megabytes (0 means unlimited)");
 
prop = RNA_def_property(srna, "use_global_undo", PROP_BOOLEAN, 
PROP_NONE);
@@ -4054,7 +4077,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 
prop = RNA_def_property(srna, "memory_cache_limit", PROP_INT, 
PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "memcachelimit");
-   RNA_def_property_range(prop, 0, (sizeof(void *) == 8) ? 1024 * 32 : 
1024); /* 32 bit 2 GB, 64 bit 32 GB */
+   RNA_def_property_range(prop, 0, max_memory_in_megabytes_int());
RNA_def_property_ui_text(prop, "Memory Cache Limit", "Memory cache 
limit (in megabytes)");
RNA_def_property_update(prop, 0, "rna_Userdef_memcache_update");

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


[Bf-blender-cvs] [f59303bead2] blender2.8: Fix color for manipulator drawing

2018-01-10 Thread Campbell Barton
Commit: f59303bead2ae4a25132edadf217a64cdd581dc5
Author: Campbell Barton
Date:   Wed Jan 10 20:50:14 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBf59303bead2ae4a25132edadf217a64cdd581dc5

Fix color for manipulator drawing

Was drawing black after the first draw call.
For now set the shader before each draw call,
noted as TODO to investigate a nicer way to handle.

===

M   release/scripts/modules/bpy_types.py
M   release/scripts/templates_py/manipulator_custom_geometry.py
M   source/blender/python/gawain/gwn_py_types.c

===

diff --git a/release/scripts/modules/bpy_types.py 
b/release/scripts/modules/bpy_types.py
index 78c70225a04..6b06ff77ecd 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -644,6 +644,11 @@ class Manipulator(StructRNA, metaclass=OrderedMeta):
 if matrix is None:
 matrix = self.matrix_world
 
+batch, dims = shape
+
+# XXX, can we avoid setting the shader every time?
+batch.program_set_builtin('3D_UNIFORM_COLOR' if dims == 3 else 
'2D_UNIFORM_COLOR')
+
 if select_id is not None:
 gpu.select.load_id(select_id)
 else:
@@ -651,11 +656,11 @@ class Manipulator(StructRNA, metaclass=OrderedMeta):
 color = (*self.color_highlight, self.alpha_highlight)
 else:
 color = (*self.color, self.alpha)
-shape.uniform_f32("color", *color)
+batch.uniform_f32("color", *color)
 
 with gpu.matrix.push_pop():
 gpu.matrix.multiply_matrix(matrix)
-shape.draw()
+batch.draw()
 
 @staticmethod
 def new_custom_shape(type, verts):
@@ -684,8 +689,7 @@ class Manipulator(StructRNA, metaclass=OrderedMeta):
 vbo = Gwn_VertBuf(len=len(verts), format=fmt)
 vbo.fill(id=pos_id, data=verts)
 batch = Gwn_Batch(type=type, buf=vbo)
-batch.program_set_builtin('3D_UNIFORM_COLOR' if dims == 3 else 
'2D_UNIFORM_COLOR')
-return batch
+return (batch, dims)
 
 
 # Only defined so operators members can be used by accessing self.order
diff --git a/release/scripts/templates_py/manipulator_custom_geometry.py 
b/release/scripts/templates_py/manipulator_custom_geometry.py
index 0f1ab72f9ef..48bb6956f85 100644
--- a/release/scripts/templates_py/manipulator_custom_geometry.py
+++ b/release/scripts/templates_py/manipulator_custom_geometry.py
@@ -134,7 +134,7 @@ class MyCustomShapeWidgetGroup(ManipulatorGroup):
 mpr.color = 1.0, 0.5, 1.0
 mpr.alpha = 0.5
 
-mpr.color_highlight = 1.0, 0.5, 1.0
+mpr.color_highlight = 1.0, 1.0, 1.0
 mpr.alpha_highlight = 0.5
 
 # units are large, so shrink to something more reasonable.
diff --git a/source/blender/python/gawain/gwn_py_types.c 
b/source/blender/python/gawain/gwn_py_types.c
index 5b602e85a12..4f6b354b7be 100644
--- a/source/blender/python/gawain/gwn_py_types.c
+++ b/source/blender/python/gawain/gwn_py_types.c
@@ -634,7 +634,7 @@ static PyObject *bpygwn_VertBatch_uniform_i32(BPyGwn_Batch 
*self, PyObject *args
 
 static PyObject *bpygwn_VertBatch_uniform_f32(BPyGwn_Batch *self, PyObject 
*args)
 {
-   static struct {
+   struct {
const char *id;
float values[4];
} params;
@@ -648,10 +648,10 @@ static PyObject 
*bpygwn_VertBatch_uniform_f32(BPyGwn_Batch *self, PyObject *args
}
 
switch (PyTuple_GET_SIZE(args)) {
-   case 2: GWN_batch_uniform_1f(self->batch,  params.id,  
params.values[0]); break;
-   case 3: GWN_batch_uniform_2fv(self->batch, params.id, 
params.values); break;
-   case 4: GWN_batch_uniform_3fv(self->batch, params.id, 
params.values); break;
-   case 5: GWN_batch_uniform_4fv(self->batch, params.id, 
params.values); break;
+   case 2: GWN_batch_uniform_1f(self->batch, params.id, 
params.values[0]); break;
+   case 3: GWN_batch_uniform_2f(self->batch, params.id, 
UNPACK2(params.values)); break;
+   case 4: GWN_batch_uniform_3f(self->batch, params.id, 
UNPACK3(params.values)); break;
+   case 5: GWN_batch_uniform_4f(self->batch, params.id, 
UNPACK4(params.values)); break;
default:
BLI_assert(0);
}

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


[Bf-blender-cvs] [518c65460e8] master: Task scheduler: Use more const qualifiers

2018-01-10 Thread Sergey Sharybin
Commit: 518c65460e8843e425fee2161b407e1f8e9e4281
Author: Sergey Sharybin
Date:   Wed Jan 10 12:27:43 2018 +0100
Branches: master
https://developer.blender.org/rB518c65460e8843e425fee2161b407e1f8e9e4281

Task scheduler: Use more const qualifiers

===

M   source/blender/blenlib/intern/task.c

===

diff --git a/source/blender/blenlib/intern/task.c 
b/source/blender/blenlib/intern/task.c
index 29daac1ae48..a41e4f01352 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -1029,7 +1029,7 @@ static void parallel_range_func(
}
 }
 
-static void palallel_range_single_thread(int start, int stop,
+static void palallel_range_single_thread(const int start, int const stop,
  void *userdata,
  TaskParallelRangeFunc func,
  const ParallelRangeSettings *settings)

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


[Bf-blender-cvs] [2737837b09d] master: Fix wrong data type used for undo memory limit

2018-01-10 Thread Sergey Sharybin
Commit: 2737837b09d7b9434c33acf98421967193b7c9df
Author: Sergey Sharybin
Date:   Wed Jan 10 13:20:36 2018 +0100
Branches: master
https://developer.blender.org/rB2737837b09d7b9434c33acf98421967193b7c9df

Fix wrong data type used for undo memory limit

===

M   source/blender/makesdna/DNA_userdef_types.h

===

diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 84818fe79c2..ae6907d256a 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -492,7 +492,9 @@ typedef struct UserDef {
char keyconfigstr[64];

short undosteps;
-   short undomemory;
+   short pad1;
+   int undomemory;
+   int pad3;
short gp_manhattendist, gp_euclideandist, gp_eraser;
short gp_settings;  /* eGP_UserdefSettings */
short tb_leftmouse, tb_rightmouse;

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


[Bf-blender-cvs] [181124ad135] blender2.8: Fix compilation error

2018-01-10 Thread Sergey Sharybin
Commit: 181124ad1352b19d82e178f302dd4b5c178e54ce
Author: Sergey Sharybin
Date:   Wed Jan 10 14:15:04 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB181124ad1352b19d82e178f302dd4b5c178e54ce

Fix compilation error

Seems of new padding were added in 2.8 branch.

===

M   source/blender/makesdna/DNA_userdef_types.h

===

diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 896ae76a407..89761ee6ced 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -510,7 +510,7 @@ typedef struct UserDef {
short tb_leftmouse, tb_rightmouse;
struct SolidLight light[3];
short manipulator_flag, manipulator_size;
-   int pad3;
+   int pad6;
short textimeout, texcollectrate;
short wmdrawmethod; /* eWM_DrawMethod */
short dragthreshold;

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


[Bf-blender-cvs] [76bdd40bfdc] master: Subsurf: Loop array should not be called mv

2018-01-10 Thread Sergey Sharybin
Commit: 76bdd40bfdc7a212c70c2032edaa6faef1423c9f
Author: Sergey Sharybin
Date:   Wed Jan 10 14:58:49 2018 +0100
Branches: master
https://developer.blender.org/rB76bdd40bfdc7a212c70c2032edaa6faef1423c9f

Subsurf: Loop array should not be called mv

mv is a mesh vertex, not loop.

===

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

===

diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c 
b/source/blender/blenkernel/intern/subsurf_ccg.c
index ef2a2db4bf9..d2f325fb3c4 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1484,7 +1484,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, 
MLoop *mloop)
int totface;
int gridSize = ccgSubSurf_getGridSize(ss);
int edgeSize = ccgSubSurf_getEdgeSize(ss);
-   MLoop *mv;
+   MLoop *ml;
/* DMFlagMat *faceFlags = ccgdm->faceFlags; */ /* UNUSED */
 
if (!ccgdm->ehash) {
@@ -1507,7 +1507,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, 
MLoop *mloop)
 
BLI_rw_mutex_lock(>loops_cache_rwlock, THREAD_LOCK_READ);
totface = ccgSubSurf_getNumFaces(ss);
-   mv = mloop;
+   ml = mloop;
for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
@@ -1529,21 +1529,21 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, 
MLoop *mloop)
v4 = getFaceIndex(ss, f, S, x + 1, y + 
0,
  edgeSize, gridSize);
 
-   mv->v = v1;
-   mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
-   mv++;
+   ml->v = v1;
+   ml->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
+   ml++;
 
-   mv->v = v2;
-   mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
-   mv++;
+   ml->v = v2;
+   ml->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
+   ml++;
 
-   mv->v = v3;
-   mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
-   mv++;
+   ml->v = v3;
+   ml->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
+   ml++;
 
-   mv->v = v4;
-   mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
-   mv++;
+   ml->v = v4;
+   ml->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
+   ml++;
}
}
}

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


[Bf-blender-cvs] [fca202566fb] master: Subsurf: Remove increment of unused variable

2018-01-10 Thread Sergey Sharybin
Commit: fca202566fb0d73aca46d8f68c8e8dd33d421c09
Author: Sergey Sharybin
Date:   Wed Jan 10 14:58:09 2018 +0100
Branches: master
https://developer.blender.org/rBfca202566fb0d73aca46d8f68c8e8dd33d421c09

Subsurf: Remove increment of unused variable

===

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

===

diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c 
b/source/blender/blenkernel/intern/subsurf_ccg.c
index ecb0f76fd62..ef2a2db4bf9 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1484,7 +1484,6 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, 
MLoop *mloop)
int totface;
int gridSize = ccgSubSurf_getGridSize(ss);
int edgeSize = ccgSubSurf_getEdgeSize(ss);
-   int i = 0;
MLoop *mv;
/* DMFlagMat *faceFlags = ccgdm->faceFlags; */ /* UNUSED */
 
@@ -1497,7 +1496,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, 
MLoop *mloop)
ehash = BLI_edgehash_new_ex(__func__, 
ccgdm->dm.numEdgeData);
medge = ccgdm->dm.getEdgeArray((DerivedMesh *)ccgdm);
 
-   for (i = 0; i < ccgdm->dm.numEdgeData; i++) {
+   for (int i = 0; i < ccgdm->dm.numEdgeData; i++) {
BLI_edgehash_insert(ehash, medge[i].v1, 
medge[i].v2, SET_INT_IN_POINTER(i));
}
 
@@ -1532,19 +1531,19 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, 
MLoop *mloop)
 
mv->v = v1;
mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
-   mv++; i++;
+   mv++;
 
mv->v = v2;
mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
-   mv++; i++;
+   mv++;
 
mv->v = v3;
mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
-   mv++; i++;
+   mv++;
 
mv->v = v4;
mv->e = 
GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
-   mv++; i++;
+   mv++;
}
}
}

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


[Bf-blender-cvs] [f21f18b572e] master: Task scheduler: Use const qualifier in callbacks for parallel range

2018-01-10 Thread Sergey Sharybin
Commit: f21f18b572e4fa025516995ddfa6a7c04bdb5907
Author: Sergey Sharybin
Date:   Wed Jan 10 12:53:59 2018 +0100
Branches: master
https://developer.blender.org/rBf21f18b572e4fa025516995ddfa6a7c04bdb5907

Task scheduler: Use const qualifier in callbacks for parallel range

===

M   source/blender/blenkernel/intern/CCGSubSurf_legacy.c
M   source/blender/blenkernel/intern/mask_rasterize.c
M   source/blender/blenkernel/intern/tracking_auto.c
M   source/blender/blenkernel/intern/tracking_stabilize.c
M   source/blender/bmesh/intern/bmesh_interp.c
M   source/blender/depsgraph/intern/eval/deg_eval.cc
M   source/blender/depsgraph/intern/eval/deg_eval_flush.cc

===

diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c 
b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
index d289f63dac1..d567b50af56 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
@@ -138,7 +138,7 @@ typedef struct CCGSubSurfCalcSubdivData {
 
 static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(
 void *__restrict userdata,
-int ptrIdx,
+const int ptrIdx,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
@@ -232,7 +232,7 @@ static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(
 
 static void ccgSubSurf__calcVertNormals_faces_finalize_cb(
 void *__restrict userdata,
-int ptrIdx,
+const int ptrIdx,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
@@ -273,7 +273,7 @@ static void ccgSubSurf__calcVertNormals_faces_finalize_cb(
 
 static void ccgSubSurf__calcVertNormals_edges_accumulate_cb(
 void *__restrict userdata,
-int ptrIdx,
+const int ptrIdx,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
@@ -422,7 +422,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 
 static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(
 void *__restrict userdata,
-int ptrIdx,
+const int ptrIdx,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
@@ -512,7 +512,7 @@ static void 
ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(
 
 static void 
ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_cb(
 void *__restrict userdata,
-int ptrIdx,
+const int ptrIdx,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
@@ -620,7 +620,7 @@ static void 
ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_
 
 static void ccgSubSurf__calcSubdivLevel_verts_copydata_cb(
 void *__restrict userdata,
-int ptrIdx,
+const int ptrIdx,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c 
b/source/blender/blenkernel/intern/mask_rasterize.c
index 093a1967ae8..76d16334630 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -1436,7 +1436,7 @@ typedef struct MaskRasterizeBufferData {
 
 static void maskrasterize_buffer_cb(
 void *__restrict userdata,
-int y,
+const int y,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
MaskRasterizeBufferData *data = userdata;
diff --git a/source/blender/blenkernel/intern/tracking_auto.c 
b/source/blender/blenkernel/intern/tracking_auto.c
index d297a92f29e..1cb474e6202 100644
--- a/source/blender/blenkernel/intern/tracking_auto.c
+++ b/source/blender/blenkernel/intern/tracking_auto.c
@@ -434,7 +434,7 @@ AutoTrackContext *BKE_autotrack_context_new(MovieClip *clip,
 
 static void autotrack_context_step_cb(
 void *__restrict userdata,
-int track,
+const int track,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
AutoTrackContext *context = userdata;
diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c 
b/source/blender/blenkernel/intern/tracking_stabilize.c
index bd83c2eb6dc..cbf1a02a46c 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -1505,7 +1505,7 @@ typedef struct TrackingStabilizeFrameInterpolationData {
 
 static void tracking_stabilize_frame_interpolation_cb(
 void *__restrict userdata,
-int j,
+const int j,
 const ParallelRangeTLS *__restrict UNUSED(tls))
 {
TrackingStabilizeFrameInterpolationData *data = userdata;
diff --git a/source/blender/bmesh/intern/bmesh_interp.c 

[Bf-blender-cvs] [56141937454] master: Task scheduler: Use restrict pointer qualifier

2018-01-10 Thread Sergey Sharybin
Commit: 561419374549201845bdd58e7329f61eef574f7f
Author: Sergey Sharybin
Date:   Wed Jan 10 12:49:51 2018 +0100
Branches: master
https://developer.blender.org/rB561419374549201845bdd58e7329f61eef574f7f

Task scheduler: Use restrict pointer qualifier

Those pointers are never to be aliased, so let's be explicit about this and hope
compiler does save some CPU ticks.

===

M   source/blender/blenkernel/intern/CCGSubSurf_legacy.c
M   source/blender/blenkernel/intern/colortools.c
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/blenkernel/intern/mask_rasterize.c
M   source/blender/blenkernel/intern/mesh_evaluate.c
M   source/blender/blenkernel/intern/ocean.c
M   source/blender/blenkernel/intern/particle_system.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/shrinkwrap.c
M   source/blender/blenkernel/intern/smoke.c
M   source/blender/blenkernel/intern/tracking_auto.c
M   source/blender/blenkernel/intern/tracking_stabilize.c
M   source/blender/blenlib/BLI_task.h
M   source/blender/blenlib/intern/BLI_kdopbvh.c
M   source/blender/blenlib/intern/math_statistics.c
M   source/blender/bmesh/intern/bmesh_interp.c
M   source/blender/depsgraph/intern/eval/deg_eval.cc
M   source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M   source/blender/editors/sculpt_paint/paint_cursor.c
M   source/blender/editors/sculpt_paint/paint_image_2d.c
M   source/blender/editors/sculpt_paint/paint_mask.c
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   source/blender/editors/space_sequencer/sequencer_scopes.c
M   source/blender/modifiers/intern/MOD_displace.c
M   source/blender/modifiers/intern/MOD_meshdeform.c
M   source/blender/modifiers/intern/MOD_ocean.c
M   source/blender/modifiers/intern/MOD_surfacedeform.c
M   source/blender/modifiers/intern/MOD_uvwarp.c
M   source/blender/modifiers/intern/MOD_weightvgproximity.c
M   source/blender/render/intern/source/pointdensity.c

===

diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c 
b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
index 363b7cff453..d289f63dac1 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
@@ -136,8 +136,10 @@ typedef struct CCGSubSurfCalcSubdivData {
int curLvl;
 } CCGSubSurfCalcSubdivData;
 
-static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(void *userdata, 
int ptrIdx,
-const 
ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(
+void *__restrict userdata,
+int ptrIdx,
+const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -228,8 +230,10 @@ static void 
ccgSubSurf__calcVertNormals_faces_accumulate_cb(void *userdata, int
}
 }
 
-static void ccgSubSurf__calcVertNormals_faces_finalize_cb(void *userdata, int 
ptrIdx,
-  const 
ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcVertNormals_faces_finalize_cb(
+void *__restrict userdata,
+int ptrIdx,
+const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -267,8 +271,10 @@ static void 
ccgSubSurf__calcVertNormals_faces_finalize_cb(void *userdata, int pt
}
 }
 
-static void ccgSubSurf__calcVertNormals_edges_accumulate_cb(void *userdata, 
int ptrIdx,
-const 
ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcVertNormals_edges_accumulate_cb(
+void *__restrict userdata,
+int ptrIdx,
+const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -414,8 +420,10 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 }
 
 
-static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(void 
*userdata, int ptrIdx,
-  
const ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(
+void *__restrict userdata,
+int ptrIdx,
+const ParallelRangeTLS *__restrict UNUSED(tls))
 {
CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -502,8 +510,10 @@ static void 
ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(void *
}
 }
 
-static void 
ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_cb(void 
*userdata, int ptrIdx,
-  

[Bf-blender-cvs] [5d38c141168] blender2.8: Merge branch 'master' into blender2.8

2018-01-10 Thread Sergey Sharybin
Commit: 5d38c141168fcc4dc6aa61ee62a28d59dedf889a
Author: Sergey Sharybin
Date:   Wed Jan 10 13:22:03 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB5d38c141168fcc4dc6aa61ee62a28d59dedf889a

Merge branch 'master' into blender2.8

===



===

diff --cc source/blender/depsgraph/intern/eval/deg_eval.cc
index 38a7470c0ec,76e76b5eb7b..116f853ebdf
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@@ -100,11 -104,13 +100,12 @@@ static void deg_task_run_func(TaskPool 
  
  typedef struct CalculatePengindData {
Depsgraph *graph;
 -  unsigned int layers;
  } CalculatePengindData;
  
- static void calculate_pending_func(void *data_v,
-int i,
-const ParallelRangeTLS * /*tls*/)
+ static void calculate_pending_func(
+ void *__restrict data_v,
+ const int i,
+ const ParallelRangeTLS *__restrict /*tls*/)
  {
CalculatePengindData *data = (CalculatePengindData *)data_v;
Depsgraph *graph = data->graph;
diff --cc source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 6dc35bb8aba,9e910afea07..c3b1f56a71b
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@@ -71,9 -70,23 +71,10 @@@ typedef std::dequerecalc |= ID_RECALC;
 -  DEG_id_type_tag(bmain, GS(id->name));
 -}
 -
 -void lib_id_recalc_data_tag(Main *bmain, ID *id)
 -{
 -  id->recalc |= ID_RECALC_DATA;
 -  DEG_id_type_tag(bmain, GS(id->name));
 -}
 -
+ void flush_init_operation_node_func(
+ void *__restrict data_v,
+ const int i,
+ const ParallelRangeTLS *__restrict /*tls*/)
  {
Depsgraph *graph = (Depsgraph *)data_v;
OperationDepsNode *node = graph->operations[i];
@@@ -289,12 -292,13 +291,13 @@@ void deg_graph_flush_updates(Main *bmai
}
}
/* Inform editors about all changes. */
 -  flush_editors_id_update(bmain, graph);
 +  flush_editors_id_update(bmain, graph, _ctx);
  }
  
- static void graph_clear_func(void *data_v,
-  int i,
-  const ParallelRangeTLS * /*tls*/)
+ static void graph_clear_func(
+ void *__restrict data_v,
+ const int i,
+ const ParallelRangeTLS *__restrict /*tls*/)
  {
Depsgraph *graph = (Depsgraph *)data_v;
OperationDepsNode *node = graph->operations[i];

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


[Bf-blender-cvs] [ee7042173c9] fracture_modifier: fixed a crasher when moving an object in dynamic fracture and when attempting to undo/redo FM removal

2018-01-10 Thread Martin Felke
Commit: ee7042173c985b781b0e6eadfa3b602e484236eb
Author: Martin Felke
Date:   Wed Jan 10 22:00:45 2018 +0100
Branches: fracture_modifier
https://developer.blender.org/rBee7042173c985b781b0e6eadfa3b602e484236eb

fixed a crasher when moving an object in dynamic fracture and when attempting 
to undo/redo FM removal

===

M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/editors/object/object_modifier.c

===

diff --git a/source/blender/blenkernel/intern/pointcache.c 
b/source/blender/blenkernel/intern/pointcache.c
index 8cedf8bec70..c34d1fe0cc0 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1304,8 +1304,8 @@ static int  ptcache_rigidbody_write(int index, void 
*rb_v, void **data, int cfra
float linvel[3] = {0.0f, 0.0f, 0.0f};
float angvel[3] = {0.0f, 0.0f, 0.0f};
 
-   //if (!rbw->cache_index_map || !rbw->cache_offset_map)
-   //  return 1;
+   if (!rbw->cache_index_map || !rbw->cache_offset_map)
+   return 1;
 
rbo = rbw->cache_index_map[index];

diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 54fd2b10e0a..a430dc44b4b 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -351,7 +351,7 @@ static bool object_modifier_remove(Main *bmain, Object *ob, 
ModifierData *md,
modifier_free(md);
BKE_object_free_derived_caches(ob);
 
-   if (do_rigidbody_cleanup)
+   if (do_rigidbody_cleanup && scene)
{
/* need to clean up modifier remainders inside the rigidbody 
world
 * AFTER the modifier is gone...  but only from the operator ?*/

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


[Bf-blender-cvs] [748e95ad50f] blender2.8: Fix crash when deleting collections

2018-01-10 Thread Julian Eisel
Commit: 748e95ad50f260dd67aa83927dd90b389a1f3c59
Author: Julian Eisel
Date:   Wed Jan 10 22:45:44 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB748e95ad50f260dd67aa83927dd90b389a1f3c59

Fix crash when deleting collections

With factory settings, steps to reproduce were:
* Select "Collection 1" (in "RenderLayer")
* Delete
It might crash at this point, although maybe this crash is ASAN only.

However, this was also doing some weird things that I've corrected now. It
called outliner_build_tree in an operator callback. This should only be
called in the main redraw function or so, not in regular handlers.
Instead, we manually cleanup the tree to keep it valid.

===

M   source/blender/editors/space_outliner/outliner_collections.c
M   source/blender/editors/space_outliner/outliner_intern.h
M   source/blender/editors/space_outliner/outliner_tree.c

===

diff --git a/source/blender/editors/space_outliner/outliner_collections.c 
b/source/blender/editors/space_outliner/outliner_collections.c
index 239e6a9b0fc..2f4d8cc60cb 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -628,6 +628,26 @@ static TreeTraversalAction 
collection_find_data_to_delete(TreeElement *te, void
}
else {
BLI_gset_add(data->collections_to_delete, scene_collection);
+   return TRAVERSE_SKIP_CHILDS; /* Childs will be gone anyway, no 
need to recurse deeper. */
+   }
+
+   return TRAVERSE_CONTINUE;
+}
+
+static TreeTraversalAction 
collection_delete_elements_from_collection(TreeElement *te, void *customdata)
+{
+   struct CollectionDeleteData *data = customdata;
+   SceneCollection *scene_collection = 
outliner_scene_collection_from_tree_element(te);
+
+   if (!scene_collection) {
+   return TRAVERSE_SKIP_CHILDS;
+   }
+
+   const bool will_be_deleted = 
BLI_gset_haskey(data->collections_to_delete, scene_collection);
+   if (will_be_deleted) {
+   outliner_free_tree_element(te, te->parent ? 
>parent->subtree : >soops->tree);
+   /* Childs are freed now, so don't recurse into them. */
+   return TRAVERSE_SKIP_CHILDS;
}
 
return TRAVERSE_CONTINUE;
@@ -635,9 +655,7 @@ static TreeTraversalAction 
collection_find_data_to_delete(TreeElement *te, void
 
 static int collection_delete_exec(bContext *C, wmOperator *UNUSED(op))
 {
-   Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
-   ViewLayer *view_layer = CTX_data_view_layer(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
struct CollectionDeleteData data = {.scene = scene, .soops = soops};
 
@@ -648,21 +666,20 @@ static int collection_delete_exec(bContext *C, wmOperator 
*UNUSED(op))
/* We first walk over and find the SceneCollections we actually want to 
delete (ignoring duplicates). */
outliner_tree_traverse(soops, >tree, 0, TSE_SELECTED, 
collection_find_data_to_delete, );
 
+   /* Now, delete all tree elements representing a collection that will be 
deleted. We'll look for a
+* new element to select in a few lines, so we can't wait until the 
tree is recreated on redraw. */
+   outliner_tree_traverse(soops, >tree, 0, 0, 
collection_delete_elements_from_collection, );
+
/* Effectively delete the collections. */
GSetIterator collections_to_delete_iter;
GSET_ITER(collections_to_delete_iter, data.collections_to_delete) {
-
SceneCollection *sc = 
BLI_gsetIterator_getKey(_to_delete_iter);
BKE_collection_remove(>id, sc);
}
 
BLI_gset_free(data.collections_to_delete, NULL);
 
-   /* Rebuild the outliner tree before we select the tree element */
-   outliner_build_tree(bmain, scene, view_layer, soops);
-
TreeElement *select_te = outliner_tree_element_from_layer_collection(C);
-
if (select_te) {
outliner_item_select(soops, select_te, false, false);
}
@@ -672,6 +689,7 @@ static int collection_delete_exec(bContext *C, wmOperator 
*UNUSED(op))
/* TODO(sergey): Use proper flag for tagging here. */
DEG_id_tag_update(>id, 0);
 
+   soops->storeflag |= SO_TREESTORE_REDRAW;
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
 
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_outliner/outliner_intern.h 
b/source/blender/editors/space_outliner/outliner_intern.h
index f2457b30a15..66f6c7026e6 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -178,8 +178,9 @@ typedef enum {
 
 /* outliner_tree.c --- */
 
-void outliner_free_tree(ListBase *lb);
+void 

[Bf-blender-cvs] [3f16810150c] blender2.8: Cleanup: Naming, avoid passing bContext to low-level function, etc

2018-01-10 Thread Julian Eisel
Commit: 3f16810150c0f6057d6e6354f5a97bc3f20a13eb
Author: Julian Eisel
Date:   Wed Jan 10 23:02:10 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB3f16810150c0f6057d6e6354f5a97bc3f20a13eb

Cleanup: Naming, avoid passing bContext to low-level function, etc

===

M   source/blender/editors/space_outliner/outliner_collections.c

===

diff --git a/source/blender/editors/space_outliner/outliner_collections.c 
b/source/blender/editors/space_outliner/outliner_collections.c
index 2f4d8cc60cb..fb89c1818ac 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -125,30 +125,28 @@ static SceneCollection 
*scene_collection_from_index(ListBase *lb, const int numb
 }
 
 typedef struct TreeElementFindData {
-   SceneCollection *sc;
-   TreeElement *te;
+   SceneCollection *collection;
+   TreeElement *r_result_te;
 } TreeElementFindData;
 
-static TreeTraversalAction tree_element_find_by_scene_collection(TreeElement 
*te, void *customdata)
+static TreeTraversalAction 
tree_element_find_by_scene_collection_cb(TreeElement *te, void *customdata)
 {
TreeElementFindData *data = customdata;
+   const SceneCollection *current_element_sc = 
outliner_scene_collection_from_tree_element(te);
 
-   SceneCollection *current_element_sc = 
outliner_scene_collection_from_tree_element(te);
-
-   if (current_element_sc == data->sc) {
-   data->te = te;
+   if (current_element_sc == data->collection) {
+   data->r_result_te = te;
return TRAVERSE_BREAK;
}
 
return TRAVERSE_CONTINUE;
 }
 
-static TreeElement *outliner_tree_element_from_layer_collection(bContext *C)
+static TreeElement *outliner_tree_element_from_layer_collection_index(
+SpaceOops *soops, ViewLayer *view_layer,
+const int index)
 {
-   ViewLayer *view_layer = CTX_data_view_layer(C);
-   SpaceOops *soops = CTX_wm_space_outliner(C);
-
-   LayerCollection *lc = BKE_layer_collection_from_index(view_layer, 0);
+   LayerCollection *lc = BKE_layer_collection_from_index(view_layer, 
index);
 
if (lc == NULL) {
return NULL;
@@ -156,12 +154,12 @@ static TreeElement 
*outliner_tree_element_from_layer_collection(bContext *C)
 
/* Find the tree element containing the LayerCollection's 
scene_collection. */
TreeElementFindData data = {
-   .sc = lc->scene_collection,
-   .te = NULL,
+   .collection = lc->scene_collection,
+   .r_result_te = NULL,
};
-   outliner_tree_traverse(soops, >tree, 0, 0, 
tree_element_find_by_scene_collection, );
+   outliner_tree_traverse(soops, >tree, 0, 0, 
tree_element_find_by_scene_collection_cb, );
 
-   return data.te;
+   return data.r_result_te;
 }
 
 static int collection_link_exec(bContext *C, wmOperator *op)
@@ -679,7 +677,7 @@ static int collection_delete_exec(bContext *C, wmOperator 
*UNUSED(op))
 
BLI_gset_free(data.collections_to_delete, NULL);
 
-   TreeElement *select_te = outliner_tree_element_from_layer_collection(C);
+   TreeElement *select_te = 
outliner_tree_element_from_layer_collection_index(soops, 
CTX_data_view_layer(C), 0);
if (select_te) {
outliner_item_select(soops, select_te, false, false);
}

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


[Bf-blender-cvs] [ac2ebf9c54a] master: Fix T53455: Object disappear w/ TrackTo constraint

2018-01-10 Thread Campbell Barton
Commit: ac2ebf9c54a9081662ab17f04240c00d9e5ac799
Author: Campbell Barton
Date:   Thu Jan 11 10:57:30 2018 +1100
Branches: master
https://developer.blender.org/rBac2ebf9c54a9081662ab17f04240c00d9e5ac799

Fix T53455: Object disappear w/ TrackTo constraint

Regression caused by own commit 16fbb47c886,
this is really an edge case though since calling normalize twice fixes.

===

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

===

diff --git a/source/blender/blenkernel/intern/constraint.c 
b/source/blender/blenkernel/intern/constraint.c
index a5d0df88198..c77cac7bcbd 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1018,8 +1018,11 @@ static void vectomat(const float vec[3], const float 
target_up[3], short axis, s
u[2] = 1;
}
 
+   /* note: even though 'n' is normalized, don't use 
'project_v3_v3v3_normalized' below
+* because precision issues cause a problem in near degenerate states, 
see: T53455. */
+
/* project the up vector onto the plane specified by n */
-   project_v3_v3v3_normalized(proj, u, n); /* first u onto n... */
+   project_v3_v3v3(proj, u, n); /* first u onto n... */
sub_v3_v3v3(proj, u, proj); /* then onto the plane */
/* proj specifies the transformation of the up axis */

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


[Bf-blender-cvs] [d0e0f33f57b] blender-v2.79a-release: Fix T53752: Draw curve fails w/ stylus

2018-01-10 Thread Philipp Oeser
Commit: d0e0f33f57b02fecf75c08f3c144d07915367781
Author: Philipp Oeser
Date:   Thu Jan 11 10:22:08 2018 +1100
Branches: blender-v2.79a-release
https://developer.blender.org/rBd0e0f33f57b02fecf75c08f3c144d07915367781

Fix T53752: Draw curve fails w/ stylus

===

M   source/blender/editors/curve/curve_ops.c

===

diff --git a/source/blender/editors/curve/curve_ops.c 
b/source/blender/editors/curve/curve_ops.c
index fce6425b9be..45239ab1706 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -239,6 +239,9 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "CURVE_OT_draw", ACTIONMOUSE, 
KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "wait_for_input", false);
 
+   kmi = WM_keymap_add_item(keymap, "CURVE_OT_draw", TABLET_STYLUS, 
KM_PRESS, KM_SHIFT, 0);
+   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
+
kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 
0, 0);
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_all", IKEY, KM_PRESS, 
KM_CTRL, 0);

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


[Bf-blender-cvs] [6112cde3f90] blender2.8: Merge branch 'master' into blender2.8

2018-01-10 Thread Campbell Barton
Commit: 6112cde3f90e4e0f2ba5fc37150efcd239b97250
Author: Campbell Barton
Date:   Thu Jan 11 10:14:34 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB6112cde3f90e4e0f2ba5fc37150efcd239b97250

Merge branch 'master' into blender2.8

===



===

diff --cc source/blender/blenkernel/BKE_world.h
index ea0cd125b06,dfa367afeb2..b69c14535c6
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@@ -38,17 -38,11 +38,17 @@@ struct World
  
  void BKE_world_free(struct World *sc);
  void BKE_world_init(struct World *wrld);
- struct World *add_world(struct Main *bmian, const char *name);
+ struct World *BKE_world_add(struct Main *bmian, const char *name);
  void BKE_world_copy_data(struct Main *bmain, struct World *wrld_dst, const 
struct World *wrld_src, const int flag);
  struct World *BKE_world_copy(struct Main *bmain, const struct World *wrld);
- struct World *localize_world(struct World *wrld);
+ struct World *BKE_world_localize(struct World *wrld);
  void BKE_world_make_local(struct Main *bmain, struct World *wrld, const bool 
lib_local);
  
 +/* Evaluation. */
 +
 +struct EvaluationContext;
 +
 +void BKE_world_eval(const struct EvaluationContext *eval_ctx, struct World 
*world);
 +
  #endif
  
diff --cc source/blender/editors/render/render_preview.c
index 83beb7da1ce,c2532ba033e..1d6aefcb48c
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@@ -277,62 -269,6 +277,62 @@@ static Scene *preview_get_scene(Main *p
return pr_main->scene.first;
  }
  
 +static const char *preview_layer_name(const char pr_type)
 +{
 +  switch (pr_type) {
 +  case MA_FLAT:
 +  return "Flat";
 +  case MA_SPHERE:
 +  return "Sphere";
 +  case MA_CUBE:
 +  return "Cube";
 +  case MA_MONKEY:
 +  return "Monkey";
 +  case MA_SPHERE_A:
 +  return "World Sphere";
 +  case MA_TEXTURE:
 +  return "Texture";
 +  case MA_LAMP:
 +  return "Lamp";
 +  case MA_SKY:
 +  return "Sky";
 +  case MA_HAIR:
 +  return "Hair";
 +  case MA_ATMOS:
 +  return "Atmosphere";
 +  default:
 +  BLI_assert(!"Unknown preview type");
 +  return "";
 +  }
 +}
 +
 +static void set_preview_layer(ViewLayer *view_layer, char pr_type)
 +{
 +  LayerCollection *lc;
 +  const char *collection_name = preview_layer_name(pr_type);
 +
 +  for (lc = view_layer->layer_collections.first; lc; lc = lc->next) {
 +  if (STREQ(lc->scene_collection->name, collection_name)) {
 +  lc->flag = COLLECTION_VIEWPORT | COLLECTION_RENDER;
 +  }
 +  else {
 +  lc->flag = COLLECTION_DISABLED;
 +  }
 +  }
 +}
 +
 +static World *preview_get_localized_world(ShaderPreview *sp, World *world)
 +{
 +  if (world == NULL) {
 +  return NULL;
 +  }
 +  if (sp->worldcopy != NULL) {
 +  return sp->worldcopy;
 +  }
-   sp->worldcopy = localize_world(world);
++  sp->worldcopy = BKE_world_localize(world);
 +  BLI_addtail(>pr_main->world, sp->worldcopy);
 +  return sp->worldcopy;
 +}
  
  /* call this with a pointer to initialize preview scene */
  /* call this with NULL to restore assigned ID pointers in preview scene */

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


[Bf-blender-cvs] [d0cc5d89485] master: Fix T53752: Draw curve fails w/ stylus

2018-01-10 Thread Philipp Oeser
Commit: d0cc5d89485f0c34cd3b79752320a40c140af050
Author: Philipp Oeser
Date:   Thu Jan 11 10:22:08 2018 +1100
Branches: master
https://developer.blender.org/rBd0cc5d89485f0c34cd3b79752320a40c140af050

Fix T53752: Draw curve fails w/ stylus

===

M   source/blender/editors/curve/curve_ops.c

===

diff --git a/source/blender/editors/curve/curve_ops.c 
b/source/blender/editors/curve/curve_ops.c
index 4dfd4a5c0f0..71cccdfa33d 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -241,6 +241,9 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "CURVE_OT_draw", ACTIONMOUSE, 
KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "wait_for_input", false);
 
+   kmi = WM_keymap_add_item(keymap, "CURVE_OT_draw", TABLET_STYLUS, 
KM_PRESS, KM_SHIFT, 0);
+   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
+
kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 
0, 0);
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_all", IKEY, KM_PRESS, 
KM_CTRL, 0);

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


[Bf-blender-cvs] [f3300052667] master: Cleanup: BKE naming conventions for datablock add/localize

2018-01-10 Thread Campbell Barton
Commit: f33000526679c543c1398a68a84b93dad521a5cb
Author: Campbell Barton
Date:   Thu Jan 11 09:55:41 2018 +1100
Branches: master
https://developer.blender.org/rBf33000526679c543c1398a68a84b93dad521a5cb

Cleanup: BKE naming conventions for datablock add/localize

Conventions were already followed nearly everywhere.

===

M   source/blender/blenkernel/BKE_action.h
M   source/blender/blenkernel/BKE_lamp.h
M   source/blender/blenkernel/BKE_material.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/BKE_world.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/anim_sys.c
M   source/blender/blenkernel/intern/ipo.c
M   source/blender/blenkernel/intern/lamp.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/world.c
M   source/blender/blenloader/intern/versioning_legacy.c
M   source/blender/editors/animation/keyframing.c
M   source/blender/editors/armature/pose_lib.c
M   source/blender/editors/physics/particle_object.c
M   source/blender/editors/render/render_preview.c
M   source/blender/editors/render/render_shading.c
M   source/blender/editors/space_action/action_data.c
M   source/blender/makesrna/intern/rna_fluidsim.c
M   source/blender/makesrna/intern/rna_main_api.c
M   source/blender/render/intern/source/render_texture.c

===

diff --git a/source/blender/blenkernel/BKE_action.h 
b/source/blender/blenkernel/BKE_action.h
index 28be2b04c71..f7ebe85bcef 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -55,7 +55,7 @@ extern "C" {
 /* Action Lib Stuff - */
 
 /* Allocate a new bAction with the given name */
-struct bAction *add_empty_action(struct Main *bmain, const char name[]);
+struct bAction *BKE_action_add(struct Main *bmain, const char name[]);
 
 void BKE_action_copy_data(struct Main *bmain, struct bAction *act_dst, const 
struct bAction *act_src, const int flag);
 /* Allocate a copy of the given Action and all its data */
diff --git a/source/blender/blenkernel/BKE_lamp.h 
b/source/blender/blenkernel/BKE_lamp.h
index b68da654520..3673e657b33 100644
--- a/source/blender/blenkernel/BKE_lamp.h
+++ b/source/blender/blenkernel/BKE_lamp.h
@@ -46,7 +46,7 @@ void BKE_lamp_init(struct Lamp *la);
 struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) 
ATTR_WARN_UNUSED_RESULT;
 void BKE_lamp_copy_data(struct Main *bmain, struct Lamp *la_dst, const struct 
Lamp *la_src, const int flag);
 struct Lamp *BKE_lamp_copy(struct Main *bmain, const struct Lamp *la) 
ATTR_WARN_UNUSED_RESULT;
-struct Lamp *localize_lamp(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
+struct Lamp *BKE_lamp_localize(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
 void BKE_lamp_make_local(struct Main *bmain, struct Lamp *la, const bool 
lib_local);
 void BKE_lamp_free(struct Lamp *la);
 
diff --git a/source/blender/blenkernel/BKE_material.h 
b/source/blender/blenkernel/BKE_material.h
index c6ebda2c399..f7850913014 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -56,7 +56,7 @@ void BKE_material_remap_object_calc(struct  Object *ob_dst, 
struct Object *ob_sr
 struct Material *BKE_material_add(struct Main *bmain, const char *name);
 void BKE_material_copy_data(struct Main *bmain, struct Material *ma_dst, const 
struct Material *ma_src, const int flag);
 struct Material *BKE_material_copy(struct Main *bmain, const struct Material 
*ma);
-struct Material *localize_material(struct Material *ma);
+struct Material *BKE_material_localize(struct Material *ma);
 struct Material *give_node_material(struct Material *ma); /* returns node 
material or self */
 void BKE_material_make_local(struct Main *bmain, struct Material *ma, const 
bool lib_local);
 
diff --git a/source/blender/blenkernel/BKE_particle.h 
b/source/blender/blenkernel/BKE_particle.h
index ddb4f9c37bd..b43d000ed35 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -323,7 +323,7 @@ struct ParticleSystemModifierData *psys_get_modifier(struct 
Object *ob, struct P
 
 struct ModifierData *object_add_particle_system(struct Scene *scene, struct 
Object *ob, const char *name);
 void object_remove_particle_system(struct Scene *scene, struct Object *ob);
-struct ParticleSettings *psys_new_settings(const char *name, struct Main 
*main);
+struct ParticleSettings *BKE_particlesettings_add(struct Main *main, const 
char *name);
 void BKE_particlesettings_copy_data(
 struct Main *bmain, struct ParticleSettings *part_dst, const struct 
ParticleSettings *part_src,
 const int flag);
diff --git a/source/blender/blenkernel/BKE_world.h 
b/source/blender/blenkernel/BKE_world.h

[Bf-blender-cvs] [0f4b46cee61] master: Fix T53692: OpenCL multi GPU rendering not using all GPUs.

2018-01-10 Thread Brecht Van Lommel
Commit: 0f4b46cee61277f3a56b202df61e6296e2629125
Author: Brecht Van Lommel
Date:   Thu Jan 4 23:29:06 2018 +0100
Branches: master
https://developer.blender.org/rB0f4b46cee61277f3a56b202df61e6296e2629125

Fix T53692: OpenCL multi GPU rendering not using all GPUs.

Ensure each OpenCL device has a unique ID even if the hardware ID is not
unique for some reason.

===

M   intern/cycles/device/device_opencl.cpp

===

diff --git a/intern/cycles/device/device_opencl.cpp 
b/intern/cycles/device/device_opencl.cpp
index 5808a31e605..d3eebb10028 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -22,6 +22,7 @@
 
 #include "util/util_foreach.h"
 #include "util/util_logging.h"
+#include "util/util_set.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -105,7 +106,9 @@ void device_opencl_info(vector& devices)
OpenCLInfo::get_usable_devices(_devices);
/* Devices are numbered consecutively across platforms. */
int num_devices = 0;
+   set unique_ids;
foreach(OpenCLPlatformDevice& platform_device, usable_devices) {
+   /* Compute unique ID for persistent user preferences. */
const string& platform_name = platform_device.platform_name;
const cl_device_type device_type = platform_device.device_type;
const string& device_name = platform_device.device_name;
@@ -113,7 +116,15 @@ void device_opencl_info(vector& devices)
if(hardware_id == "") {
hardware_id = string_printf("ID_%d", num_devices);
}
+   string id = string("OPENCL_") + platform_name + "_" + 
device_name + "_" + hardware_id;
 
+   /* Hardware ID might not be unique, add device number in that 
case. */
+   if(unique_ids.find(id) != unique_ids.end()) {
+   id += string_printf("_ID_%d", num_devices);
+   }
+   unique_ids.insert(id);
+
+   /* Create DeviceInfo. */
DeviceInfo info;
info.type = DEVICE_OPENCL;
info.description = string_remove_trademark(string(device_name));
@@ -125,7 +136,7 @@ void device_opencl_info(vector& devices)
 
device_type);
info.has_volume_decoupled = false;
info.has_qbvh = false;
-   info.id = string("OPENCL_") + platform_name + "_" + device_name 
+ "_" + hardware_id;
+   info.id = id;
devices.push_back(info);
num_devices++;
}

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


[Bf-blender-cvs] [c27cab268bf] master: Fix Windows compiler warning using WITH_CYCLES_NATIVE_ONLY.

2018-01-10 Thread Brecht Van Lommel
Commit: c27cab268bf39594766b5cfba7a90e87065a4bb6
Author: Brecht Van Lommel
Date:   Tue Jan 9 22:50:48 2018 +0100
Branches: master
https://developer.blender.org/rBc27cab268bf39594766b5cfba7a90e87065a4bb6

Fix Windows compiler warning using WITH_CYCLES_NATIVE_ONLY.

===

M   intern/cycles/CMakeLists.txt

===

diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index dbf1bcece16..543fb5b2cf8 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -21,8 +21,11 @@ if(WITH_CYCLES_NATIVE_ONLY)
add_definitions(
-DWITH_KERNEL_NATIVE
)
-   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
-   set(CYCLES_KERNEL_FLAGS "-march=native")
+
+   if(NOT MSVC)
+   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
+   set(CYCLES_KERNEL_FLAGS "-march=native")
+   endif()
 elseif(NOT WITH_CPU_SSE)
set(CXX_HAS_SSE FALSE)
set(CXX_HAS_AVX FALSE)

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


[Bf-blender-cvs] [d0892a66483] master: Fix issue with moving CUDA memory to host and multiple devices.

2018-01-10 Thread Brecht Van Lommel
Commit: d0892a66483cd03d63aec27d11681e572d1f3494
Author: Brecht Van Lommel
Date:   Tue Jan 9 18:37:46 2018 +0100
Branches: master
https://developer.blender.org/rBd0892a66483cd03d63aec27d11681e572d1f3494

Fix issue with moving CUDA memory to host and multiple devices.

This is not expected to fix all issues. Also adds some more details
to error reporting to investigate failures.

===

M   intern/cycles/device/device_cuda.cpp

===

diff --git a/intern/cycles/device/device_cuda.cpp 
b/intern/cycles/device/device_cuda.cpp
index 51d9994ee26..116f4e2a452 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -829,18 +829,26 @@ public:
status = " in host memory";
 
/* Replace host pointer with our host 
allocation. Only works if
-* CUDA memory layout is the same and has no 
pitch padding. */
-   if(pitch_padding == 0 && mem.host_pointer && 
mem.host_pointer != mem.shared_pointer) {
+* CUDA memory layout is the same and has no 
pitch padding. Also
+* does not work if we move textures to host 
during a render,
+* since other devices might be using the 
memory. */
+   if(!move_texture_to_host && pitch_padding == 0 
&&
+  mem.host_pointer && mem.host_pointer != 
mem.shared_pointer) {
memcpy(mem.shared_pointer, 
mem.host_pointer, size);
mem.host_free();
mem.host_pointer = mem.shared_pointer;
}
}
+   else {
+   status = " failed, out of host memory";
+   }
+   }
+   else if(mem_alloc_result != CUDA_SUCCESS) {
+   status = " failed, out of device and host memory";
}
 
if(mem_alloc_result != CUDA_SUCCESS) {
cuda_assert(mem_alloc_result);
-   status = " failed, out of memory";
}
 
if(mem.name) {

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


[Bf-blender-cvs] [18f53d88225] master: Cleanup: comment block alignment

2018-01-10 Thread Campbell Barton
Commit: 18f53d8822518928baceab1407eac195ab9bf817
Author: Campbell Barton
Date:   Wed Jan 10 19:57:02 2018 +1100
Branches: master
https://developer.blender.org/rB18f53d8822518928baceab1407eac195ab9bf817

Cleanup: comment block alignment

===

M   source/blender/blenkernel/intern/brush.c
M   source/blender/blenkernel/intern/deform.c
M   source/blender/blenkernel/intern/image.c
M   source/blender/blenlib/intern/rct.c
M   source/blender/bmesh/tools/bmesh_bevel.c
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/space_view3d/drawanimviz.c
M   source/blender/editors/transform/transform_snap_object.c
M   source/blender/makesdna/DNA_userdef_types.h
M   source/blender/windowmanager/intern/wm_stereo.c

===

diff --git a/source/blender/blenkernel/intern/brush.c 
b/source/blender/blenkernel/intern/brush.c
index 0f09b741330..8d63c1cfb44 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -150,7 +150,7 @@ void BKE_brush_init(Brush *brush)
 
 /**
  * \note Resulting brush will have two users: one as a fake user, another is 
assumed to be used by the caller.
- .*/
+ */
 Brush *BKE_brush_add(Main *bmain, const char *name, short ob_mode)
 {
Brush *brush;
@@ -1066,7 +1066,8 @@ struct ImBuf *BKE_brush_gen_radial_control_imbuf(Brush 
*br, bool secondary)
for (i = 0; i < side; ++i) {
for (j = 0; j < side; ++j) {
const int col = texcache[i * side + j];
-   im->rect_float[i * side + j] *= (((char 
*))[0] + ((char *))[1] + ((char *))[2]) / 3.0f / 255.0f;
+   im->rect_float[i * side + j] *=
+   (((char *))[0] + ((char *))[1] 
+ ((char *))[2]) / 3.0f / 255.0f;
}
}
 
diff --git a/source/blender/blenkernel/intern/deform.c 
b/source/blender/blenkernel/intern/deform.c
index eec8d2478da..22ff8bf4bb7 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -625,7 +625,7 @@ float defvert_array_find_weight_safe(const struct 
MDeformVert *dvert, const int
 * (i.e. maximum weight, as if no vgroup was selected).
 * But in case of valid defgroup and NULL dvert data pointer, it means 
that vgroup **is** valid,
 * and just totally empty, so we shall return '0.0' value then!
-   */
+*/
if (defgroup == -1) {
return 1.0f;
}
diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index 9ba7cc1c679..e3e403251e1 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -112,9 +112,9 @@ static void image_add_view(Image *ima, const char 
*viewname, const char *filepat
 /* quick lookup: supports 1 million frames, thousand passes */
 #define IMA_MAKE_INDEX(frame, index)(((frame) << 10) + (index))
 #define IMA_INDEX_FRAME(index)   ((index) >> 10)
-/*
+#if 0
 #define IMA_INDEX_PASS(index)   (index & ~1023)
-*/
+#endif
 
 /*  IMAGE CACHE * */
 
diff --git a/source/blender/blenlib/intern/rct.c 
b/source/blender/blenlib/intern/rct.c
index 3adc6b30f6e..764b12431d0 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -128,7 +128,7 @@ bool BLI_rctf_isect_pt_v(const rctf *rect, const float 
xy[2])
 
 /**
  * \returns shortest distance from \a rect to x/y (0 if inside)
-*/
+ */
 
 int BLI_rcti_length_x(const rcti *rect, const int x)
 {
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index d00d0d508c7..a1fb13ecdfb 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1692,7 +1692,7 @@ static void build_boundary_vertex_only(BevelParams *bp, 
BevVert *bv, bool constr
  * Special case of build_boundary when a single edge is beveled.
  * The 'width adjust' part of build_boundary has been done already,
  * and \a efirst is the first beveled edge at vertex \a bv.
-*/
+ */
 static void build_boundary_terminal_edge(BevelParams *bp, BevVert *bv, 
EdgeHalf *efirst, bool construct)
 {
MemArena *mem_arena = bp->mem_arena;
@@ -4933,7 +4933,7 @@ static void bevel_limit_offset(BevelParams *bp)
 * so we can just multiply them all by the reduction factor
 * of the offset to have the effect of recalculating the specs
 * with the new limited_offset.
-   */
+*/
offset_factor = limited_offset / bp->offset;
GHASH_ITER(giter, 

[Bf-blender-cvs] [2b56faebe5f] blender2.8: Merge branch 'master' into blender2.8

2018-01-10 Thread Campbell Barton
Commit: 2b56faebe5f2a8e2b37004485206007d22cdac1d
Author: Campbell Barton
Date:   Wed Jan 10 19:58:05 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB2b56faebe5f2a8e2b37004485206007d22cdac1d

Merge branch 'master' into blender2.8

===



===

diff --cc source/blender/editors/space_view3d/drawanimviz.c
index 66355a50478,a99ac0d46a5..9fa85b55362
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@@ -77,17 -76,17 +77,17 @@@ void draw_motion_paths_init(View3D *v3d
  }
  
  /* set color
- * - more intense for active/selected bones, less intense for unselected bones
- * - black for before current frame, green for current frame, blue for after 
current frame
- * - intensity decreases as distance from current frame increases
- *
- * If the user select custom color, the color is replaced for the color 
selected in UI panel
- * - 75% Darker color is used for previous frames
- * - 50% Darker color for current frame
- * - User selected color for next frames
- */
+  * - more intense for active/selected bones, less intense for unselected bones
+  * - black for before current frame, green for current frame, blue for after 
current frame
+  * - intensity decreases as distance from current frame increases
+  *
+  * If the user select custom color, the color is replaced for the color 
selected in UI panel
+  * - 75% Darker color is used for previous frames
+  * - 50% Darker color for current frame
+  * - User selected color for next frames
+  */
  static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, 
short sel, int sfra, int efra,
 -  float prev_color[3], float frame_color[3], float next_color[3])
 +  float prev_color[3], float frame_color[3], float next_color[3], 
unsigned color)
  {
int frame = sfra + i;
int blend_base = (abs(frame - CFRA) == 1) ? TH_CFRAME : TH_BACK; /* 
"bleed" cframe color to ease color blending */

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


[Bf-blender-cvs] [bc02c5de497] master: Alternate fix for brush user count

2018-01-10 Thread Campbell Barton
Commit: bc02c5de497c360449e4de68b3c1432f9bd204de
Author: Campbell Barton
Date:   Wed Jan 10 19:34:34 2018 +1100
Branches: master
https://developer.blender.org/rBbc02c5de497c360449e4de68b3c1432f9bd204de

Alternate fix for brush user count

This reverts change to BKE_brush_add,
callers now remove the extra user.

Note this isn't very convenient for callers but
is consistent with other ID types.

In the future we will probably remove this and have new
ID's created with zero users.

===

M   source/blender/blenkernel/intern/brush.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/sculpt_paint/paint_ops.c
M   source/blender/makesrna/intern/rna_main_api.c

===

diff --git a/source/blender/blenkernel/intern/brush.c 
b/source/blender/blenkernel/intern/brush.c
index 8ad9cbb2625..0f09b741330 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -148,12 +148,14 @@ void BKE_brush_init(Brush *brush)
BKE_brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
 }
 
+/**
+ * \note Resulting brush will have two users: one as a fake user, another is 
assumed to be used by the caller.
+ .*/
 Brush *BKE_brush_add(Main *bmain, const char *name, short ob_mode)
 {
Brush *brush;
 
-   /* Use no refcount, fakeuser is added in 'BKE_brush_init' */
-   brush = BKE_libblock_alloc(bmain, ID_BR, name, 
LIB_ID_CREATE_NO_USER_REFCOUNT);
+   brush = BKE_libblock_alloc(bmain, ID_BR, name, 0);
 
BKE_brush_init(brush);
 
diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index 32813ffce25..d1e9516f6d2 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -529,8 +529,10 @@ void BKE_paint_init(Scene *sce, ePaintMode mode, const 
char col[3])
short ob_mode = BKE_paint_object_mode_from_paint_mode(mode);
brush = BKE_brush_first_search(G.main, ob_mode);
 
-   if (!brush)
+   if (!brush) {
brush = BKE_brush_add(G.main, "Brush", ob_mode);
+   id_us_min(>id);  /* fake user only */
+   }
BKE_paint_brush_set(paint, brush);
}
 
diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index 3d3e73eb470..23ec1cd3231 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -242,6 +242,7 @@ void BLO_update_defaults_startup_blend(Main *bmain)
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Fill");
if (!br) {
br = BKE_brush_add(bmain, "Fill", 
OB_MODE_TEXTURE_PAINT);
+   id_us_min(>id);  /* fake user only */
br->imagepaint_tool = PAINT_TOOL_FILL;
br->ob_mode = OB_MODE_TEXTURE_PAINT;
}
@@ -250,12 +251,14 @@ void BLO_update_defaults_startup_blend(Main *bmain)
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, 
"Average");
if (!br) {
br = BKE_brush_add(bmain, "Average", 
OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT);
+   id_us_min(>id);  /* fake user only */
br->vertexpaint_tool = PAINT_BLEND_AVERAGE;
br->ob_mode = OB_MODE_VERTEX_PAINT | 
OB_MODE_WEIGHT_PAINT;
}
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Smear");
if (!br) {
br = BKE_brush_add(bmain, "Smear", OB_MODE_VERTEX_PAINT 
| OB_MODE_WEIGHT_PAINT);
+   id_us_min(>id);  /* fake user only */
br->vertexpaint_tool = PAINT_BLEND_SMEAR;
br->ob_mode = OB_MODE_VERTEX_PAINT | 
OB_MODE_WEIGHT_PAINT;
}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c 
b/source/blender/editors/sculpt_paint/paint_ops.c
index 40210d63566..73cb31bb1bd 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -68,10 +68,13 @@ static int brush_add_exec(bContext *C, wmOperator 
*UNUSED(op))
Main *bmain = CTX_data_main(C);
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
 
-   if (br)
+   if (br) {
br = BKE_brush_copy(bmain, br);
-   else
+   }
+   else {
br = BKE_brush_add(bmain, "Brush", 
BKE_paint_object_mode_from_paint_mode(mode));
+   id_us_min(>id);  /* fake user only */
+   }
 
BKE_paint_brush_set(paint, br);
 
@@ -376,6 +379,7 @@ static int