[Bf-blender-cvs] [ef33215bb77] master: Fix sculpt redo failing to enable dyntopo

2019-01-08 Thread Campbell Barton
Commit: ef33215bb777eb3eb0d7d5527f39fb7788deb7ec
Author: Campbell Barton
Date:   Wed Jan 9 18:08:14 2019 +1100
Branches: master
https://developer.blender.org/rBef33215bb777eb3eb0d7d5527f39fb7788deb7ec

Fix sculpt redo failing to enable dyntopo

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c 
b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 090bc335d66..d3bcee3dc2e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -62,6 +62,8 @@
 #include "BKE_subsurf.h"
 #include "BKE_subdiv_ccg.h"
 #include "BKE_undo_system.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
 
 #include "DEG_depsgraph.h"
 
@@ -1009,8 +1011,12 @@ void sculpt_undo_push_end(void)
BKE_pbvh_node_layer_disp_free(unode->node);
}
 
-   UndoStack *ustack = ED_undo_stack_get();
-   BKE_undosys_step_push(ustack, NULL, NULL);
+   /* We could remove this and enforce all callers run in an operator 
using 'OPTYPE_UNDO'. */
+   wmWindowManager *wm = G_MAIN->wm.first;
+   if (wm->op_undo_depth == 0) {
+   UndoStack *ustack = ED_undo_stack_get();
+   BKE_undosys_step_push(ustack, NULL, NULL);
+   }
 }
 
 /*  */

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


[Bf-blender-cvs] [7e6d7d53cf9] master: Fix memfile undo decoding creating undo steps

2019-01-08 Thread Campbell Barton
Commit: 7e6d7d53cf9d269c402b4eef5eae7b8c363b6707
Author: Campbell Barton
Date:   Wed Jan 9 16:53:44 2019 +1100
Branches: master
https://developer.blender.org/rB7e6d7d53cf9d269c402b4eef5eae7b8c363b6707

Fix memfile undo decoding creating undo steps

Exiting modes shouldn't be needed since loading the new memfile
will free the old data.

Sculpt mode dynamic topology was adding undo data on exiting the mode
which isn't logical in this case and can be avoided altogether.

===

M   source/blender/editors/undo/memfile_undo.c

===

diff --git a/source/blender/editors/undo/memfile_undo.c 
b/source/blender/editors/undo/memfile_undo.c
index 4b38ab282a0..2470acef9aa 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -82,9 +82,6 @@ static bool memfile_undosys_step_encode(struct bContext *C, 
UndoStep *us_p)
 
 static void memfile_undosys_step_decode(struct bContext *C, UndoStep *us_p, 
int UNUSED(dir))
 {
-   /* Loading the content will correctly switch into compatible non-object 
modes. */
-   ED_object_mode_exit(C);
-
MemFileUndoStep *us = (MemFileUndoStep *)us_p;
BKE_memfile_undo_decode(us->data, C);

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


[Bf-blender-cvs] [9012ad155c4] master: Fix T59165: Text operations fail to undo

2019-01-08 Thread Campbell Barton
Commit: 9012ad155c4f92a48f9c684c0dc5c7dd9a481cca
Author: Campbell Barton
Date:   Wed Jan 9 14:07:35 2019 +1100
Branches: master
https://developer.blender.org/rB9012ad155c4f92a48f9c684c0dc5c7dd9a481cca

Fix T59165: Text operations fail to undo

Some undo operations encode multiple actions, now all are undone/redone.

===

M   source/blender/editors/space_text/text_undo.c

===

diff --git a/source/blender/editors/space_text/text_undo.c 
b/source/blender/editors/space_text/text_undo.c
index b8ae9972eec..29871bf5c85 100644
--- a/source/blender/editors/space_text/text_undo.c
+++ b/source/blender/editors/space_text/text_undo.c
@@ -120,12 +120,18 @@ static void text_undosys_step_decode(struct bContext *C, 
UndoStep *us_p, int dir
 
if (dir < 0) {
TextUndoBuf data = us->data;
-   txt_do_undo(text, );
+   while (data.pos > -1) {
+   txt_do_undo(text, );
+   }
+   BLI_assert(data.pos == -1);
}
else {
TextUndoBuf data = us->data;
data.pos = -1;
-   txt_do_redo(text, );
+   while (data.pos < us->data.pos) {
+   txt_do_redo(text, );
+   }
+   BLI_assert(data.pos == us->data.pos);
}
 
text_update_edited(text);

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


[Bf-blender-cvs] [e67bd5ee31f] temp-clang-format: Disable BreakBeforeTernaryOperators (matches current code style)

2019-01-08 Thread Campbell Barton
Commit: e67bd5ee31f2a904e9d3ccc7ce0e848bd0911a5f
Author: Campbell Barton
Date:   Wed Jan 9 02:20:08 2019 +1100
Branches: temp-clang-format
https://developer.blender.org/rBe67bd5ee31f2a904e9d3ccc7ce0e848bd0911a5f

Disable BreakBeforeTernaryOperators (matches current code style)

===

M   .clang-format

===

diff --git a/.clang-format b/.clang-format
index b149e8b830a..60876123251 100644
--- a/.clang-format
+++ b/.clang-format
@@ -138,6 +138,8 @@ IndentCaseLabels: true
 # Indent after the hash inside preprocessor directives
 IndentPPDirectives: AfterHash
 
+BreakBeforeTernaryOperators: false
+
 SpaceAfterTemplateKeyword: false
 
 # Use "if (...)" instead of "if(...)", but have function calls like foo().

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


[Bf-blender-cvs] [a4d21441f98] master: Avoid assert w/ recent sculpt changes on undo

2019-01-08 Thread Campbell Barton
Commit: a4d21441f98dbd516095e43f741b2e69911a3a1e
Author: Campbell Barton
Date:   Wed Jan 9 13:25:23 2019 +1100
Branches: master
https://developer.blender.org/rBa4d21441f98dbd516095e43f741b2e69911a3a1e

Avoid assert w/ recent sculpt changes on undo

===

M   source/blender/blenloader/intern/readfile.c

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index c7e9b8cd4ad..dddf25696b3 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5646,13 +5646,11 @@ static void direct_link_object(FileData *fd, Object *ob)
CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 
if (ob->sculpt) {
+   ob->sculpt = NULL;
/* Only create data on undo, otherwise rely on editor mode 
switching. */
if (fd->memfile && (ob->mode & OB_MODE_ALL_SCULPT)) {
BKE_object_sculpt_data_create(ob);
}
-   else {
-   ob->sculpt = NULL;
-   }
}
 
link_list(fd, >lodlevels);

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


[Bf-blender-cvs] [4069b10be86] master: Fix swapped active/selected lattice vertex color

2019-01-08 Thread Campbell Barton
Commit: 4069b10be869a0a8aadcf947a9e1f6db2c930fd9
Author: Campbell Barton
Date:   Wed Jan 9 13:09:03 2019 +1100
Branches: master
https://developer.blender.org/rB4069b10be869a0a8aadcf947a9e1f6db2c930fd9

Fix swapped active/selected lattice vertex color

===

M   source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl

===

diff --git a/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl 
b/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl
index e78462b6915..b2720704dcc 100644
--- a/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl
+++ b/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl
@@ -1,8 +1,8 @@
 
 flat in int vertFlag;
 
-#define VERTEX_SELECTED (1 << 0)
-#define VERTEX_ACTIVE   (1 << 1)
+#define VERTEX_ACTIVE   (1 << 0)
+#define VERTEX_SELECTED (1 << 1)
 
 out vec4 FragColor;

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


[Bf-blender-cvs] [df8e8e5b6be] master: UI: use keymap introspection for tooltip creation

2019-01-08 Thread Campbell Barton
Commit: df8e8e5b6be91c09e873f9770ea08002b2c45216
Author: Campbell Barton
Date:   Wed Jan 9 12:27:58 2019 +1100
Branches: master
https://developer.blender.org/rBdf8e8e5b6be91c09e873f9770ea08002b2c45216

UI: use keymap introspection for tooltip creation

Also support non existing keymap items which gave an error, see: T60335

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 125ac67a816..99d6104d42c 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -33,6 +33,10 @@ from .space_toolsystem_common import (
 )
 
 
+def kmi_to_string_or_none(kmi):
+return kmi.to_string() if kmi else ""
+
+
 def generate_from_enum_ex(
 context, *,
 icon_prefix,
@@ -101,6 +105,10 @@ class _defs_view3d_generic:
 @ToolDef.from_fn
 def ruler():
 def description(context, item, km):
+if km is not None:
+kmi = km.keymap_items.find_from_operator("view3d.ruler_add")
+else:
+kmi = None
 return (
 "Measure distance and angles.\n"
 "\u2022 {} anywhere for new measurement.\n"
@@ -109,7 +117,7 @@ class _defs_view3d_generic:
 "\u2022 Ctrl to snap.\n"
 "\u2022 Shift to measure surface thickness"
 ).format(
-km.keymap_items[0].to_string()
+kmi_to_string_or_none(kmi)
 )
 return dict(
 text="Measure",

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


[Bf-blender-cvs] [34143a9e7ae] master: WM: add keymap.find_from_operator(...)

2019-01-08 Thread Campbell Barton
Commit: 34143a9e7ae0017bb4825d5f9e885a87da236159
Author: Campbell Barton
Date:   Wed Jan 9 12:26:10 2019 +1100
Branches: master
https://developer.blender.org/rB34143a9e7ae0017bb4825d5f9e885a87da236159

WM: add keymap.find_from_operator(...)

===

M   source/blender/makesrna/intern/rna_wm_api.c
M   source/blender/windowmanager/WM_keymap.h
M   source/blender/windowmanager/intern/wm_keymap.c

===

diff --git a/source/blender/makesrna/intern/rna_wm_api.c 
b/source/blender/makesrna/intern/rna_wm_api.c
index 51291f70cfa..9d93bcba508 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -309,6 +309,23 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, 
ReportList *reports, PointerRNA
RNA_POINTER_INVALIDATE(kmi_ptr);
 }
 
+static PointerRNA rna_KeyMap_item_find_from_operator(
+ID *id,
+wmKeyMap *km,
+const char *idname,
+PointerRNA *properties,
+int include_mask, int exclude_mask)
+{
+   char idname_bl[OP_MAX_TYPENAME];
+   WM_operator_bl_idname(idname_bl, idname);
+
+   wmKeyMapItem *kmi = WM_key_event_operator_from_keymap(
+   km, idname_bl, properties->data, include_mask, exclude_mask);
+   PointerRNA kmi_ptr;
+   RNA_pointer_create(id, _KeyMapItem, kmi, _ptr);
+   return kmi_ptr;
+}
+
 static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int 
spaceid, int regionid, bool modal, bool tool)
 {
wmKeyMap *keymap;
@@ -908,6 +925,20 @@ void RNA_api_keymapitems(StructRNA *srna)
RNA_def_property_ui_text(parm, "id", "ID of the item");
parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
RNA_def_function_return(func, parm);
+
+   /* Keymap introspection
+* Args follow: KeyConfigs.find_item_from_operator */
+   func = RNA_def_function(srna, "find_from_operator", 
"rna_KeyMap_item_find_from_operator");
+   RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+   parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", 
"");
+   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+   parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", 
"");
+   RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+   RNA_def_enum_flag(func, "include", rna_enum_event_type_mask_items, 
EVT_TYPE_MASK_ALL, "Include", "");
+   RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, 
"Exclude", "");
+   parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
+   RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+   RNA_def_function_return(func, parm);
 }
 
 void RNA_api_keymaps(StructRNA *srna)
diff --git a/source/blender/windowmanager/WM_keymap.h 
b/source/blender/windowmanager/WM_keymap.h
index 8f31685e453..7780c060243 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -152,6 +152,10 @@ char *WM_key_event_operator_string(
 struct IDProperty *properties, const bool is_strict,
 char *result, const int result_len);
 
+wmKeyMapItem *WM_key_event_operator_from_keymap(
+struct wmKeyMap *keymap, const char *opname, struct IDProperty 
*properties,
+const short include_mask, const short exclude_mask);
+
 const char *WM_bool_as_string(bool test);
 
 #ifdef __cplusplus
diff --git a/source/blender/windowmanager/intern/wm_keymap.c 
b/source/blender/windowmanager/intern/wm_keymap.c
index 6048309980a..b8612363b78 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -1147,100 +1147,110 @@ char *WM_modalkeymap_operator_items_to_string_buf(
return ret;
 }
 
-static wmKeyMapItem *wm_keymap_item_find_handlers(
-const bContext *C, ListBase *handlers, const char *opname, int 
UNUSED(opcontext),
+static wmKeyMapItem *wm_keymap_item_find_in_keymap(
+wmKeyMap *keymap, const char *opname,
 IDProperty *properties, const bool is_strict,
-const struct wmKeyMapItemFind_Params *params,
-wmKeyMap **r_keymap)
+const struct wmKeyMapItemFind_Params *params)
 {
-   wmWindowManager *wm = CTX_wm_manager(C);
-   wmEventHandler *handler;
-   wmKeyMap *keymap;
-   wmKeyMapItem *kmi;
+   for (wmKeyMapItem *kmi = keymap->items.first; kmi; kmi = kmi->next) {
+   /* skip disabled keymap items [T38447] */
+   if (kmi->flag & KMI_INACTIVE) {
+   continue;
+   }
 
-   /* find keymap item in handlers */
-   for (handler = handlers->first; handler; handler = handler->next) {
-   keymap = WM_keymap_active(wm, handler->keymap);
+   bool kmi_match = false;
 
-   if (keymap && WM_keymap_poll((bContext *)C, keymap)) {
-   for (kmi = 

[Bf-blender-cvs] [d6152033420] master: Fix IS_EVENT_ACTIONZONE macro

2019-01-08 Thread Campbell Barton
Commit: d6152033420a7d5aed12c463b6d30fe957b12787
Author: Campbell Barton
Date:   Wed Jan 9 12:22:32 2019 +1100
Branches: master
https://developer.blender.org/rBd6152033420a7d5aed12c463b6d30fe957b12787

Fix IS_EVENT_ACTIONZONE macro

Caused tweak events not to display.

===

M   source/blender/windowmanager/wm_event_types.h

===

diff --git a/source/blender/windowmanager/wm_event_types.h 
b/source/blender/windowmanager/wm_event_types.h
index fad55171292..af3ca7b6ab7 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -308,11 +308,10 @@ enum {
TIMERF= 0x011F,  /* last timer */
 
/* Actionzones, tweak, gestures: 0x500x, 0x501x */
-#define EVT_ACTIONZONE_FIRST EVT_ACTIONZONE_AREA
+   /* Keep in sync with IS_EVENT_ACTIONZONE(...). */
EVT_ACTIONZONE_AREA   = 0x5000,
EVT_ACTIONZONE_REGION = 0x5001,
EVT_ACTIONZONE_FULLSCREEN = 0x5011,
-#define EVT_ACTIONZONE_LAST (EVT_ACTIONZONE_FULLSCREEN + 1)
 
/* NOTE: these values are saved in keymap files, do not change them but 
just add new ones */
 
@@ -376,7 +375,8 @@ enum {
 /* test whether the event is a NDOF event */
 #define ISNDOF(event_type)  ((event_type) >= NDOF_MOTION && (event_type) < 
NDOF_LAST)
 
-#define IS_EVENT_ACTIONZONE(event_type)  ((event_type) >= EVT_ACTIONZONE_FIRST 
&& (event_type) < EVT_ACTIONZONE_LAST)
+#define IS_EVENT_ACTIONZONE(event_type) \
+   ELEM(event_type, EVT_ACTIONZONE_AREA, EVT_ACTIONZONE_REGION, 
EVT_ACTIONZONE_FULLSCREEN)
 
 /* test whether event type is acceptable as hotkey, excluding modifiers */
 #define ISHOTKEY(event_type)  \

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


[Bf-blender-cvs] [3c3d80ea22a] master: Assert: add check to last commit

2019-01-08 Thread Campbell Barton
Commit: 3c3d80ea22af15e13237f978181a881b90c41e7c
Author: Campbell Barton
Date:   Wed Jan 9 10:32:02 2019 +1100
Branches: master
https://developer.blender.org/rB3c3d80ea22af15e13237f978181a881b90c41e7c

Assert: add check to last commit

===

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

===

diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index 62f5b018545..ce4d60f6191 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2961,7 +2961,7 @@ void BKE_object_handle_update(Depsgraph *depsgraph, Scene 
*scene, Object *ob)
 
 void BKE_object_sculpt_data_create(Object *ob)
 {
-   BLI_assert(ob->mode & OB_MODE_ALL_SCULPT);
+   BLI_assert((ob->sculpt == NULL) && (ob->mode & OB_MODE_ALL_SCULPT));
ob->sculpt = MEM_callocN(sizeof(SculptSession), __func__);
ob->sculpt->mode_type = ob->mode;
 }

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


[Bf-blender-cvs] [b536d1b95f0] master: Object Mode: only toggle active object mode once

2019-01-08 Thread Campbell Barton
Commit: b536d1b95f01de9400d77dbaf311677222063178
Author: Campbell Barton
Date:   Wed Jan 9 10:16:51 2019 +1100
Branches: master
https://developer.blender.org/rBb536d1b95f01de9400d77dbaf311677222063178

Object Mode: only toggle active object mode once

- When toggling a mode that doesn't support multi editing
  only do this once of the active object.

- For sculpt mode create sculpt data since this is needed
  for activating other sculpt objects on reload.

===

M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/editors/util/ed_util.c

===

diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index 329be174632..3348131cc4b 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -293,6 +293,8 @@ void BKE_object_handle_update_ex(
 const bool do_proxy_update);
 void BKE_object_sculpt_modifiers_changed(struct Object *ob);
 
+void BKE_object_sculpt_data_create(struct Object *ob);
+
 int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float 
**r_loc, float **r_size, float **r_rot);
 
 struct Mesh *BKE_object_get_evaluated_mesh(const struct Depsgraph *depsgraph, 
struct Object *ob);
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index 78e22c203ab..62f5b018545 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2959,6 +2959,13 @@ void BKE_object_handle_update(Depsgraph *depsgraph, 
Scene *scene, Object *ob)
BKE_object_handle_update_ex(depsgraph, scene, ob, NULL, true);
 }
 
+void BKE_object_sculpt_data_create(Object *ob)
+{
+   BLI_assert(ob->mode & OB_MODE_ALL_SCULPT);
+   ob->sculpt = MEM_callocN(sizeof(SculptSession), __func__);
+   ob->sculpt->mode_type = ob->mode;
+}
+
 void BKE_object_sculpt_modifiers_changed(Object *ob)
 {
SculptSession *ss = ob->sculpt;
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index bc3d38fd7f4..c7e9b8cd4ad 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5648,8 +5648,7 @@ static void direct_link_object(FileData *fd, Object *ob)
if (ob->sculpt) {
/* Only create data on undo, otherwise rely on editor mode 
switching. */
if (fd->memfile && (ob->mode & OB_MODE_ALL_SCULPT)) {
-   ob->sculpt = MEM_callocN(sizeof(SculptSession), "reload 
sculpt session");
-   ob->sculpt->mode_type = ob->mode;
+   BKE_object_sculpt_data_create(ob);
}
else {
ob->sculpt = NULL;
diff --git a/source/blender/editors/util/ed_util.c 
b/source/blender/editors/util/ed_util.c
index b3ec0a4388f..188d06cec55 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -130,7 +130,17 @@ void ED_editors_init(bContext *C)

ED_object_posemode_enter_ex(bmain, ob);
}
else {
-   
ED_object_mode_toggle(C, mode);
+   if (obact == ob) {
+   
ED_object_mode_toggle(C, mode);
+   }
+   else {
+   /* Create data 
for non-active objects which need it for
+* 
mode-switching but don't yet support multi-editing. */
+   if (mode & 
OB_MODE_ALL_SCULPT) {
+   
ob->mode = mode;
+   
BKE_object_sculpt_data_create(ob);
+   }
+   }
}
}
}

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


[Bf-blender-cvs] [1b6b0fbd957] master: Fix T60044: Sculpting brush is not visible

2019-01-08 Thread Campbell Barton
Commit: 1b6b0fbd957f70ea177dbfd431ec2a2ba2d0daa6
Author: Campbell Barton
Date:   Wed Jan 9 09:06:59 2019 +1100
Branches: master
https://developer.blender.org/rB1b6b0fbd957f70ea177dbfd431ec2a2ba2d0daa6

Fix T60044: Sculpting brush is not visible

Same logic as fix from D4153, but only applied when running undo.

===

M   source/blender/blenloader/intern/readfile.c

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 316a98c46c4..bc3d38fd7f4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5646,7 +5646,8 @@ static void direct_link_object(FileData *fd, Object *ob)
CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 
if (ob->sculpt) {
-   if (ob->mode & OB_MODE_ALL_SCULPT) {
+   /* Only create data on undo, otherwise rely on editor mode 
switching. */
+   if (fd->memfile && (ob->mode & OB_MODE_ALL_SCULPT)) {
ob->sculpt = MEM_callocN(sizeof(SculptSession), "reload 
sculpt session");
ob->sculpt->mode_type = ob->mode;
}

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


[Bf-blender-cvs] [583c3213347] master: Revert "Fix T60044: Sculpting brush is not visible on file load"

2019-01-08 Thread Dalai Felinto
Commit: 583c32133473d5e33367f5ff623f4dfabd5b2f15
Author: Dalai Felinto
Date:   Tue Jan 8 18:31:36 2019 -0200
Branches: master
https://developer.blender.org/rB583c32133473d5e33367f5ff623f4dfabd5b2f15

Revert "Fix T60044: Sculpting brush is not visible on file load"

This reverts commit 4d8ed937f226f4cdfa6f62fde5306b14c217e9c5.

An alternative fix will come soon as a patch, since this introduced an issue.
Rolling back since the original fix (sculpt cursor on load) is less important
than the issue it introduced (crash on weight paint undo/redo).

Fix T60322.

===

M   source/blender/blenloader/intern/readfile.c

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 2817f3abac0..316a98c46c4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5645,7 +5645,15 @@ static void direct_link_object(FileData *fd, Object *ob)
/* in case this value changes in future, clamp else we get undefined 
behavior */
CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 
-   ob->sculpt = NULL;
+   if (ob->sculpt) {
+   if (ob->mode & OB_MODE_ALL_SCULPT) {
+   ob->sculpt = MEM_callocN(sizeof(SculptSession), "reload 
sculpt session");
+   ob->sculpt->mode_type = ob->mode;
+   }
+   else {
+   ob->sculpt = NULL;
+   }
+   }
 
link_list(fd, >lodlevels);
ob->currentlod = ob->lodlevels.first;

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


[Bf-blender-cvs] [12e9d52882e] master: Fix T60327: Value input with adaptive imperial units not working properly

2019-01-08 Thread Jacques Lucke
Commit: 12e9d52882e32d85c3890b73aa5a21aff9c787fc
Author: Jacques Lucke
Date:   Tue Jan 8 19:20:22 2019 +0100
Branches: master
https://developer.blender.org/rB12e9d52882e32d85c3890b73aa5a21aff9c787fc

Fix T60327: Value input with adaptive imperial units not working properly

===

M   source/blender/blenkernel/BKE_unit.h
M   source/blender/blenkernel/intern/unit.c
M   source/blender/editors/util/numinput.c

===

diff --git a/source/blender/blenkernel/BKE_unit.h 
b/source/blender/blenkernel/BKE_unit.h
index 59475d3098a..b19cc340bbf 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -46,7 +46,7 @@ bool bUnit_ReplaceString(char *str, int len_max, const char 
*str_prev, double sc
 bool bUnit_ContainsUnit(const char *str, int system, int type);
 
 /* if user does not specify a unit, multiply with this value */
-double bUnit_PreferredUnitScalar(const struct UnitSettings *settings, int 
type);
+double bUnit_PreferredInputUnitScalar(const struct UnitSettings *settings, int 
type);
 
 /* make string keyboard-friendly: 10µm --> 10um */
 void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int 
system, int type);
diff --git a/source/blender/blenkernel/intern/unit.c 
b/source/blender/blenkernel/intern/unit.c
index 5527cb5d39a..7cac4c148ff 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -484,7 +484,7 @@ static bool is_valid_unit_collection(const bUnitCollection 
*usys)
return usys != NULL && usys->units[0].name != NULL;
 }
 
-static const bUnitDef *get_preferred_unit_if_used(int type, PreferredUnits 
units)
+static const bUnitDef *get_preferred_display_unit_if_used(int type, 
PreferredUnits units)
 {
const bUnitCollection *usys = unit_get_system(units.system, type);
if (!is_valid_unit_collection(usys)) return NULL;
@@ -525,7 +525,7 @@ static size_t unit_as_string_main(
usys = 
}
else {
-   main_unit = get_preferred_unit_if_used(type, units);
+   main_unit = get_preferred_display_unit_if_used(type, units);
}
 
if (split && unit_should_be_split(type)) {
@@ -734,12 +734,12 @@ bool bUnit_ContainsUnit(const char *str, int system, int 
type)
return false;
 }
 
-double bUnit_PreferredUnitScalar(const struct UnitSettings *settings, int type)
+double bUnit_PreferredInputUnitScalar(const struct UnitSettings *settings, int 
type)
 {
PreferredUnits units = preferred_units_from_UnitSettings(settings);
-   const bUnitDef *unit = get_preferred_unit_if_used(type, units);
-   if (unit == NULL) return 1.0;
-   else return unit->scalar;
+   const bUnitDef *unit = get_preferred_display_unit_if_used(type, units);
+   if (unit) return unit->scalar;
+   else return bUnit_BaseScalar(units.system, type);
 }
 
 /* make a copy of the string that replaces the units with numbers
@@ -905,7 +905,8 @@ double bUnit_ClosestScalar(double value, int system, int 
type)
 double bUnit_BaseScalar(int system, int type)
 {
const bUnitCollection *usys = unit_get_system(system, type);
-   return unit_default(usys)->scalar;
+   if (usys) return unit_default(usys)->scalar;
+   else return 1.0;
 }
 
 /* external access */
diff --git a/source/blender/editors/util/numinput.c 
b/source/blender/editors/util/numinput.c
index 52cf1b2d708..e3c0f6ca685 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -260,7 +260,7 @@ bool user_string_to_number(bContext *C, const char *str, 
const UnitSettings *uni
double unit_scale = BKE_scene_unit_scale(unit, type, 1.0);
if (!bUnit_ContainsUnit(str, unit->system, type)) {
int success = BPY_execute_string_as_number(C, NULL, str, true, 
r_value);
-   *r_value *= bUnit_PreferredUnitScalar(unit, type);
+   *r_value *= bUnit_PreferredInputUnitScalar(unit, type);
*r_value /= unit_scale;
return success;
}

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


[Bf-blender-cvs] [ae2af469200] master: Fix inconsistent naming and behavior for base visible/selected/editable.

2019-01-08 Thread Brecht Van Lommel
Commit: ae2af4692009fe2c3fc97783f6d69aaa7cac5123
Author: Brecht Van Lommel
Date:   Tue Jan 8 18:19:12 2019 +0100
Branches: master
https://developer.blender.org/rBae2af4692009fe2c3fc97783f6d69aaa7cac5123

Fix inconsistent naming and behavior for base visible/selected/editable.

Fixes T60251.

===

M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_relations.c
M   source/blender/editors/screen/screen_context.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/space_view3d/view3d_view.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/editors/transform/transform_gizmo_3d.c
M   source/blender/editors/transform/transform_orientations.c
M   source/blender/editors/transform/transform_snap_object.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_object_api.c

===

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index 9ac0c56d93f..746733e4e0e 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -156,10 +156,6 @@ struct ObjectsInModeIteratorData {
struct Base *base_active;
 };
 
-void BKE_view_layer_renderable_objects_iterator_begin(BLI_Iterator *iter, void 
*data_in);
-void BKE_view_layer_renderable_objects_iterator_next(BLI_Iterator *iter);
-void BKE_view_layer_renderable_objects_iterator_end(BLI_Iterator *iter);
-
 void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void 
*data_in);
 void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter);
 void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *iter);
@@ -320,34 +316,6 @@ void 
BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
ITER_END;   
  \
 } ((void)0)
 
-struct ObjectsRenderableIteratorData {
-   struct Scene *scene;
-   struct Base base_temp;
-   struct Scene scene_temp;
-
-   struct {
-   struct ViewLayer *view_layer;
-   struct Base *base;
-   struct Scene *set;
-   } iter;
-};
-
-#define FOREACH_OBJECT_RENDERABLE_BEGIN(scene_, _instance)\
-{ \
-   struct ObjectsRenderableIteratorData data_ = {  
  \
-   .scene = (scene_),  
  \
-   };  
  \
-   ITER_BEGIN(BKE_view_layer_renderable_objects_iterator_begin,
  \
-  BKE_view_layer_renderable_objects_iterator_next, 
  \
-  BKE_view_layer_renderable_objects_iterator_end,  
  \
-  _, Object *, _instance)
-
-
-#define FOREACH_OBJECT_RENDERABLE_END \
-   ITER_END;   
  \
-} ((void)0)
-
-
 /* layer_utils.c */
 
 struct ObjectsInModeParams {
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 28833383029..304702ce475 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1071,29 +1071,9 @@ typedef struct LayerObjectBaseIteratorData {
Base *base;
 } LayerObjectBaseIteratorData;
 
-static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const 
int flag)
+static bool object_bases_iterator_is_valid(View3D *v3d, Base *base, const int 
flag)
 {
-   if (v3d != NULL) {
-   BLI_assert(v3d->spacetype == SPACE_VIEW3D);
-   if ((v3d->object_type_exclude_viewport & (1 << 
base->object->type)) != 0) {
-   return false;
-   }
-
-   if (v3d->localvd && ((base->local_view_bits & 
v3d->local_view_uuid) == 0)) {
-   return false;
-   }
-   }
-
-   if ((base->flag & flag) == 0) {
-   return false;
-   }
-
-   return true;
-}
-
-static bool object_bases_iterator_is_valid(View3D *v3d, Base *base)
-{
-   return object_bases_iterator_is_valid_ex(v3d, base, ~(0));
+   return BASE_VISIBLE(v3d, base) && ((base->flag & flag) == flag);
 }
 
 static void object_bases_iterator_begin(BLI_Iterator *iter, void *data_in_v, 
const int flag)
@@ -1116,7 +1096,7 @@ static void object_bases_iterator_begin(BLI_Iterator 
*iter, void *data_in_v, con
data->v3d = v3d;
data->base = 

[Bf-blender-cvs] [ff2361021d6] greasepencil-experimental: Merge branch 'greasepencil-object' into greasepencil-experimental

2019-01-08 Thread Antonioya
Commit: ff2361021d6251833ee4eccbba879cdaa3b9e4ab
Author: Antonioya
Date:   Tue Jan 8 17:38:25 2019 +0100
Branches: greasepencil-experimental
https://developer.blender.org/rBff2361021d6251833ee4eccbba879cdaa3b9e4ab

Merge branch 'greasepencil-object' into greasepencil-experimental

===



===



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


[Bf-blender-cvs] [c863ad1a850] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-01-08 Thread Antonioya
Commit: c863ad1a85046ce75a1aaf2a0c4167fa817a75e8
Author: Antonioya
Date:   Tue Jan 8 16:55:32 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc863ad1a85046ce75a1aaf2a0c4167fa817a75e8

Merge branch 'master' 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] [944ec382df3] temp-clang-format: Merge branch 'master' into temp-clang-format

2019-01-08 Thread Campbell Barton
Commit: 944ec382df3253036011accff4d8faee0982f5cb
Author: Campbell Barton
Date:   Wed Jan 9 02:11:52 2019 +1100
Branches: temp-clang-format
https://developer.blender.org/rB944ec382df3253036011accff4d8faee0982f5cb

Merge branch 'master' into temp-clang-format

===



===



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


[Bf-blender-cvs] [b486088218f] blender2.7: Fix T60320: Cycles OpenCL volume rendering error on some drivers.

2019-01-08 Thread Brecht Van Lommel
Commit: b486088218f66810b97294f38f246e4650d32f2b
Author: Brecht Van Lommel
Date:   Tue Jan 8 15:50:14 2019 +0100
Branches: blender2.7
https://developer.blender.org/rBb486088218f66810b97294f38f246e4650d32f2b

Fix T60320: Cycles OpenCL volume rendering error on some drivers.

===

M   intern/cycles/kernel/kernel_volume.h

===

diff --git a/intern/cycles/kernel/kernel_volume.h 
b/intern/cycles/kernel/kernel_volume.h
index d6d283c42c5..1df50504434 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -383,18 +383,22 @@ ccl_device int kernel_volume_sample_channel(float3 
albedo, float3 throughput, fl
 *  Tracing". Matt Jen-Yuan Chiang, Peter Kutz, Brent Burley. SIGGRAPH 
2016. */
float3 weights = fabs(throughput * albedo);
float sum_weights = weights.x + weights.y + weights.z;
+   float3 weights_pdf;
 
if(sum_weights > 0.0f) {
-   *pdf = weights/sum_weights;
+   weights_pdf = weights/sum_weights;
}
else {
-   *pdf = make_float3(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f);
+   weights_pdf = make_float3(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f);
}
 
-   if(rand < pdf->x) {
+   *pdf = weights_pdf;
+
+   /* OpenCL does not support -> on float3, so don't use pdf->x. */
+   if(rand < weights_pdf.x) {
return 0;
}
-   else if(rand < pdf->x + pdf->y) {
+   else if(rand < weights_pdf.x + weights_pdf.y) {
return 1;
}
else {

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


[Bf-blender-cvs] [8491dba0c6b] blender2.7: Fix T60300: Cycles SSS render hanging with AMD OpenCL.

2019-01-08 Thread Brecht Van Lommel
Commit: 8491dba0c6bb96f9785e27429c72315ba9660511
Author: Brecht Van Lommel
Date:   Tue Jan 8 15:35:54 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB8491dba0c6bb96f9785e27429c72315ba9660511

Fix T60300: Cycles SSS render hanging with AMD OpenCL.

===

M   intern/cycles/kernel/split/kernel_subsurface_scatter.h

===

diff --git a/intern/cycles/kernel/split/kernel_subsurface_scatter.h 
b/intern/cycles/kernel/split/kernel_subsurface_scatter.h
index c51246fbc90..08769fe303b 100644
--- a/intern/cycles/kernel/split/kernel_subsurface_scatter.h
+++ b/intern/cycles/kernel/split/kernel_subsurface_scatter.h
@@ -47,6 +47,11 @@ ccl_device_noinline bool 
kernel_split_branched_path_subsurface_indirect_light_it
if(!CLOSURE_IS_BSSRDF(sc->type))
continue;
 
+   /* Closure memory will be overwritten, so read required 
variables now. */
+   Bssrdf *bssrdf = (Bssrdf *)sc;
+   ClosureType bssrdf_type = sc->type;
+   float bssrdf_roughness = bssrdf->roughness;
+
/* set up random number generator */
if(branched_state->ss_next_sample == 0 && 
branched_state->next_hit == 0 &&
   branched_state->next_closure == 0 && 
branched_state->next_sample == 0)
@@ -110,10 +115,6 @@ ccl_device_noinline bool 
kernel_split_branched_path_subsurface_indirect_light_it
*bssrdf_sd = *sd; /* note: copy happens each 
iteration of inner loop, this is
   * important as the indirect 
path will write into bssrdf_sd */
 
-   Bssrdf *bssrdf = (Bssrdf *)sc;
-   ClosureType bssrdf_type = sc->type;
-   float bssrdf_roughness = bssrdf->roughness;
-
LocalIntersection ss_isect_private = *ss_isect;
subsurface_scatter_multi_setup(kg,
   
_isect_private,

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


[Bf-blender-cvs] [0984c5bbf8f] greasepencil-experimental: Merge branch 'greasepencil-object' into greasepencil-experimental

2019-01-08 Thread Charlie Jolly
Commit: 0984c5bbf8fd70e6c2b36f975740dc218fd49a9a
Author: Charlie Jolly
Date:   Tue Jan 8 14:49:43 2019 +
Branches: greasepencil-experimental
https://developer.blender.org/rB0984c5bbf8fd70e6c2b36f975740dc218fd49a9a

Merge branch 'greasepencil-object' into greasepencil-experimental

===



===



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


[Bf-blender-cvs] [54985ab5f56] master: Quick Explode: replace BI based material handling (using 'fade'/'blend')

2019-01-08 Thread Philipp Oeser
Commit: 54985ab5f569f4623695c693dedda7c000e1e73f
Author: Philipp Oeser
Date:   Mon Jan 7 15:42:46 2019 +0100
Branches: master
https://developer.blender.org/rB54985ab5f569f4623695c693dedda7c000e1e73f

Quick Explode: replace BI based material handling (using 'fade'/'blend')

using a simple shader graph mixing Transparent BSDF now

Fixes T59185

Reviewers: brecht

Maniphest Tasks: T59185

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

===

M   release/scripts/startup/bl_operators/object_quick_effects.py

===

diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py 
b/release/scripts/startup/bl_operators/object_quick_effects.py
index a47bdf9ff32..37c4af593c5 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -192,17 +192,6 @@ class QuickExplode(Operator):
 
 return {'CANCELLED'}
 
-if self.fade:
-tex = bpy.data.textures.new("Explode fade", 'BLEND')
-tex.use_color_ramp = True
-
-if self.style == 'BLEND':
-tex.color_ramp.elements[0].position = 0.333
-tex.color_ramp.elements[1].position = 0.666
-
-tex.color_ramp.elements[0].color[3] = 1.0
-tex.color_ramp.elements[1].color[3] = 0.0
-
 if self.style == 'BLEND':
 from_obj = mesh_objects[1]
 to_obj = mesh_objects[0]
@@ -229,30 +218,59 @@ class QuickExplode(Operator):
 explode.particle_uv = uv.name
 
 mat = object_ensure_material(obj, "Explode Fade")
-
-mat.use_transparency = True
-mat.use_transparent_shadows = True
-mat.alpha = 0.0
-mat.specular_alpha = 0.0
-
-tex_slot = mat.texture_slots.add()
-
-tex_slot.texture = tex
-tex_slot.texture_coords = 'UV'
-tex_slot.uv_layer = uv.name
-
-tex_slot.use_map_alpha = True
+mat.blend_method = 'BLEND'
+mat.transparent_shadow_method = 'HASHED'
+if not mat.use_nodes:
+mat.use_nodes = True
+
+nodes = mat.node_tree.nodes
+for node in nodes:
+if (node.type == 'OUTPUT_MATERIAL'):
+node_out_mat = node
+break
+
+node_surface = 
node_out_mat.inputs['Surface'].links[0].from_node
+
+node_x = node_surface.location[0]
+node_y = node_surface.location[1] - 400
+offset_x = 200
+
+node_mix = nodes.new('ShaderNodeMixShader')
+node_mix.location = (node_x - offset_x, node_y)
+mat.node_tree.links.new(node_surface.outputs["BSDF"], 
node_mix.inputs[1])
+mat.node_tree.links.new(node_mix.outputs["Shader"], 
node_out_mat.inputs['Surface'])
+offset_x += 200
+
+node_trans = nodes.new('ShaderNodeBsdfTransparent')
+node_trans.location = (node_x - offset_x, node_y)
+mat.node_tree.links.new(node_trans.outputs["BSDF"], 
node_mix.inputs[2])
+offset_x += 200
+
+node_ramp = nodes.new('ShaderNodeValToRGB')
+node_ramp.location = (node_x - offset_x, node_y)
+offset_x += 200
+mat.node_tree.links.new(node_ramp.outputs["Alpha"], 
node_mix.inputs["Fac"])
+color_ramp = node_ramp.color_ramp
+color_ramp.elements[0].color[3] = 0.0
+color_ramp.elements[1].color[3] = 1.0
 
 if self.style == 'BLEND':
+color_ramp.elements[0].position = 0.333
+color_ramp.elements[1].position = 0.666
 if obj == to_obj:
-tex_slot.alpha_factor = -1.0
-elem = tex.color_ramp.elements[1]
-else:
-elem = tex.color_ramp.elements[0]
-# Keep already defined alpha!
-elem.color[:3] = mat.diffuse_color
-else:
-tex_slot.use_map_color_diffuse = False
+# reverse ramp alpha
+color_ramp.elements[0].color[3] = 1.0
+color_ramp.elements[1].color[3] = 0.0
+
+node_sep = nodes.new('ShaderNodeSeparateXYZ')
+node_sep.location = (node_x - offset_x, node_y)
+offset_x += 200
+mat.node_tree.links.new(node_sep.outputs["X"], 
node_ramp.inputs["Fac"])
+
+node_uv = nodes.new('ShaderNodeUVMap')
+node_uv.location = (node_x - offset_x, node_y)
+node_uv.uv_map = 

[Bf-blender-cvs] [4b55945da69] master: Quick Explode: use keyword argument

2019-01-08 Thread Philipp Oeser
Commit: 4b55945da69f9d1dd399f8ab100aa95e21266160
Author: Philipp Oeser
Date:   Mon Jan 7 13:04:39 2019 +0100
Branches: master
https://developer.blender.org/rB4b55945da69f9d1dd399f8ab100aa95e21266160

Quick Explode: use keyword argument

===

M   release/scripts/startup/bl_operators/object_quick_effects.py

===

diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py 
b/release/scripts/startup/bl_operators/object_quick_effects.py
index 7597b2a0491..a47bdf9ff32 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -225,7 +225,7 @@ class QuickExplode(Operator):
 
 if self.fade:
 explode.show_dead = False
-uv = obj.data.uv_layers.new("Explode fade")
+uv = obj.data.uv_layers.new(name="Explode fade")
 explode.particle_uv = uv.name
 
 mat = object_ensure_material(obj, "Explode Fade")

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


[Bf-blender-cvs] [369e1d46f0d] master: Fix T56545: Material referencing missing UV crash

2019-01-08 Thread Campbell Barton
Commit: 369e1d46f0dbdd7904de7a5350ae7825800588df
Author: Campbell Barton
Date:   Wed Jan 9 01:04:28 2019 +1100
Branches: master
https://developer.blender.org/rB369e1d46f0dbdd7904de7a5350ae7825800588df

Fix T56545: Material referencing missing UV crash

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 9d9f7c47b14..fd9c44431b7 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -434,6 +434,11 @@ static void mesh_cd_calc_used_gpu_layers(
layer = (name[0] != 
'\0') ?

CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name) :

CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
+
+   /* Only fallback to 
orco (below) when we have no UV layers, see: T56545 */
+   if (layer == -1 && 
name[0] != '\0') {
+   layer = 
CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
+   }
}
if (layer != -1) {
cd_lused[CD_TANGENT] |= 
(1 << layer);

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


[Bf-blender-cvs] [22474062b1a] master: Fix T58479: Quick Favorites Lets you add multiple of the same item

2019-01-08 Thread Philipp Oeser
Commit: 22474062b1afb11634a1579ab5c5ce92a5beea85
Author: Philipp Oeser
Date:   Fri Dec 28 14:57:34 2018 +0100
Branches: master
https://developer.blender.org/rB22474062b1afb11634a1579ab5c5ce92a5beea85

Fix T58479: Quick Favorites Lets you add multiple of the same item

Reviewers: brecht

Maniphest Tasks: T58479

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

===

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

===

diff --git a/source/blender/editors/interface/interface_context_menu.c 
b/source/blender/editors/interface/interface_context_menu.c
index fc7d329..5ac45580b18 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -691,13 +691,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut 
*but)
uiBlock *block = uiLayoutGetBlock(layout);
const int w = uiLayoutGetWidth(layout);
uiBut *but2;
-
-   but2 = uiDefIconTextBut(
-   block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
-   CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to 
Quick Favorites"),
-   0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
-   "Add to a user defined context menu (stored in the user 
preferences)");
-   UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, 
NULL);
+   bool item_found = false;
 
uint um_array_len;
bUserMenu **um_array = ED_screen_user_menus_find(C, 
_array_len);
@@ -709,14 +703,24 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut 
*but)
bUserMenuItem *umi = ui_but_user_menu_find(C, but, um);
if (umi != NULL) {
but2 = uiDefIconTextBut(
-   block, UI_BTYPE_BUT, 0, ICON_BLANK1,
+   block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,

CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Quick Favorites"),
0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, 
"");
UI_but_func_set(but2, 
popup_user_menu_remove_func, um, umi);
+   item_found = true;
}
}
MEM_freeN(um_array);
 
+   if (!item_found) {
+   but2 = uiDefIconTextBut(
+   block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
+   CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, 
"Add to Quick Favorites"),
+   0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+   "Add to a user defined context menu (stored in 
the user preferences)");
+   UI_but_func_set(but2, 
popup_user_menu_add_or_replace_func, but, NULL);
+   }
+
uiItemS(layout);
}

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


[Bf-blender-cvs] [24a84c47425] master: Fix T60314: Missing strength w/ weight gradient

2019-01-08 Thread Campbell Barton
Commit: 24a84c4742576ab1ade54933ae95c1cb983a5f92
Author: Campbell Barton
Date:   Tue Jan 8 23:46:55 2019 +1100
Branches: master
https://developer.blender.org/rB24a84c4742576ab1ade54933ae95c1cb983a5f92

Fix T60314: Missing strength w/ weight gradient

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 2678620ea8b..125ac67a816 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -934,7 +934,10 @@ class _defs_weight_paint:
 brush = context.tool_settings.weight_paint.brush
 if brush is not None:
 from .properties_paint_common import UnifiedPaintPanel
-UnifiedPaintPanel.prop_unified_weight(layout, context, brush, 
"weight", slider=True, text="Weight")
+UnifiedPaintPanel.prop_unified_weight(
+layout, context, brush, "weight", slider=True, 
text="Weight")
+UnifiedPaintPanel.prop_unified_strength(
+layout, context, brush, "strength", slider=True, 
text="Strength")
 props = tool.operator_properties("paint.weight_gradient")
 layout.prop(props, "type")

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


[Bf-blender-cvs] [9d4ed6d03b6] master: Fix T59984: Drivers don't update values in UI or show proper errors

2019-01-08 Thread Joshua Leung
Commit: 9d4ed6d03b6910b5239c2f17b3559987330f9652
Author: Joshua Leung
Date:   Fri Jan 4 14:57:09 2019 +1300
Branches: master
https://developer.blender.org/rB9d4ed6d03b6910b5239c2f17b3559987330f9652

Fix T59984: Drivers don't update values in UI or show proper errors

We now perform COW -> original data flushing for all the debug values + error
status flags on Drivers/DriverVariables/DriverTargets, as these are only set
when errors are encountered when evaluating drivers.

===

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

===

diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index 2019554996c..c5a21342dc0 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -3484,11 +3484,34 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
 
PathResolvedRNA anim_rna;
if (animsys_store_rna_setting(_ptr, fcu->rna_path, 
fcu->array_index, _rna)) {
+   /* Evaluate driver, and write results to 
COW-domain destination */
const float ctime = DEG_get_ctime(depsgraph);
const float curval = 
evaluate_fcurve_driver(_rna, fcu, driver_orig, ctime);
ok = animsys_write_rna_setting(_rna, 
curval);
+
+   /* Flush results & status codes to original 
data for UI (T59984) */
if (ok && DEG_is_active(depsgraph)) {
animsys_write_orig_anim_rna(_ptr, 
fcu->rna_path, fcu->array_index, curval);
+
+   /* curval is displayed in the UI, and 
flag contains error-status codes */
+   driver_orig->curval = 
fcu->driver->curval;
+   driver_orig->flag = fcu->driver->flag;
+
+   DriverVar *dvar_orig = 
driver_orig->variables.first;
+   DriverVar *dvar = 
fcu->driver->variables.first;
+   for (;
+dvar_orig && dvar;
+dvar_orig = dvar_orig->next, dvar 
= dvar->next)
+   {
+   DriverTarget *dtar_orig = 
_orig->targets[0];
+   DriverTarget *dtar = 
>targets[0];
+   for (int i = 0; i < 
MAX_DRIVER_TARGETS; i++, dtar_orig++, dtar++) {
+   dtar_orig->flag = 
dtar->flag;
+   }
+
+   dvar_orig->curval = 
dvar->curval;
+   dvar_orig->flag = dvar->flag;
+   }
}
}

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


[Bf-blender-cvs] [395120ed72e] master: Typo fixes

2019-01-08 Thread Joshua Leung
Commit: 395120ed72e9cca0a21a876a46fec19e1531f59f
Author: Joshua Leung
Date:   Fri Jan 4 15:02:41 2019 +1300
Branches: master
https://developer.blender.org/rB395120ed72e9cca0a21a876a46fec19e1531f59f

Typo fixes

===

M   source/blender/blenkernel/BKE_animsys.h
M   source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c

===

diff --git a/source/blender/blenkernel/BKE_animsys.h 
b/source/blender/blenkernel/BKE_animsys.h
index f85782d9caa..7cdb62712e8 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -154,7 +154,7 @@ char *BKE_animdata_driver_path_hack(struct bContext *C, 
struct PointerRNA *ptr,
 char *base_path);
 
 /* * */
-/* GPUBatch AnimData API */
+/* Batch AnimData API */
 
 /* Define for callback looper used in BKE_animdata_main_cb */
 typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, 
void *user_data);
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index dbf1a67603f..e9e82d0ed8e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -57,7 +57,7 @@ static void initData(GpencilModifierData *md)
BuildGpencilModifierData *gpmd = (BuildGpencilModifierData *)md;
 
/* We deliberately set this range to the half the default
-* frame-range to have an immediate effect ot suggest use-cases
+* frame-range to have an immediate effect to suggest use-cases
 */
gpmd->start_frame = 1;
gpmd->end_frame = 125;

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


[Bf-blender-cvs] [b4bb9d59ee7] master: Fix T59450: brush colors flip inactive w/ texture paint

2019-01-08 Thread Campbell Barton
Commit: b4bb9d59ee7b6e962738df630a1c77b44b70aa36
Author: Campbell Barton
Date:   Tue Jan 8 23:24:38 2019 +1100
Branches: master
https://developer.blender.org/rBb4bb9d59ee7b6e962738df630a1c77b44b70aa36

Fix T59450: brush colors flip inactive w/ texture paint

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_image.c 
b/source/blender/editors/sculpt_paint/paint_image.c
index b8ac4403e1d..04941e36455 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1177,20 +1177,12 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
 
 static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op))
 {
-   UnifiedPaintSettings *ups = 
_data_tool_settings(C)->unified_paint_settings;
+   Scene *scene = CTX_data_scene(C);
+   UnifiedPaintSettings *ups = 
>toolsettings->unified_paint_settings;
 
-   Object *ob = CTX_data_active_object(C);
-   Brush *br;
-   if (!(ob && (ob->mode & OB_MODE_VERTEX_PAINT))) {
-   br = image_paint_brush(C);
-   }
-   else {
-   /* At the moment, wpaint does not support the color flipper.
-* So for now we're only handling vpaint */
-   ToolSettings *ts = CTX_data_tool_settings(C);
-   VPaint *vp = ts->vpaint;
-   br = BKE_paint_brush(>paint);
-   }
+   ViewLayer *view_layer = CTX_data_view_layer(C);
+   Paint *paint = BKE_paint_get_active(scene, view_layer);
+   Brush *br = BKE_paint_brush(paint);
 
if (ups->flag & UNIFIED_PAINT_COLOR) {
swap_v3_v3(ups->rgb, ups->secondary_rgb);
@@ -1208,15 +1200,17 @@ static bool brush_colors_flip_poll(bContext *C)
if (image_paint_poll(C)) {
Brush *br = image_paint_brush(C);
if (br->imagepaint_tool == PAINT_TOOL_DRAW)
-   return 1;
+   return true;
}
else {
Object *ob = CTX_data_active_object(C);
-   if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) {
-   return 1;
+   if (ob != NULL) {
+   if (ob->mode & (OB_MODE_VERTEX_PAINT | 
OB_MODE_TEXTURE_PAINT)) {
+   return true;
+   }
}
}
-   return 0;
+   return false;
 }
 
 void PAINT_OT_brush_colors_flip(wmOperatorType *ot)

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


[Bf-blender-cvs] [152c965b75f] master: Fix T60263: render layer node sockets not showing on file load, for some files.

2019-01-08 Thread Brecht Van Lommel
Commit: 152c965b75f3ccc3b50301555cb9b1a2ee679193
Author: Brecht Van Lommel
Date:   Tue Jan 8 13:21:39 2019 +0100
Branches: master
https://developer.blender.org/rB152c965b75f3ccc3b50301555cb9b1a2ee679193

Fix T60263: render layer node sockets not showing on file load, for some files.

===

M   source/blender/render/intern/source/external_engine.c

===

diff --git a/source/blender/render/intern/source/external_engine.c 
b/source/blender/render/intern/source/external_engine.c
index 758600e89aa..283f4c414ee 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -812,8 +812,10 @@ void RE_engine_register_pass(struct RenderEngine *engine, 
struct Scene *scene, s
 * and check whether their nodetree has a node that needs to be 
updated. */
/* NOTE: using G_MAIN seems valid here,
 * unless we want to register that for every other temp Main we could 
generate??? */
+   ntreeCompositRegisterPass(scene->nodetree, scene, view_layer, name, 
type);
+
for (Scene *sce = G_MAIN->scene.first; sce; sce = sce->id.next) {
-   if (sce->nodetree) {
+   if (sce->nodetree && sce != scene) {
ntreeCompositRegisterPass(sce->nodetree, scene, 
view_layer, name, type);
}
}

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


[Bf-blender-cvs] [415433e5ab6] temp-clang-format: Note that SortIncludes could be enabled later on.

2019-01-08 Thread Campbell Barton
Commit: 415433e5ab691f9716f5cbf46281938e715124d3
Author: Campbell Barton
Date:   Tue Jan 8 14:57:17 2019 +1100
Branches: temp-clang-format
https://developer.blender.org/rB415433e5ab691f9716f5cbf46281938e715124d3

Note that SortIncludes could be enabled later on.

===

M   .clang-format

===

diff --git a/.clang-format b/.clang-format
index a3c2a8da2ce..b149e8b830a 100644
--- a/.clang-format
+++ b/.clang-format
@@ -172,7 +172,8 @@ PenaltyReturnTypeOnItsOwnLine: 1
 
 AllowShortFunctionsOnASingleLine: None
 
-# Too disruptive.
+# Disable for now since it complicates initial migration tests,
+# TODO: look into enabling this in the future.
 SortIncludes: false

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


[Bf-blender-cvs] [f9cefc4d179] master: Fix T60291: Wrong tooltip in for Add Cube tool

2019-01-08 Thread Jacques Lucke
Commit: f9cefc4d179ab7aa98b016a4026436d86b027524
Author: Jacques Lucke
Date:   Tue Jan 8 12:24:45 2019 +0100
Branches: master
https://developer.blender.org/rBf9cefc4d179ab7aa98b016a4026436d86b027524

Fix T60291: Wrong tooltip in for Add Cube tool

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 6c59dee6377..2678620ea8b 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -408,6 +408,9 @@ class _defs_edit_mesh:
 return dict(
 text="Add Cube",
 icon="ops.mesh.primitive_cube_add_gizmo",
+description=(
+"Add cube to mesh interactively"
+),
 widget=None,
 keymap=(),
 )

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


[Bf-blender-cvs] [ef818009e01] master: Fix T60306: Circle select tool behaves like a mode

2019-01-08 Thread Campbell Barton
Commit: ef818009e014bf4ddfc8ae86a6be626eeb8c4a9c
Author: Campbell Barton
Date:   Tue Jan 8 22:14:09 2019 +1100
Branches: master
https://developer.blender.org/rBef818009e014bf4ddfc8ae86a6be626eeb8c4a9c

Fix T60306: Circle select tool behaves like a mode

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index f7ef464ccaf..3a7c0620b68 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -5038,9 +5038,9 @@ def km_image_editor_tool_uv_select_circle(params):
 {"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
 {"items": [
 ("uv.select_circle", {"type": params.tool_mouse, "value": 'PRESS'},
- {"properties": [("deselect", False)]}),
+ {"properties": [("wait_for_input", False), ("deselect", False)]}),
 ("uv.select_circle", {"type": params.tool_mouse, "value": 'PRESS', 
"ctrl": True},
- {"properties": [("deselect", True)]}),
+ {"properties": [("wait_for_input", False), ("deselect", True)]}),
 ]},
 )

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


[Bf-blender-cvs] [e11bb77f318] master: Properly clean up Python when exiting due to --python-exit-code

2019-01-08 Thread Sybren A. Stüvel
Commit: e11bb77f31827f875b536c4dfed18343bcf8f458
Author: Sybren A. Stüvel
Date:   Tue Jan 8 12:00:18 2019 +0100
Branches: master
https://developer.blender.org/rBe11bb77f31827f875b536c4dfed18343bcf8f458

Properly clean up Python when exiting due to --python-exit-code

When BPY_python_end() is not called, there can be buffered data still in
`sys.stdout` or `sys.stderr`. This generally isn't an issue when those are
connected to a terminal, but when they are read by another process (in the case
of rendering with Flamenco, for example) we could miss the actual error message
that's causing the exit in the first place.

The following script demonstrates the issue; before this commit neither the
writes to STDERR and STDOUT nor the traceback of the NameError were shown.

#!/bin/bash

cat > file-with-errors.py <&1 | cat

Reviewers: campbellbarton, mont29

Reviewed By: campbellbarton, mont29

Subscribers: fsiddi

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

===

M   source/creator/creator_args.c

===

diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 5b976515dd8..fe67eff3c40 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1615,6 +1615,7 @@ static int arg_handle_python_file_run(int argc, const 
char **argv, void *data)
BPY_CTX_SETUP(ok = BPY_execute_filepath(C, filename, NULL));
if (!ok && app_state.exit_code_on_error.python) {
printf("\nError: script failed, file: '%s', 
exiting.\n", argv[1]);
+   BPY_python_end();
exit(app_state.exit_code_on_error.python);
}
return 1;
@@ -1656,6 +1657,7 @@ static int arg_handle_python_text_run(int argc, const 
char **argv, void *data)
 
if (!ok && app_state.exit_code_on_error.python) {
printf("\nError: script failed, text: '%s', 
exiting.\n", argv[1]);
+   BPY_python_end();
exit(app_state.exit_code_on_error.python);
}
 
@@ -1687,6 +1689,7 @@ static int arg_handle_python_expr_run(int argc, const 
char **argv, void *data)
BPY_CTX_SETUP(ok = BPY_execute_string_ex(C, NULL, argv[1], 
false));
if (!ok && app_state.exit_code_on_error.python) {
printf("\nError: script failed, expr: '%s', 
exiting.\n", argv[1]);
+   BPY_python_end();
exit(app_state.exit_code_on_error.python);
}
return 1;

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


[Bf-blender-cvs] [1e386d98ced] blender2.7: Make DNA and RNA errors more meaningful and friendly

2019-01-08 Thread Sergey Sharybin
Commit: 1e386d98ced39c181f7331550028474716ab48b3
Author: Sergey Sharybin
Date:   Tue Jan 8 11:43:15 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB1e386d98ced39c181f7331550028474716ab48b3

Make DNA and RNA errors more meaningful and friendly

===

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

===

diff --git a/source/blender/makesdna/intern/makesdna.c 
b/source/blender/makesdna/intern/makesdna.c
index a6262a9b130..cf39fb69c73 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -1195,7 +1195,9 @@ static int make_structDNA(const char *baseDirectory, FILE 
*file, FILE *file_offs
 static void make_bad_file(const char *file, int line)
 {
FILE *fp = fopen(file, "w");
-   fprintf(fp, "#error \"Error! can't make correct DNA.c file from %s:%d, 
STUPID!\"\n", __FILE__, line);
+   fprintf(fp,
+  "#error \"Error! can't make correct DNA.c file from %s:%d, check 
alignment.\"\n",
+  __FILE__, line);
fclose(fp);
 }
 
diff --git a/source/blender/makesrna/intern/makesrna.c 
b/source/blender/makesrna/intern/makesrna.c
index a47426861b1..2aa6fc9cfc9 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -4013,7 +4013,10 @@ static void rna_generate_header_cpp(BlenderRNA 
*UNUSED(brna), FILE *f)
 static void make_bad_file(const char *file, int line)
 {
FILE *fp = fopen(file, "w");
-   fprintf(fp, "#error \"Error! can't make correct RNA file from %s:%d, 
STUPID!\"\n", __FILE__, line);
+   fprintf(fp,
+  "#error \"Error! can't make correct RNA file from %s:%d, "
+  "check DNA properties.\"\n",
+  __FILE__, line);
fclose(fp);
 }

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


[Bf-blender-cvs] [68b4c57ba5c] master: Merge branch 'blender2.7'

2019-01-08 Thread Sergey Sharybin
Commit: 68b4c57ba5cd231694b0d9b4572a4e1b364f5055
Author: Sergey Sharybin
Date:   Tue Jan 8 11:47:35 2019 +0100
Branches: master
https://developer.blender.org/rB68b4c57ba5cd231694b0d9b4572a4e1b364f5055

Merge branch 'blender2.7'

===



===



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


[Bf-blender-cvs] [23aae7822b5] greasepencil-object: GP: If no collision restore selection of points

2019-01-08 Thread Antonioya
Commit: 23aae7822b5bfc7615c3e3e8d94b046fa9ecd0d8
Author: Antonioya
Date:   Tue Jan 8 11:26:22 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB23aae7822b5bfc7615c3e3e8d94b046fa9ecd0d8

GP: If no collision restore selection of points

If no collision, the selection only selected the vertex as vertex mode and 
don't extend selection.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 36bb9dbe9de..e6626f5051d 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2176,6 +2176,9 @@ int ED_gpencil_select_stroke_segment(
int memsize = BLI_listbase_count(>strokes);
bGPDstroke **gps_array = MEM_callocN(sizeof(bGPDstroke *) * memsize, 
__func__);
 
+   /* save points */
+   bGPDspoint *oldpoints = MEM_dupallocN(gps->points);
+
/* Save list of strokes to check */
int totstrokes = 0;
for (bGPDstroke *gps_iter = gpf->strokes.first; gps_iter; gps_iter = 
gps_iter->next) {
@@ -2317,8 +2320,18 @@ int ED_gpencil_select_stroke_segment(
BLI_ghash_free(all_2d, NULL, NULL);
}
 
+   /* if no hit, reset selection flag */
+   if ((!hit_a) && (!hit_b)) {
+   for (int i = 0; i < gps->totpoints; i++) {
+   pta1 = >points[i];
+   pta2 = [i];
+   pta1->flag = pta2->flag;
+   }
+   }
+
MEM_SAFE_FREE(points2d);
MEM_SAFE_FREE(gps_array);
+   MEM_SAFE_FREE(oldpoints);
 
/* return type of hit */
if ((hit_a) && (hit_b)) {

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


[Bf-blender-cvs] [bdbc0f184f5] greasepencil-object: GP: Remove with Cutter strokes of 2 points

2019-01-08 Thread Antonioya
Commit: bdbc0f184f5aceab12f7766f4182c3569580e977
Author: Antonioya
Date:   Tue Jan 8 11:16:59 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBbdbc0f184f5aceab12f7766f4182c3569580e977

GP: Remove with Cutter strokes of 2 points

As thess strokes always generate an autocollision, it was impossible to delete 
them.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 1f1a92059d1..45653ac69df 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3849,8 +3849,10 @@ static void gpencil_cutter_dissolve(bGPDlayer 
*hit_layer, bGPDstroke *hit_stroke
}
}
 
-   /* if all points selected delete */
-   if (hit_stroke->totpoints == totselect) {
+   /* if all points selected delete or only 2 points and 1 selected */
+   if ((totselect == 1) && (hit_stroke->totpoints == 2) ||
+   (hit_stroke->totpoints == totselect))
+   {
BLI_remlink(_layer->actframe->strokes, hit_stroke);
BKE_gpencil_free_stroke(hit_stroke);
hit_stroke = NULL;
@@ -3947,10 +3949,12 @@ static int gpencil_cutter_lasso_select(
}
}
/* if mark all points inside lasso set to remove all stroke */
-   if (tot_inside == gps->totpoints) {
+   if ((tot_inside == oldtot) ||
+   ((tot_inside == 1) && (oldtot == 2)))
+   {
for (i = 0; i < gps->totpoints; i++) {
pt = >points[i];
-   pt->flag |= GP_SPOINT_SELECT;
+   pt->flag |= GP_SPOINT_SELECT;
}
}
}

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


[Bf-blender-cvs] [f2d2bafe856] master: fix rotational limits not showing for GENERIC ridgid body constraint

2019-01-08 Thread Philipp Oeser
Commit: f2d2bafe8569188d00d5f68da296bd3279e2b243
Author: Philipp Oeser
Date:   Tue Jan 8 10:20:53 2019 +0100
Branches: master
https://developer.blender.org/rBf2d2bafe8569188d00d5f68da296bd3279e2b243

fix rotational limits not showing for GENERIC ridgid body constraint

oversight in rB502aabb9d0c5

part of T60290

===

M   release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py

===

diff --git 
a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py 
b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
index 3ddf464390a..d3ed8c05fdd 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
@@ -212,7 +212,7 @@ class 
PHYSICS_PT_rigid_body_constraint_limits_angular(PHYSICS_PT_rigidbody_const
 rbc = ob.rigid_body_constraint
 
 return (ob and rbc
-and (rbc.type in {'GENERIC_SPRING', 'HINGE', 'PISTON'})
+and (rbc.type in {'GENERIC', 'GENERIC_SPRING', 'HINGE', 
'PISTON'})
 and context.engine in cls.COMPAT_ENGINES)
 
 def draw(self, context):
@@ -241,7 +241,7 @@ class 
PHYSICS_PT_rigid_body_constraint_limits_angular(PHYSICS_PT_rigidbody_const
 sub.prop(rbc, "limit_ang_x_lower", text="X Lower")
 sub.prop(rbc, "limit_ang_x_upper", text="Upper")
 
-elif rbc.type == 'GENERIC_SPRING':
+elif rbc.type in {'GENERIC', 'GENERIC_SPRING'}:
 col = flow.column()
 col.prop(rbc, "use_limit_ang_x")

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


[Bf-blender-cvs] [ee672ad4ea1] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-01-08 Thread Antonioya
Commit: ee672ad4ea15f902876f09046126390f1c45a581
Author: Antonioya
Date:   Tue Jan 8 09:28:08 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBee672ad4ea15f902876f09046126390f1c45a581

Merge branch 'master' into greasepencil-object

 Conflicts:
source/blender/editors/gpencil/gpencil_paint.c

===



===

diff --cc source/blender/editors/gpencil/gpencil_paint.c
index fb2f1b529d2,6543a65f67f..1b75f3be117
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@@ -128,76 -128,108 +128,117 @@@ typedef enum eGPencil_PaintFlags 
  typedef struct tGPsdata {
bContext *C;
  
-   Main *bmain;/* main database pointer */
-   Scene *scene;   /* current scene from context */
+   /** main database pointer. */
+   Main *bmain;
+   /** current scene from context. */
+   Scene *scene;
struct Depsgraph *depsgraph;
  
-   Object *ob; /* current object */
-   wmWindow *win;  /* window where painting originated */
-   ScrArea *sa;/* area where painting originated */
-   ARegion *ar;/* region where painting originated */
-   View2D *v2d;/* needed for GP_STROKE_2DSPACE */
-   rctf *subrect;  /* for using the camera rect within the 3d view */
+   /** current object. */
+   Object *ob;
+   /** window where painting originated. */
+   wmWindow *win;
+   /** area where painting originated. */
+   ScrArea *sa;
+   /** region where painting originated. */
+   ARegion *ar;
+   /** needed for GP_STROKE_2DSPACE. */
+   View2D *v2d;
+   /** for using the camera rect within the 3d view. */
+   rctf *subrect;
rctf subrect_data;
  
-   GP_SpaceConversion gsc; /* settings to pass to gp_points_to_xy() */
+   /** settings to pass to gp_points_to_xy(). */
+   GP_SpaceConversion gsc;
  
-   PointerRNA ownerPtr; /* pointer to owner of gp-datablock */
-   bGPdata *gpd;/* gp-datablock layer comes from */
-   bGPDlayer *gpl;  /* layer we're working on */
-   bGPDframe *gpf;  /* frame we're working on */
- 
-   char *align_flag;   /* projection-mode flags (toolsettings - 
eGPencil_Placement_Flags) */
- 
-   eGPencil_PaintStatus status; /* current status of painting */
-   eGPencil_PaintModes  paintmode;  /* mode for painting */
-   eGPencil_PaintFlags  flags;  /* flags that can get set during 
runtime (eGPencil_PaintFlags) */
- 
-   short radius;   /* radius of influence for eraser */
- 
-   float mval[2];  /* current mouse-position */
-   float mvalo[2]; /* previous recorded mouse-position */
-   float mvali[2]; /* initial recorded mouse-position */
- 
-   float pressure; /* current stylus pressure */
-   float opressure;/* previous stylus pressure */
+   /** pointer to owner of gp-datablock. */
+   PointerRNA ownerPtr;
+   /** gp-datablock layer comes from. */
+   bGPdata *gpd;
+   /** layer we're working on. */
+   bGPDlayer *gpl;
+   /** frame we're working on. */
+   bGPDframe *gpf;
+ 
+   /** projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
+   char *align_flag;
+ 
+   /** current status of painting. */
+   eGPencil_PaintStatus status;
+   /** mode for painting. */
+   eGPencil_PaintModes  paintmode;
+   /** flags that can get set during runtime (eGPencil_PaintFlags) */
+   eGPencil_PaintFlags  flags;
+ 
+   /** radius of influence for eraser. */
+   short radius;
+ 
+   /** current mouse-position. */
+   float mval[2];
+   /** previous recorded mouse-position. */
+   float mvalo[2];
++  /** initial recorded mouse-position */
++  float mvali[2];
+ 
+   /** current stylus pressure. */
+   float pressure;
+   /** previous stylus pressure. */
+   float opressure;
  
/* These need to be doubles, as (at least under unix) they are in 
seconds since epoch,
 * float (and its 7 digits precision) is definitively not enough here!
 * double, with its 15 digits precision, ensures us millisecond 
precision for a few centuries at least.
 */
-   double inittime;/* Used when converting to path */
-   double curtime; /* Used when converting to path */
-   double ocurtime;/* Used when converting to path */
- 
-   float imat[4][4];   /* inverted transformation matrix applying when 
converting coords from screen-space
-* to region space */
+   /** Used when converting to path. */
+   double inittime;
+   /** Used when converting to path. */
+   double curtime;
+   /** Used when converting to path. */
+   double ocurtime;