[Bf-blender-cvs] [c3a8b51413b] blender2.8: Manipulator: Move types into their own directory

2017-06-20 Thread Campbell Barton
Commit: c3a8b51413b61c7dca787a8a1b327e9f69dd2be3
Author: Campbell Barton
Date:   Wed Jun 21 16:21:19 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBc3a8b51413b61c7dca787a8a1b327e9f69dd2be3

Manipulator: Move types into their own directory

===

M   source/blender/editors/manipulator_library/CMakeLists.txt
R098source/blender/editors/manipulator_library/geom_arrow_manipulator.c 
source/blender/editors/manipulator_library/geometry/geom_arrow_manipulator.c
R098source/blender/editors/manipulator_library/geom_cube_manipulator.c  
source/blender/editors/manipulator_library/geometry/geom_cube_manipulator.c
R099source/blender/editors/manipulator_library/geom_dial_manipulator.c  
source/blender/editors/manipulator_library/geometry/geom_dial_manipulator.c
R098source/blender/editors/manipulator_library/arrow2d_manipulator.c
source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
R099source/blender/editors/manipulator_library/arrow3d_manipulator.c
source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
R099source/blender/editors/manipulator_library/cage2d_manipulator.c 
source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
R099source/blender/editors/manipulator_library/dial3d_manipulator.c 
source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
R098source/blender/editors/manipulator_library/grab3d_manipulator.c 
source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
R097source/blender/editors/manipulator_library/primitive3d_manipulator.c
source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c

===

diff --git a/source/blender/editors/manipulator_library/CMakeLists.txt 
b/source/blender/editors/manipulator_library/CMakeLists.txt
index 6421cfddadf..0604946dc24 100644
--- a/source/blender/editors/manipulator_library/CMakeLists.txt
+++ b/source/blender/editors/manipulator_library/CMakeLists.txt
@@ -37,21 +37,20 @@ set(INC_SYS
 )
 
 set(SRC
-   arrow2d_manipulator.c
-   arrow3d_manipulator.c
-   cage2d_manipulator.c
-   dial3d_manipulator.c
-   grab3d_manipulator.c
-   geom_arrow_manipulator.c
-   geom_cube_manipulator.c
-   geom_dial_manipulator.c
manipulator_draw_utils.c
-   manipulator_library_presets.c
-   manipulator_library_utils.c
-   primitive3d_manipulator.c
-
manipulator_geometry.h
manipulator_library_intern.h
+   manipulator_library_presets.c
+   manipulator_library_utils.c
+   geometry/geom_arrow_manipulator.c
+   geometry/geom_cube_manipulator.c
+   geometry/geom_dial_manipulator.c
+   manipulator_types/arrow2d_manipulator.c
+   manipulator_types/arrow3d_manipulator.c
+   manipulator_types/cage2d_manipulator.c
+   manipulator_types/dial3d_manipulator.c
+   manipulator_types/grab3d_manipulator.c
+   manipulator_types/primitive3d_manipulator.c
 )
 
 add_definitions(${GL_DEFINITIONS})
diff --git 
a/source/blender/editors/manipulator_library/geom_arrow_manipulator.c 
b/source/blender/editors/manipulator_library/geometry/geom_arrow_manipulator.c
similarity index 98%
rename from source/blender/editors/manipulator_library/geom_arrow_manipulator.c
rename to 
source/blender/editors/manipulator_library/geometry/geom_arrow_manipulator.c
index 73518e5ac38..34f7d73589c 100644
--- a/source/blender/editors/manipulator_library/geom_arrow_manipulator.c
+++ 
b/source/blender/editors/manipulator_library/geometry/geom_arrow_manipulator.c
@@ -25,7 +25,7 @@
  *  \ingroup wm
  */
 
-#include "manipulator_geometry.h"
+#include "../manipulator_geometry.h"
 
 static float verts[][3] = {
{-0.00, 0.012320, 0.00},
diff --git a/source/blender/editors/manipulator_library/geom_cube_manipulator.c 
b/source/blender/editors/manipulator_library/geometry/geom_cube_manipulator.c
similarity index 98%
rename from source/blender/editors/manipulator_library/geom_cube_manipulator.c
rename to 
source/blender/editors/manipulator_library/geometry/geom_cube_manipulator.c
index a79d9161e96..cee8e1e22ee 100644
--- a/source/blender/editors/manipulator_library/geom_cube_manipulator.c
+++ 
b/source/blender/editors/manipulator_library/geometry/geom_cube_manipulator.c
@@ -27,7 +27,7 @@
  *  \ingroup wm
  */
 
-#include "manipulator_geometry.h"
+#include "../manipulator_geometry.h"
 
 static const float verts[][3] = {
{1.00, 1.00, -1.00},
diff --git a/source/blender/editors/manipulator_library/geom_dial_manipulator.c 
b/source/blender/editors/manipulator_library/geometry/geom_dial_manipulator.c
similarity index 99%
rename from source/blender/editors/manipulator_library/geom_dial_manipulator.c
rename to 
source/blender/editors/manipulator_libra

[Bf-blender-cvs] [b483e937a18] custom-manipulators: Merge branch '28' into custom-manipulators

2017-06-20 Thread Campbell Barton
Commit: b483e937a18cd6473168ffd54802bde0e37153b2
Author: Campbell Barton
Date:   Wed Jun 21 14:14:50 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rBb483e937a18cd6473168ffd54802bde0e37153b2

Merge branch '28' into custom-manipulators

===



===



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


[Bf-blender-cvs] [b7669ac1c67] blender2.8: Manipulators: move settings to ID properties

2017-06-20 Thread Campbell Barton
Commit: b7669ac1c672a92f31735ae9f92b369f9ba30eb1
Author: Campbell Barton
Date:   Wed Jun 21 13:54:46 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBb7669ac1c672a92f31735ae9f92b369f9ba30eb1

Manipulators: move settings to ID properties

This makes manipulator access closer to operators,
and allows Python access.

This adds RNA for manipulators, but not Python registration yet.

- Split draw style into 2x settings:
  `draw_style` (enum) & `draw_options` (enum-flag)
- Rename wmManipulator.properties -> properties_edit,
  Use wmManipulator.properties for ID-properties.
  Note that this area of the API will need further work since
  manipulators now have 2 kinds of properties & API's to access them.

===

M   source/blender/editors/include/ED_manipulator_library.h
M   source/blender/editors/manipulator_library/arrow2d_manipulator.c
M   source/blender/editors/manipulator_library/arrow3d_manipulator.c
M   source/blender/editors/manipulator_library/cage2d_manipulator.c
M   source/blender/editors/manipulator_library/dial3d_manipulator.c
M   source/blender/editors/manipulator_library/grab3d_manipulator.c
M   source/blender/editors/manipulator_library/primitive3d_manipulator.c
M   source/blender/editors/mesh/editmesh_bisect.c
M   source/blender/editors/mesh/editmesh_extrude.c
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_node/node_manipulators.c
M   source/blender/editors/space_view3d/view3d_manipulators.c
M   source/blender/editors/transform/transform_manipulator.c
M   source/blender/editors/transform/transform_manipulator2d.c
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/makesrna/intern/makesrna.c
M   source/blender/makesrna/intern/rna_internal.h
A   source/blender/makesrna/intern/rna_wm_manipulator.c
M   source/blender/windowmanager/manipulators/WM_manipulator_api.h
M   source/blender/windowmanager/manipulators/WM_manipulator_types.h
M   source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
M   
source/blender/windowmanager/manipulators/intern/wm_manipulator_property.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulator_type.c

===

diff --git a/source/blender/editors/include/ED_manipulator_library.h 
b/source/blender/editors/include/ED_manipulator_library.h
index 421fdbf1212..b1970a7bab3 100644
--- a/source/blender/editors/include/ED_manipulator_library.h
+++ b/source/blender/editors/include/ED_manipulator_library.h
@@ -64,70 +64,61 @@ void ED_manipulator_draw_preset_facemap(
 /* 3D Arrow Manipulator */
 
 enum {
-   ED_MANIPULATOR_ARROW_STYLE_NORMAL=  1,
-   ED_MANIPULATOR_ARROW_STYLE_NO_AXIS   = (1 << 1),
-   ED_MANIPULATOR_ARROW_STYLE_CROSS = (1 << 2),
+   ED_MANIPULATOR_ARROW_STYLE_NORMAL= 0,
+   ED_MANIPULATOR_ARROW_STYLE_CROSS = 1,
+   ED_MANIPULATOR_ARROW_STYLE_BOX   = 2,
+   ED_MANIPULATOR_ARROW_STYLE_CONE  = 3,
+};
+
+enum {
/* inverted offset during interaction - if set it also sets constrained 
below */
ED_MANIPULATOR_ARROW_STYLE_INVERTED  = (1 << 3),
/* clamp arrow interaction to property width */
ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED   = (1 << 4),
-   /* use a box for the arrowhead */
-   ED_MANIPULATOR_ARROW_STYLE_BOX   = (1 << 5),
-   ED_MANIPULATOR_ARROW_STYLE_CONE  = (1 << 6),
 };
 
-void ED_manipulator_arrow3d_set_style(struct wmManipulator *mpr, int style);
-void ED_manipulator_arrow3d_set_line_len(struct wmManipulator *mpr, const 
float len);
 void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *mpr, const 
float min, const float max);
 void ED_manipulator_arrow3d_set_range_fac(struct wmManipulator *mpr, const 
float range_fac);
-void ED_manipulator_arrow3d_cone_set_aspect(struct wmManipulator *mpr, const 
float aspect[2]);
-
 
 /*  */
 /* 2D Arrow Manipulator */
 
-void ED_manipulator_arrow2d_set_angle(struct wmManipulator *mpr, const float 
rot_fac);
-void ED_manipulator_arrow2d_set_line_len(struct wmManipulator *mpr, const 
float len);
-
+/* none */
 
 /*  */
 /* Cage Manipulator */
 
 enum {
-   ED_MANIPULATOR_RECT_TRANSFORM_STYLE_TRANSLATE   =  1,   /* 
Manipulator translates */
-   ED_MANIPULATOR_RECT_TRANSFORM_STYLE_ROTATE  = (1 << 1), /* 
Manipulator rotates */
-   ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE   = (1 << 2), /* 
Manipulator scales */
-   ED_MANIPULATOR_RECT_TRANSFORM_STYLE_SCALE_UNIFORM   = (1 << 3), /* 
Manipulator sc

[Bf-blender-cvs] [7966a7baa9d] custom-manipulators: Revert change that added screen to manipulator-map

2017-06-20 Thread Campbell Barton
Commit: 7966a7baa9d307f410f93acaf3c44d43c95c7d1c
Author: Campbell Barton
Date:   Wed Jun 21 13:24:56 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rB7966a7baa9d307f410f93acaf3c44d43c95c7d1c

Revert change that added screen to manipulator-map

Temporary screens caused a crash here,
if we can't assume an area will never have its screen changed
better not store a back-pointer.

This makes `rna_ManipulatorProperties_find_operator` search even more
exhaustive. Not nice but hard to avoid :S

===

M   source/blender/blenkernel/BKE_screen.h
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_action/space_action.c
M   source/blender/editors/space_buttons/space_buttons.c
M   source/blender/editors/space_clip/space_clip.c
M   source/blender/editors/space_console/space_console.c
M   source/blender/editors/space_file/space_file.c
M   source/blender/editors/space_graph/space_graph.c
M   source/blender/editors/space_image/space_image.c
M   source/blender/editors/space_info/space_info.c
M   source/blender/editors/space_logic/space_logic.c
M   source/blender/editors/space_nla/space_nla.c
M   source/blender/editors/space_node/space_node.c
M   source/blender/editors/space_outliner/space_outliner.c
M   source/blender/editors/space_script/space_script.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/editors/space_text/space_text.c
M   source/blender/editors/space_time/space_time.c
M   source/blender/editors/space_userpref/space_userpref.c
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/makesrna/intern/rna_wm_manipulator.c
M   source/blender/windowmanager/manipulators/WM_manipulator_api.h
M   source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
M   source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c

===

diff --git a/source/blender/blenkernel/BKE_screen.h 
b/source/blender/blenkernel/BKE_screen.h
index d78ddbfca2b..6ff344fea38 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -130,7 +130,7 @@ typedef struct ARegionType {
int regionid;   /* unique identifier within this space, defines 
RGN_TYPE_ */

/* add handlers, stuff you only do once or on area/region type/size 
changes */
-   void (*init)(struct wmWindowManager *, const struct bScreen *, struct 
ARegion *);
+   void (*init)(struct wmWindowManager *, struct ARegion *);
/* exit is called when the region is hidden or removed */
void (*exit)(struct wmWindowManager *, struct ARegion *);
/* draw entirely, view changes should be handled here */
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 82cb5705894..5eb51667988 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1521,7 +1521,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow 
*win, ScrArea *sa)
ed_default_handlers(wm, sa, &ar->handlers, 
ar->type->keymapflag);
/* own handlers */
if (ar->type->init) {
-   ar->type->init(wm, screen, ar);
+   ar->type->init(wm, ar);
}
}
else {
diff --git a/source/blender/editors/space_action/space_action.c 
b/source/blender/editors/space_action/space_action.c
index 709f3132f11..fca54b282f8 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -185,7 +185,7 @@ static SpaceLink *action_duplicate(SpaceLink *sl)
 
 
 /* add handlers, stuff you only do once or on area/region changes */
-static void action_main_region_init(wmWindowManager *wm, const bScreen 
*UNUSED(sc), ARegion *ar)
+static void action_main_region_init(wmWindowManager *wm, ARegion *ar)
 {
wmKeyMap *keymap;

@@ -256,7 +256,7 @@ static void action_main_region_draw(const bContext *C, 
ARegion *ar)
 }
 
 /* add handlers, stuff you only do once or on area/region changes */
-static void action_channel_region_init(wmWindowManager *wm, const bScreen 
*UNUSED(sc), ARegion *ar)
+static void action_channel_region_init(wmWindowManager *wm, ARegion *ar)
 {
wmKeyMap *keymap;

@@ -298,7 +298,7 @@ static void action_channel_region_draw(const bContext *C, 
ARegion *ar)
 
 
 /* add handlers, stuff you only do once or on area/region changes */
-static void action_header_region_init(wmWindowManager *UNUSED(wm), const 
bScreen *UNUSED(sc), ARegion *ar)
+static void action_header_region_init(wmWindowManager *UNUSED(wm), AReg

[Bf-blender-cvs] [f410b188320] custom-manipulators: PyAPI: minor improvement to type check

2017-06-20 Thread Campbell Barton
Commit: f410b18832003a8cc95318b332762dbe4d5739c2
Author: Campbell Barton
Date:   Wed Jun 21 13:23:40 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rBf410b18832003a8cc95318b332762dbe4d5739c2

PyAPI: minor improvement to type check

===

M   source/blender/python/intern/bpy_rna.c

===

diff --git a/source/blender/python/intern/bpy_rna.c 
b/source/blender/python/intern/bpy_rna.c
index 8b122b24cd9..51e179fb317 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1839,30 +1839,28 @@ static int pyrna_py_to_prop(
 * class mixing if this causes problems in the 
future it should be removed.
 */
if ((ptr_type == &RNA_AnyType) &&
-   (BPy_StructRNA_Check(value)) &&
-   (RNA_struct_is_a(((BPy_StructRNA 
*)value)->ptr.type, &RNA_Operator)))
+   (BPy_StructRNA_Check(value)))
{
-   value = PyObject_GetAttr(value, 
bpy_intern_str_properties);
-   value_new = value;
-   }
-   /* XXX, de-duplicate (abive) */
-   else if ((ptr_type == &RNA_AnyType) &&
-(BPy_StructRNA_Check(value)) &&
-   (RNA_struct_is_a(((BPy_StructRNA 
*)value)->ptr.type, &RNA_Manipulator)))
-   {
-   value = PyObject_GetAttrString(value, 
"properties");
-   value_new = value;
+   const StructRNA *base_type =
+   
RNA_struct_base_child_of(((const BPy_StructRNA *)value)->ptr.type, NULL);
+   if (ELEM(base_type, &RNA_Operator, 
&RNA_Manipulator)) {
+   value = PyObject_GetAttr(value, 
bpy_intern_str_properties);
+   value_new = value;
+   }
}
 
-   /* if property is an OperatorProperties pointer 
and value is a map,
+   /* if property is an 
OperatorProperties/ManipulatorProperties pointer and value is a map,
 * forward back to pyrna_pydict_to_props */
-   if (RNA_struct_is_a(ptr_type, 
&RNA_OperatorProperties) && PyDict_Check(value)) {
-   PointerRNA opptr = 
RNA_property_pointer_get(ptr, prop);
-   return pyrna_pydict_to_props(&opptr, 
value, false, error_prefix);
-   }
-   else if (RNA_struct_is_a(ptr_type, 
&RNA_ManipulatorProperties) && PyDict_Check(value)) {
-   PointerRNA opptr = 
RNA_property_pointer_get(ptr, prop);
-   return pyrna_pydict_to_props(&opptr, 
value, false, error_prefix);
+   if (PyDict_Check(value)) {
+   const StructRNA *base_type = 
RNA_struct_base_child_of(ptr_type, NULL);
+   if (base_type == 
&RNA_OperatorProperties) {
+   PointerRNA opptr = 
RNA_property_pointer_get(ptr, prop);
+   return 
pyrna_pydict_to_props(&opptr, value, false, error_prefix);
+   }
+   else if (base_type == 
&RNA_ManipulatorProperties) {
+   PointerRNA opptr = 
RNA_property_pointer_get(ptr, prop);
+   return 
pyrna_pydict_to_props(&opptr, value, false, error_prefix);
+   }
}
 
/* another exception, allow to pass a 
collection as an RNA property */

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


[Bf-blender-cvs] [695a824595b] custom-manipulators: Merge branch '28' into custom-manipulators

2017-06-20 Thread Campbell Barton
Commit: 695a824595b266b9d69e4f372fa507a84660c7b6
Author: Campbell Barton
Date:   Wed Jun 21 12:45:02 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rB695a824595b266b9d69e4f372fa507a84660c7b6

Merge branch '28' into custom-manipulators

===



===

diff --cc source/blender/python/intern/bpy_rna.c
index 41b96e2f044,6f3d0145d87..8b122b24cd9
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@@ -1842,17 -1842,10 +1842,17 @@@ static int pyrna_py_to_prop
(BPy_StructRNA_Check(value)) &&
(RNA_struct_is_a(((BPy_StructRNA 
*)value)->ptr.type, &RNA_Operator)))
{
-   value = PyObject_GetAttrString(value, 
"properties");
+   value = PyObject_GetAttr(value, 
bpy_intern_str_properties);
value_new = value;
}
 -
 +  /* XXX, de-duplicate (abive) */
 +  else if ((ptr_type == &RNA_AnyType) &&
 +   (BPy_StructRNA_Check(value)) &&
 +  (RNA_struct_is_a(((BPy_StructRNA 
*)value)->ptr.type, &RNA_Manipulator)))
 +  {
 +  value = PyObject_GetAttrString(value, 
"properties");
 +  value_new = value;
 +  }
  
/* if property is an OperatorProperties pointer 
and value is a map,
 * forward back to pyrna_pydict_to_props */

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


[Bf-blender-cvs] [5b51dcacbc8] blender2.8: PyAPI: add intern strings

2017-06-20 Thread Campbell Barton
Commit: 5b51dcacbc81df6283518317c274bf897010e967
Author: Campbell Barton
Date:   Wed Jun 21 12:43:19 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB5b51dcacbc81df6283518317c274bf897010e967

PyAPI: add intern strings

Avoid string conversion on each use.

===

M   source/blender/python/intern/bpy_interface.c
M   source/blender/python/intern/bpy_intern_string.c
M   source/blender/python/intern/bpy_intern_string.h
M   source/blender/python/intern/bpy_rna.c

===

diff --git a/source/blender/python/intern/bpy_interface.c 
b/source/blender/python/intern/bpy_interface.c
index 7b0daa91523..cd4d2f7a1c2 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -530,7 +530,8 @@ static bool python_script_exec(
 
if (py_dict) {
 #ifdef PYMODULE_CLEAR_WORKAROUND
-   PyModuleObject *mmod = (PyModuleObject 
*)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
+   PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItem(
+   PyThreadState_GET()->interp->modules, 
bpy_intern_str___main__);
PyObject *dict_back = mmod->md_dict;
/* freeing the module will clear the namespace,
 * gives problems running classes defined in this namespace 
being used later. */
diff --git a/source/blender/python/intern/bpy_intern_string.c 
b/source/blender/python/intern/bpy_intern_string.c
index ac0100fa75d..e9d84b2099b 100644
--- a/source/blender/python/intern/bpy_intern_string.c
+++ b/source/blender/python/intern/bpy_intern_string.c
@@ -34,21 +34,23 @@
 
 #include "BLI_utildefines.h"
 
-static PyObject *bpy_intern_str_arr[13];
+static PyObject *bpy_intern_str_arr[15];
 
-PyObject *bpy_intern_str_register;
-PyObject *bpy_intern_str_unregister;
-PyObject *bpy_intern_str_bl_rna;
+PyObject *bpy_intern_str___doc__;
+PyObject *bpy_intern_str___main__;
+PyObject *bpy_intern_str___module__;
+PyObject *bpy_intern_str___name__;
+PyObject *bpy_intern_str___slots__;
+PyObject *bpy_intern_str_attr;
 PyObject *bpy_intern_str_bl_property;
+PyObject *bpy_intern_str_bl_rna;
 PyObject *bpy_intern_str_bpy_types;
+PyObject *bpy_intern_str_frame;
 PyObject *bpy_intern_str_order;
-PyObject *bpy_intern_str_attr;
+PyObject *bpy_intern_str_properties;
+PyObject *bpy_intern_str_register;
 PyObject *bpy_intern_str_self;
-PyObject *bpy_intern_str_frame;
-PyObject *bpy_intern_str___slots__;
-PyObject *bpy_intern_str___name__;
-PyObject *bpy_intern_str___doc__;
-PyObject *bpy_intern_str___module__;
+PyObject *bpy_intern_str_unregister;
 
 void bpy_intern_string_init(void)
 {
@@ -57,19 +59,21 @@ void bpy_intern_string_init(void)
 #define BPY_INTERN_STR(var, str) \
{ var = bpy_intern_str_arr[i++] = PyUnicode_FromString(str); } (void)0
 
-   BPY_INTERN_STR(bpy_intern_str_register, "register");
-   BPY_INTERN_STR(bpy_intern_str_unregister, "unregister");
-   BPY_INTERN_STR(bpy_intern_str_bl_rna, "bl_rna");
+   BPY_INTERN_STR(bpy_intern_str___doc__, "__doc__");
+   BPY_INTERN_STR(bpy_intern_str___main__, "__main__");
+   BPY_INTERN_STR(bpy_intern_str___module__, "__module__");
+   BPY_INTERN_STR(bpy_intern_str___name__, "__name__");
+   BPY_INTERN_STR(bpy_intern_str___slots__, "__slots__");
+   BPY_INTERN_STR(bpy_intern_str_attr, "attr");
BPY_INTERN_STR(bpy_intern_str_bl_property, "bl_property");
+   BPY_INTERN_STR(bpy_intern_str_bl_rna, "bl_rna");
BPY_INTERN_STR(bpy_intern_str_bpy_types, "bpy.types");
+   BPY_INTERN_STR(bpy_intern_str_frame, "frame");
BPY_INTERN_STR(bpy_intern_str_order, "order");
-   BPY_INTERN_STR(bpy_intern_str_attr, "attr");
+   BPY_INTERN_STR(bpy_intern_str_properties, "properties");
+   BPY_INTERN_STR(bpy_intern_str_register, "register");
BPY_INTERN_STR(bpy_intern_str_self, "self");
-   BPY_INTERN_STR(bpy_intern_str_frame, "frame");
-   BPY_INTERN_STR(bpy_intern_str___slots__, "__slots__");
-   BPY_INTERN_STR(bpy_intern_str___name__, "__name__");
-   BPY_INTERN_STR(bpy_intern_str___doc__, "__doc__");
-   BPY_INTERN_STR(bpy_intern_str___module__, "__module__");
+   BPY_INTERN_STR(bpy_intern_str_unregister, "unregister");
 
 #undef BPY_INTERN_STR
 
diff --git a/source/blender/python/intern/bpy_intern_string.h 
b/source/blender/python/intern/bpy_intern_string.h
index 394e84d89bd..66c469f70bc 100644
--- a/source/blender/python/intern/bpy_intern_string.h
+++ b/source/blender/python/intern/bpy_intern_string.h
@@ -30,18 +30,20 @@
 void bpy_intern_string_init(void);
 void bpy_intern_string_exit(void);
 
-extern PyObject *bpy_intern_str_register;
-extern PyObject *bpy_intern_str_unregister;
-extern PyObject *bpy_intern_str_bl_rna;
+extern PyObject *bpy_intern_str___doc__;
+extern PyObject *bpy_intern_str___main__;
+exte

[Bf-blender-cvs] [a355197f13b] custom-manipulators: Merge branch '28' into custom-manipulators

2017-06-20 Thread Campbell Barton
Commit: a355197f13be005dbd184196661534b88d336579
Author: Campbell Barton
Date:   Wed Jun 21 12:23:10 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rBa355197f13be005dbd184196661534b88d336579

Merge branch '28' into custom-manipulators

===



===



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


[Bf-blender-cvs] [d9bb08f111e] blender2.8: RNA: avoid many calls to 'RNA_struct_is_a'

2017-06-20 Thread Campbell Barton
Commit: d9bb08f111e606f30876eb6cef972591b60c1080
Author: Campbell Barton
Date:   Wed Jun 21 12:13:21 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBd9bb08f111e606f30876eb6cef972591b60c1080

RNA: avoid many calls to 'RNA_struct_is_a'

Quicker to find the ID-subtype then use direct pointer comparisons.

Also modify `ID_code_to_RNA_type` so missing ID-codes raise a warning
(handy when adding new ID types).

===

M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/rna_ID.c
M   source/blender/makesrna/intern/rna_access.c

===

diff --git a/source/blender/makesrna/RNA_access.h 
b/source/blender/makesrna/RNA_access.h
index 7d2dfb88043..591f53ad0ab 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -759,6 +759,7 @@ int RNA_struct_ui_icon(const StructRNA *type);
 PropertyRNA *RNA_struct_name_property(const StructRNA *type);
 PropertyRNA *RNA_struct_iterator_property(StructRNA *type);
 StructRNA *RNA_struct_base(StructRNA *type);
+const StructRNA *RNA_struct_base_child_of(const StructRNA *type, const 
StructRNA *parent_type);
 
 bool RNA_struct_is_ID(const StructRNA *type);
 bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna);
diff --git a/source/blender/makesrna/intern/rna_ID.c 
b/source/blender/makesrna/intern/rna_ID.c
index 14d95d4fb1e..3d162137bd1 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -142,48 +142,54 @@ static int rna_ID_name_editable(PointerRNA *ptr, const 
char **UNUSED(r_info))
 
 short RNA_type_to_ID_code(const StructRNA *type)
 {
-   if (RNA_struct_is_a(type, &RNA_Action)) return ID_AC;
-   if (RNA_struct_is_a(type, &RNA_Armature)) return ID_AR;
-   if (RNA_struct_is_a(type, &RNA_Brush)) return ID_BR;
-   if (RNA_struct_is_a(type, &RNA_CacheFile)) return ID_CF;
-   if (RNA_struct_is_a(type, &RNA_Camera)) return ID_CA;
-   if (RNA_struct_is_a(type, &RNA_Curve)) return ID_CU;
-   if (RNA_struct_is_a(type, &RNA_GreasePencil)) return ID_GD;
-   if (RNA_struct_is_a(type, &RNA_Group)) return ID_GR;
-   if (RNA_struct_is_a(type, &RNA_Image)) return ID_IM;
-   if (RNA_struct_is_a(type, &RNA_Key)) return ID_KE;
-   if (RNA_struct_is_a(type, &RNA_Lamp)) return ID_LA;
-   if (RNA_struct_is_a(type, &RNA_Library)) return ID_LI;
-   if (RNA_struct_is_a(type, &RNA_FreestyleLineStyle)) return ID_LS;
-   if (RNA_struct_is_a(type, &RNA_Lattice)) return ID_LT;
-   if (RNA_struct_is_a(type, &RNA_Material)) return ID_MA;
-   if (RNA_struct_is_a(type, &RNA_MetaBall)) return ID_MB;
-   if (RNA_struct_is_a(type, &RNA_MovieClip)) return ID_MC;
-   if (RNA_struct_is_a(type, &RNA_Mesh)) return ID_ME;
-   if (RNA_struct_is_a(type, &RNA_Mask)) return ID_MSK;
-   if (RNA_struct_is_a(type, &RNA_NodeTree)) return ID_NT;
-   if (RNA_struct_is_a(type, &RNA_Object)) return ID_OB;
-   if (RNA_struct_is_a(type, &RNA_ParticleSettings)) return ID_PA;
-   if (RNA_struct_is_a(type, &RNA_Palette)) return ID_PAL;
-   if (RNA_struct_is_a(type, &RNA_PaintCurve)) return ID_PC;
-   if (RNA_struct_is_a(type, &RNA_LightProbe)) return ID_LP;
-   if (RNA_struct_is_a(type, &RNA_Scene)) return ID_SCE;
-   if (RNA_struct_is_a(type, &RNA_Screen)) return ID_SCR;
-   if (RNA_struct_is_a(type, &RNA_Sound)) return ID_SO;
-   if (RNA_struct_is_a(type, &RNA_Speaker)) return ID_SPK;
-   if (RNA_struct_is_a(type, &RNA_Texture)) return ID_TE;
-   if (RNA_struct_is_a(type, &RNA_Text)) return ID_TXT;
-   if (RNA_struct_is_a(type, &RNA_VectorFont)) return ID_VF;
-   if (RNA_struct_is_a(type, &RNA_WorkSpace)) return ID_WS;
-   if (RNA_struct_is_a(type, &RNA_World)) return ID_WO;
-   if (RNA_struct_is_a(type, &RNA_WindowManager)) return ID_WM;
+   const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID);
+   if (UNLIKELY(base_type == NULL)) {
+   return 0;
+   }
+   if (base_type == &RNA_Action) return ID_AC;
+   if (base_type == &RNA_Armature) return ID_AR;
+   if (base_type == &RNA_Brush) return ID_BR;
+   if (base_type == &RNA_CacheFile) return ID_CF;
+   if (base_type == &RNA_Camera) return ID_CA;
+   if (base_type == &RNA_Curve) return ID_CU;
+   if (base_type == &RNA_GreasePencil) return ID_GD;
+   if (base_type == &RNA_Group) return ID_GR;
+   if (base_type == &RNA_Image) return ID_IM;
+   if (base_type == &RNA_Key) return ID_KE;
+   if (base_type == &RNA_Lamp) return ID_LA;
+   if (base_type == &RNA_Library) return ID_LI;
+   if (base_type == &RNA_FreestyleLineStyle) return ID_LS;
+   if (base_type == &RNA_Lattice) return ID_LT;
+   if (base_type == &RNA_Material) return ID_MA;
+   if (base_type == &RNA_MetaBall) return ID_MB;
+

[Bf-blender-cvs] [04896acd698] fracture_modifier: skip exceeded verts in average coord calculation in keep distort mode now too

2017-06-20 Thread Martin Felke
Commit: 04896acd6988b1f77537a37865c0945ca193a8b4
Author: Martin Felke
Date:   Tue Jun 20 22:24:33 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rB04896acd6988b1f77537a37865c0945ca193a8b4

skip exceeded verts in average coord calculation in keep distort mode now too

===

M   source/blender/modifiers/intern/MOD_fracture.c

===

diff --git a/source/blender/modifiers/intern/MOD_fracture.c 
b/source/blender/modifiers/intern/MOD_fracture.c
index 0bbc13f6070..900868a9a20 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -3358,7 +3358,7 @@ static void prepare_automerge(FractureModifierData *fmd, 
BMesh *bm)
 
for (sv = vg->verts.first; sv; sv = sv->next)
{
-   if (!sv->exceeded || fmd->keep_distort) {
+   if (!sv->exceeded) {
v2 = bm->vtable[sv->index];
add_v3_v3(co, v2->co);
add_v3_v3(no, v2->no);

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


[Bf-blender-cvs] [90a463dcfc6] id_copy_refactor: Add new Curve copying code.

2017-06-20 Thread Bastien Montagne
Commit: 90a463dcfc65a2e21134423d75101e32eba7b791
Author: Bastien Montagne
Date:   Tue Jun 20 21:34:18 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB90a463dcfc65a2e21134423d75101e32eba7b791

Add new Curve copying code.

===

M   source/blender/blenkernel/BKE_curve.h
M   source/blender/blenkernel/intern/curve.c
M   source/blender/blenkernel/intern/library.c

===

diff --git a/source/blender/blenkernel/BKE_curve.h 
b/source/blender/blenkernel/BKE_curve.h
index 0d382c8a49c..340a3e842e6 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -78,6 +78,7 @@ void BKE_curve_free(struct Curve *cu);
 void BKE_curve_editfont_free(struct Curve *cu);
 void BKE_curve_init(struct Curve *cu);
 struct Curve *BKE_curve_add(struct Main *bmain, const char *name, int type);
+void BKE_curve_copy_ex(struct Main *bmain, struct Curve *cu_dst, const struct 
Curve *cu_src, const int flag);
 struct Curve *BKE_curve_copy(struct Main *bmain, const struct Curve *cu);
 void BKE_curve_make_local(struct Main *bmain, struct Curve *cu, const bool 
lib_local);
 short BKE_curve_type_get(struct Curve *cu);
diff --git a/source/blender/blenkernel/intern/curve.c 
b/source/blender/blenkernel/intern/curve.c
index 8b32109cf2b..9e3d8dccd3a 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -187,42 +187,46 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int 
type)
return cu;
 }
 
-Curve *BKE_curve_copy(Main *bmain, const Curve *cu)
+void BKE_curve_copy_ex(Main *bmain, Curve *cu_dst, const Curve *cu_src, const 
int flag)
 {
-   Curve *cun;
int a;
 
-   cun = BKE_libblock_copy(bmain, &cu->id);
-
-   BLI_listbase_clear(&cun->nurb);
-   BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb));
+   BLI_listbase_clear(&cu_dst->nurb);
+   BKE_nurbList_duplicate(&(cu_dst->nurb), &(cu_src->nurb));
 
-   cun->mat = MEM_dupallocN(cu->mat);
-   for (a = 0; a < cun->totcol; a++) {
-   id_us_plus((ID *)cun->mat[a]);
+   cu_dst->mat = MEM_dupallocN(cu_src->mat);
+   if ((flag & LIB_ID_COPY_NO_USER_REFCOUNT) == 0) {
+   for (a = 0; a < cu_dst->totcol; a++) {
+   id_us_plus((ID *)cu_dst->mat[a]);
+   }
}
 
-   cun->str = MEM_dupallocN(cu->str);
-   cun->strinfo = MEM_dupallocN(cu->strinfo);
-   cun->tb = MEM_dupallocN(cu->tb);
-   cun->bb = MEM_dupallocN(cu->bb);
+   cu_dst->str = MEM_dupallocN(cu_src->str);
+   cu_dst->strinfo = MEM_dupallocN(cu_src->strinfo);
+   cu_dst->tb = MEM_dupallocN(cu_src->tb);
+   cu_dst->bb = MEM_dupallocN(cu_src->bb);
 
-   if (cu->key) {
-   cun->key = BKE_key_copy(bmain, cu->key);
-   cun->key->from = (ID *)cun;
+   if (cu_src->key) {
+   BKE_id_copy_ex(bmain, &cu_src->key->id, (ID **)&cu_dst->key, 
flag, false);
+   cu_dst->key->id.tag &= ~LIB_TAG_FREE_NO_USER_REFCOUNT;  /* XXX 
Bad hack, to be solved better hopefully :( */
}
 
-   cun->editnurb = NULL;
-   cun->editfont = NULL;
-
-   id_us_plus((ID *)cun->vfont);
-   id_us_plus((ID *)cun->vfontb);
-   id_us_plus((ID *)cun->vfonti);
-   id_us_plus((ID *)cun->vfontbi);
+   cu_dst->editnurb = NULL;
+   cu_dst->editfont = NULL;
 
-   BKE_id_copy_ensure_local(bmain, &cu->id, &cun->id);
+   if ((flag & LIB_ID_COPY_NO_USER_REFCOUNT) == 0) {
+   id_us_plus((ID *)cu_dst->vfont);
+   id_us_plus((ID *)cu_dst->vfontb);
+   id_us_plus((ID *)cu_dst->vfonti);
+   id_us_plus((ID *)cu_dst->vfontbi);
+   }
+}
 
-   return cun;
+Curve *BKE_curve_copy(Main *bmain, const Curve *cu)
+{
+   Curve *cu_copy;
+   BKE_id_copy_ex(bmain, &cu->id, (ID **)&cu_copy, 0, false);
+   return cu_copy;
 }
 
 void BKE_curve_make_local(Main *bmain, Curve *cu, const bool lib_local)
diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 4f2adfef5e3..b765eafa141 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -532,7 +532,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID 
**r_newid, const int flag, con
 
if (!test) {
/* Check to be removed of course, just here until all 
BKE_xxx_copy_ex functions are done. */
-   if (ELEM(GS(id->name), ID_OB, ID_ME, ID_KE)) {
+   if (ELEM(GS(id->name), ID_OB, ID_ME, ID_CU, ID_KE)) {
BKE_libblock_copy_ex(bmain, id, r_newid, flag);
}
}
@@ -545,7 +545,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID 
**r_newid, const int flag, con
if (!test) BKE_mesh_copy_ex(bmain, (Mesh *)*r_newid, 
(Me

[Bf-blender-cvs] [1f7c6fda5d1] id_copy_refactor: Fix wrong assert, and issue with Key ID freeing tag after copying from mesh...

2017-06-20 Thread Bastien Montagne
Commit: 1f7c6fda5d160793c6bd4ce62c1d1d6eb95c59b0
Author: Bastien Montagne
Date:   Tue Jun 20 21:20:43 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB1f7c6fda5d160793c6bd4ce62c1d1d6eb95c59b0

Fix wrong assert, and issue with Key ID freeing tag after copying from mesh...

===

M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/mesh.c

===

diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 356f86cbca6..4f2adfef5e3 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1171,7 +1171,7 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID 
**r_newid, const int fla
 
BLI_assert((flag & LIB_ID_COPY_NO_MAIN) != 0 || bmain != NULL);
BLI_assert((flag & LIB_ID_COPY_NO_MAIN) != 0 || (flag & 
LIB_ID_COPY_NO_ALLOCATE) == 0);
-   BLI_assert((flag & LIB_ID_COPY_NO_MAIN) != 0 || (flag & 
LIB_ID_COPY_NO_USER_REFCOUNT) == 0);
+   BLI_assert((flag & LIB_ID_COPY_NO_MAIN) == 0 || (flag & 
LIB_ID_COPY_NO_USER_REFCOUNT) != 0);
 
if ((flag & LIB_ID_COPY_NO_ALLOCATE) != 0) {
/* r_newid already contains pointer to allocated memory. */
diff --git a/source/blender/blenkernel/intern/mesh.c 
b/source/blender/blenkernel/intern/mesh.c
index 979da27cecf..3465c15f250 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -542,6 +542,7 @@ void BKE_mesh_copy_ex(Main *bmain, Mesh *me_dst, const Mesh 
*me_src, const int f
/* TODO Do we want to add flag to prevent this? */
if (me_src->key) {
BKE_id_copy_ex(bmain, &me_src->key->id, (ID **)&me_dst->key, 
flag, false);
+   me_dst->key->id.tag &= ~LIB_TAG_FREE_NO_USER_REFCOUNT;  /* XXX 
Bad hack, to be solved better hopefully :( */
}
 }

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


[Bf-blender-cvs] [0ef7ccb4d75] blender2.8: Introduce functions/options to indicate the type of render

2017-06-20 Thread Dalai Felinto
Commit: 0ef7ccb4d753f08cbf31a9b8b22420b1f509b207
Author: Dalai Felinto
Date:   Tue Jun 20 18:33:58 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB0ef7ccb4d753f08cbf31a9b8b22420b1f509b207

Introduce functions/options to indicate the type of render

We should be able to differentiate between OpenGL render (viewport
render), offline render (F12), and view render (viewport draw).

This allows for us preventing offline render to skip mode drawings, grid, ...
Even OpenGL render can benefit from this forcing a higher quality
anti-alias and sampling than the viewport drawing.

I'm not sure if it's clever to keep the memset(0x00) outside the render
loop function as it is in this patch. An alternative is to just pass the
render "type" as a flag to the render function, and set DST.options
inside it. (I may change this tomorrow, I will wait to hear from
Campbell on that).

===

M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 7c47f47100b..aa6b836be17 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -378,6 +378,8 @@ void DRW_state_dfdy_factors_get(float dfdyfac[2]);
 bool DRW_state_is_fbo(void);
 bool DRW_state_is_select(void);
 bool DRW_state_is_depth(void);
+bool DRW_state_is_image_render(void);
+bool DRW_state_is_scene_render(void);
 bool DRW_state_show_text(void);
 
 struct DRWTextStore *DRW_state_text_cache_get(void);
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index bebb9fce590..6d41893e50e 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -301,6 +301,8 @@ static struct DRWGlobalState {
struct {
unsigned int is_select : 1;
unsigned int is_depth : 1;
+   unsigned int is_image_render : 1;
+   unsigned int is_scene_render : 1;
} options;
 
/* Current rendering context */
@@ -2725,7 +2727,10 @@ static void DRW_engines_enable(const Scene *scene, 
SceneLayer *sl, const View3D
 {
const int mode = CTX_data_mode_enum_ex(scene->obedit, OBACT_NEW);
DRW_engines_enable_from_engine(scene);
-   if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+
+   if ((DRW_state_is_scene_render() == false) &&
+   (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
+   {
DRW_engines_enable_from_object_mode();
DRW_engines_enable_from_mode(mode);
}
@@ -2920,11 +2925,14 @@ void DRW_draw_view(const bContext *C)
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
 
+   /* Reset before using it. */
+   memset(&DST, 0x0, sizeof(DST));
DRW_draw_render_loop_ex(graph, ar, v3d, C);
 }
 
 /**
  * Used for both regular and off-screen drawing.
+ * Need to reset DST before calling this function
  */
 void DRW_draw_render_loop_ex(
 struct Depsgraph *graph,
@@ -2935,9 +2943,6 @@ void DRW_draw_render_loop_ex(
SceneLayer *sl = DEG_get_scene_layer(graph);
RegionView3D *rv3d = ar->regiondata;
 
-   /* Reset before using it. */
-   memset(&DST, 0x0, sizeof(DST));
-
DST.draw_ctx.evil_C = evil_C;
 
bool cache_is_dirty;
@@ -3028,6 +3033,8 @@ void DRW_draw_render_loop(
 struct Depsgraph *graph,
 ARegion *ar, View3D *v3d)
 {
+   /* Reset before using it. */
+   memset(&DST, 0x0, sizeof(DST));
DRW_draw_render_loop_ex(graph, ar, v3d, NULL);
 }
 
@@ -3044,9 +3051,10 @@ void DRW_draw_render_loop_offscreen(
rv3d->viewport = GPU_viewport_create_from_offscreen(ofs);
}
 
-   DST.draw_ctx.evil_C = NULL;
-
-   DRW_draw_render_loop(graph, ar, v3d);
+   /* Reset before using it. */
+   memset(&DST, 0x0, sizeof(DST));
+   DST.options.is_image_render = true;
+   DRW_draw_render_loop_ex(graph, ar, v3d, NULL);
 
/* restore */
{
@@ -3304,12 +3312,32 @@ bool DRW_state_is_depth(void)
 }
 
 /**
+ * Whether we are rendering for an image
+ */
+bool DRW_state_is_image_render(void)
+{
+   return DST.options.is_image_render;
+}
+
+/**
+ * Whether we are rendering only the render engine,
+ * or if we should also render the mode engines.
+ */
+bool DRW_state_is_scene_render(void)
+{
+   BLI_assert(DST.options.is_scene_render ?
+  DST.options.is_image_render : true);
+   return DST.options.is_scene_render;
+}
+
+/**
  * Should text draw in this mode?
  */
 bool DRW_state_show_text(void)
 {
return (DST.options.is_select) == 0 &&
-  (DST.options.is_depth) == 0;
+  (DST.options.is_depth) == 0 &&
+  (DST.options.is_scene_render) == 0;
 }
 
 /** \} *

[Bf-blender-cvs] [a2ad1b4e88e] soc-2017-normal-tools: Added invalidate for transform ops.

2017-06-20 Thread Rohan Rathi
Commit: a2ad1b4e88e155fa0b7457312373c49eeb13754d
Author: Rohan Rathi
Date:   Tue Jun 20 23:03:32 2017 +0530
Branches: soc-2017-normal-tools
https://developer.blender.org/rBa2ad1b4e88e155fa0b7457312373c49eeb13754d

Added invalidate for transform ops.

Can now keep clnors when transform ops are applied. As now invalidation for 
each function is harder to keep track of, Added a function which rebuilds all 
the lnor spaces in the mesh when BM_lnorspace_rebuild is called to detect if 
any unmarked spaces are rebuilt.

===

M   source/blender/bmesh/intern/bmesh_mesh.c
M   source/blender/bmesh/intern/bmesh_mesh.h
M   source/blender/editors/include/ED_transform.h
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh.c 
b/source/blender/bmesh/intern/bmesh_mesh.c
index e1d110fb486..f6c5e1d7b17 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -1034,6 +1034,7 @@ void BM_lnorspace_invalidate(BMesh *bm, bool inval_all)
}
}
}
+   bm->spacearr_dirty |= BM_SPACEARR_DIRTY;
 }
 
 void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor)
@@ -1096,6 +1097,10 @@ void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor)
}
MEM_freeN(oldnors);
bm->spacearr_dirty &= ~(BM_SPACEARR_DIRTY | BM_SPACEARR_DIRTY_ALL);
+
+#ifdef DEBUG
+   BM_lnorspace_err(bm);
+#endif
 }
 
 void BM_lnorspace_update(BMesh *bm)
@@ -1114,6 +1119,52 @@ void BM_lnorspace_update(BMesh *bm)
MEM_freeN(lnors);
 }
 
+/* Auxillary function only used by rebuild to detect if any spaces were not 
marked in invalidate.
+   Reports error if any of the lnor spaces change after rebuilding, meaning 
that the all possible
+   lnor spaces to be rebuilt were not correctly marked */
+static void BM_lnorspace_err(BMesh *bm)
+{
+   bm->spacearr_dirty |= BM_SPACEARR_DIRTY_ALL;
+   bool clear = true;
+
+   MLoopNorSpaceArray *temp = MEM_callocN(sizeof(*temp), "__func__");
+   temp->lspacearr = NULL;
+
+   BKE_lnor_spacearr_init(temp, bm->totloop);
+
+   temp->lspacearr = MEM_callocN(sizeof(MLoopNorSpace *) * bm->totloop, 
"__func__");
+
+   for (int i = 0; i < bm->totloop; i++) {
+   temp->lspacearr[i] = BKE_lnor_space_create(temp);
+   memcpy(temp->lspacearr[i], bm->lnor_spacearr->lspacearr[i], 
sizeof(MLoopNorSpace));
+   }
+   
+   int cd_loop_clnors_offset = CustomData_get_offset(&bm->ldata, 
CD_CUSTOMLOOPNORMAL);
+   float(*lnors)[3] = MEM_callocN(sizeof(*lnors) * bm->totloop, 
"__func__");
+   BM_loops_calc_normal_vcos(bm, NULL, NULL, NULL, true, M_PI, lnors, 
bm->lnor_spacearr, NULL, cd_loop_clnors_offset, true);
+
+   for (int i = 0; i < bm->totloop; i++) {
+   int j = 0;
+   j += compare_ff(temp->lspacearr[i]->ref_alpha, 
bm->lnor_spacearr->lspacearr[i]->ref_alpha, 1.0f - 1e-4f);
+   j += compare_ff(temp->lspacearr[i]->ref_beta, 
bm->lnor_spacearr->lspacearr[i]->ref_beta, 1.0f - 1e-4f);
+   j += compare_v3v3(temp->lspacearr[i]->vec_lnor, 
bm->lnor_spacearr->lspacearr[i]->vec_lnor, 1.0f - 1e-4f);
+   j += compare_v3v3(temp->lspacearr[i]->vec_ortho, 
bm->lnor_spacearr->lspacearr[i]->vec_ortho, 1.0f - 1e-4f);
+   j += compare_v3v3(temp->lspacearr[i]->vec_ref, 
bm->lnor_spacearr->lspacearr[i]->vec_ref, 1.0f - 1e-4f);
+
+   if (j != 5) {
+   clear = false;
+   break;
+   }
+   }
+   BKE_lnor_spacearr_free(temp);
+   MEM_freeN(temp);
+   MEM_freeN(lnors);
+   BLI_assert(clear);
+
+   bm->spacearr_dirty &= ~BM_SPACEARR_DIRTY_ALL;
+
+}
+
 int BM_total_loop_select(BMesh *bm)
 {
int r_sel = 0;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h 
b/source/blender/bmesh/intern/bmesh_mesh.h
index b74394276eb..499be9c0508 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -56,6 +56,7 @@ void BM_lnorspacearr_store(BMesh *bm, float (*r_lnors)[3]);
 void BM_lnorspace_invalidate(BMesh *bm, bool inval_all);
 void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor);
 void BM_lnorspace_update(BMesh *bm);
+static void BM_lnorspace_err(BMesh *bm);
 
 /* Loop Generics */
 int BM_total_loop_select(BMesh *bm);
diff --git a/source/blender/editors/include/ED_transform.h 
b/source/blender/editors/include/ED_transform.h
index a575fe4bfaf..9db0d632d8f 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -150,6 +150,7 @@ int BIF_countTransformOrientation(const struct bContext *C);
 #define P_NO_DEFAULTS   (1 <

[Bf-blender-cvs] [9e08019b74c] master: Fix: Icon alignment for scaled pie buttons with no text

2017-06-20 Thread raa
Commit: 9e08019b74c7032feea81db16eb9165899c3fd41
Author: raa
Date:   Tue Jun 20 20:15:04 2017 +0300
Branches: master
https://developer.blender.org/rB9e08019b74c7032feea81db16eb9165899c3fd41

Fix: Icon alignment for scaled pie buttons with no text

===

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

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 7180e18ab92..64b26406f84 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3168,7 +3168,9 @@ static uiBut *ui_def_but(
}
 
if (block->flag & UI_BLOCK_RADIAL) {
-   but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
+   but->drawflag |= UI_BUT_TEXT_LEFT;
+   if (but->str && but->str[0])
+   but->drawflag |= UI_BUT_ICON_LEFT;
}
else if ((block->flag & UI_BLOCK_LOOP) ||
 ELEM(but->type,
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index 30a2094fee7..da43a58bc74 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2396,8 +2396,10 @@ static void ui_litem_layout_radial(uiLayout *litem)
/* add a little bit more here to include number 
*/
bitem->but->rect.xmax += 1.5f * UI_UNIT_X;
/* enable drawing as pie item if supported by 
widget */
-   if (ui_item_is_radial_drawable(bitem))
+   if (ui_item_is_radial_drawable(bitem)) {
bitem->but->dt = UI_EMBOSS_RADIAL;
+   bitem->but->drawflag |= 
UI_BUT_ICON_LEFT;
+   }
}
 
ui_item_size(item, &itemw, &itemh);

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


[Bf-blender-cvs] [5c5c09439ab] blender2.8: Clean node names and organize menus for eevee

2017-06-20 Thread Luca Rood
Commit: 5c5c09439abdf2f759fbc3c17a4e773b9005d77f
Author: Luca Rood
Date:   Tue Jun 20 14:33:13 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB5c5c09439abdf2f759fbc3c17a4e773b9005d77f

Clean node names and organize menus for eevee

This makes the node menus aware of the Cycles/Eevee distinction, and
only show the relevant nodes for the current engine. Names have also
been changed to accomodate for the new output node system.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/space_node/node_edit.c
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_shader.h
M   source/blender/nodes/NOD_static_types.h
R080source/blender/nodes/shader/nodes/node_shader_output_metallic.c 
source/blender/nodes/shader/nodes/node_shader_eevee_metallic.c
R080source/blender/nodes/shader/nodes/node_shader_output_specular.c 
source/blender/nodes/shader/nodes/node_shader_eevee_specular.c
M   source/blender/nodes/shader/nodes/node_shader_output_eevee_material.c

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 59bf93696bc..f13222140b1 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -141,6 +141,20 @@ def object_shader_nodes_poll(context):
 snode.shader_type == 'OBJECT')
 
 
+def cycles_shader_nodes_poll(context):
+return context.scene.render.engine == 'CYCLES'
+
+
+def object_cycles_shader_nodes_poll(context):
+return (object_shader_nodes_poll(context) and
+cycles_shader_nodes_poll(context))
+
+
+def object_eevee_shader_nodes_poll(context):
+return (object_shader_nodes_poll(context) and
+context.scene.render.engine == 'BLENDER_EEVEE')
+
+
 # All standard node categories currently used in nodes.
 
 shader_node_categories = [
@@ -216,36 +230,36 @@ shader_node_categories = [
 NodeItem("NodeGroupInput", poll=group_input_output_item_poll),
 ]),
 ShaderNewNodeCategory("SH_NEW_OUTPUT", "Output", items=[
-NodeItem("ShaderNodeOutputMetallic", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeOutputSpecular", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeOutputMaterial", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeOutputEeveeMaterial", 
poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeOutputLamp", poll=object_shader_nodes_poll),
+NodeItem("ShaderNodeOutputMaterial", 
poll=object_cycles_shader_nodes_poll),
+NodeItem("ShaderNodeOutputEeveeMaterial", 
poll=object_eevee_shader_nodes_poll),
+NodeItem("ShaderNodeOutputLamp", poll=object_cycles_shader_nodes_poll),
 NodeItem("ShaderNodeOutputWorld", poll=world_shader_nodes_poll),
 NodeItem("ShaderNodeOutputLineStyle", 
poll=line_style_shader_nodes_poll),
 NodeItem("NodeGroupOutput", poll=group_input_output_item_poll),
 ]),
 ShaderNewNodeCategory("SH_NEW_SHADER", "Shader", items=[
-NodeItem("ShaderNodeMixShader"),
-NodeItem("ShaderNodeAddShader"),
-NodeItem("ShaderNodeBsdfDiffuse", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfPrincipled", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfGlossy", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfTransparent", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfRefraction", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfGlass", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfTranslucent", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfAnisotropic", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfVelvet", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfToon", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeSubsurfaceScattering", 
poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeEmission", poll=object_shader_nodes_poll),
-NodeItem("ShaderNodeBsdfHair", poll=object_shader_nodes_poll),
+NodeItem("ShaderNodeMixShader", poll=cycles_shader_nodes_poll),
+NodeItem("ShaderNodeAddShader", poll=cycles_shader_nodes_poll),
+NodeItem("ShaderNodeBsdfDiffuse", 
poll=object_cycles_shader_nodes_poll),
+NodeItem("ShaderNodeBsdfPrincipled", 
poll=object_cycles_shader_nodes_poll),
+NodeItem("ShaderNodeBsdfGlossy", poll=object_cycles_shader_nodes_poll),
+NodeItem("ShaderNodeBsdfTransparent", 
poll=object_cycles_shader_nodes_poll),
+NodeItem("ShaderNodeBsdfRefraction", 
pol

[Bf-blender-cvs] [aaf37e1216b] blender2.8: Implement Eevee output node system

2017-06-20 Thread Luca Rood
Commit: aaf37e1216b2a9dfc43591e227c679a5b35af8c0
Author: Luca Rood
Date:   Mon Jun 19 16:31:10 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBaaf37e1216b2a9dfc43591e227c679a5b35af8c0

Implement Eevee output node system

This makes Eevee consistent with Cycles, by having a single output node,
and multiple shader nodes that connect to it.

Note that node systems for Eevee saved before this will be missing the
output node, and thus will show an invalid material. This is easily
resolved by connecting the shader output to a new output node.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.c
M   source/blender/editors/space_node/node_edit.c
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_shader.h
M   source/blender/nodes/NOD_static_types.h
A   source/blender/nodes/shader/nodes/node_shader_output_eevee_material.c
M   source/blender/nodes/shader/nodes/node_shader_output_metallic.c
M   source/blender/nodes/shader/nodes/node_shader_output_specular.c

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 2e2684a0524..59bf93696bc 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -219,6 +219,7 @@ shader_node_categories = [
 NodeItem("ShaderNodeOutputMetallic", poll=object_shader_nodes_poll),
 NodeItem("ShaderNodeOutputSpecular", poll=object_shader_nodes_poll),
 NodeItem("ShaderNodeOutputMaterial", poll=object_shader_nodes_poll),
+NodeItem("ShaderNodeOutputEeveeMaterial", 
poll=object_shader_nodes_poll),
 NodeItem("ShaderNodeOutputLamp", poll=object_shader_nodes_poll),
 NodeItem("ShaderNodeOutputWorld", poll=world_shader_nodes_poll),
 NodeItem("ShaderNodeOutputLineStyle", 
poll=line_style_shader_nodes_poll),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index bda762b73b6..44846a12961 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -796,6 +796,7 @@ struct ShadeResult;
 #define SH_NODE_BSDF_PRINCIPLED 193
 #define SH_NODE_OUTPUT_METALLIC194
 #define SH_NODE_OUTPUT_SPECULAR195
+#define SH_NODE_OUTPUT_EEVEE_MATERIAL  196
 
 /* custom defines options for Material node */
 #define SH_NODE_MAT_DIFF   1
diff --git a/source/blender/blenkernel/intern/node.c 
b/source/blender/blenkernel/intern/node.c
index 068db37..8d512f15949 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3592,6 +3592,7 @@ static void registerShaderNodes(void)
register_node_type_sh_output_material();
register_node_type_sh_output_metallic();
register_node_type_sh_output_specular();
+   register_node_type_sh_output_eevee_material();
register_node_type_sh_output_world();
register_node_type_sh_output_linestyle();
 
diff --git a/source/blender/editors/space_node/node_edit.c 
b/source/blender/editors/space_node/node_edit.c
index c70cbeef52f..9ad40ea802e 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -399,14 +399,10 @@ void ED_node_shader_default(const bContext *C, ID *id)
ma->nodetree = ntree;
 
if (BKE_scene_uses_blender_eevee(scene)) {
-   out = nodeAddStaticNode(C, ntree, 
SH_NODE_OUTPUT_METALLIC);
-   out->locx = 300.0f; out->locy = 300.0f;
-   nodeSetActive(ntree, out);
-   ntreeUpdateTree(CTX_data_main(C), ntree);
-   return;
+   output_type = SH_NODE_OUTPUT_EEVEE_MATERIAL;
+   shader_type = SH_NODE_OUTPUT_METALLIC;
}
-
-   if (BKE_scene_use_new_shading_nodes(scene)) {
+   else if (BKE_scene_use_new_shading_nodes(scene)) {
output_type = SH_NODE_OUTPUT_MATERIAL;
shader_type = SH_NODE_BSDF_DIFFUSE;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 7595a3cf6b7..f423e541dc2 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -3893,6 +3893,12 @@ void node_output_specular(
 {
result = vec4(eevee_surface_lit(normal, diffuse.rgb, specular.rgb, 
roughness, occlusion) + emissive.rgb, 

[Bf-blender-cvs] [39b0c6f0605] id_copy_refactor: Add Mesh and Key support to new copying code.

2017-06-20 Thread Bastien Montagne
Commit: 39b0c6f0605ef7b448a0ffab66eaaa50f047ded5
Author: Bastien Montagne
Date:   Tue Jun 20 17:53:59 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB39b0c6f0605ef7b448a0ffab66eaaa50f047ded5

Add Mesh and Key support to new copying code.

===

M   source/blender/blenkernel/BKE_key.h
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/key.c
M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/mesh.c

===

diff --git a/source/blender/blenkernel/BKE_key.h 
b/source/blender/blenkernel/BKE_key.h
index 94e8a24fbc5..20abb4b5331 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -51,6 +51,7 @@ extern "C" {
 voidBKE_key_free(struct Key *sc);
 voidBKE_key_free_nolib(struct Key *key);
 struct Key *BKE_key_add(struct ID *id);
+void BKE_key_copy_ex(struct Main *bmain, struct Key *key_dst, const struct Key 
*key_src, const int flag);
 struct Key *BKE_key_copy(struct Main *bmain, const struct Key *key);
 struct Key *BKE_key_copy_nolib(struct Key *key);
 voidBKE_key_sort(struct Key *key);
diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 2411850c0d2..24762761952 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -87,6 +87,7 @@ int BKE_mesh_edge_other_vert(const struct MEdge *e, int v);
 void BKE_mesh_free(struct Mesh *me);
 void BKE_mesh_init(struct Mesh *me);
 struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name);
+void BKE_mesh_copy_ex(struct Main *bmain, struct Mesh *me_dst, const struct 
Mesh *me_src, const int flag);
 struct Mesh *BKE_mesh_copy(struct Main *bmain, const struct Mesh *me);
 void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool 
do_ensure_tess_cd);
 void BKE_mesh_ensure_skin_customdata(struct Mesh *me);
diff --git a/source/blender/blenkernel/intern/key.c 
b/source/blender/blenkernel/intern/key.c
index 98b251294ae..6ec5daceef8 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -151,31 +151,38 @@ Key *BKE_key_add(ID *id)/* common function */
return key;
 }
 
-Key *BKE_key_copy(Main *bmain, const Key *key)
+/**
+ * Only copy internal data of ShapeKey ID from source to already 
allocated/initialized destination.
+ * You probably nerver want to use that directly, use id_copy or 
BKE_id_copy_ex for typical needs.
+ *
+ * @param flag  Copying options (see BKE_library.h's LIB_ID_COPY_... flags for 
more).
+ */
+void BKE_key_copy_ex(Main *UNUSED(bmain), Key *key_dst, const Key *key_src, 
const int UNUSED(flag))
 {
-   Key *keyn;
-   KeyBlock *kbn, *kb;
-   
-   keyn = BKE_libblock_copy(bmain, &key->id);
-   
-   BLI_duplicatelist(&keyn->block, &key->block);
-   
-   kb = key->block.first;
-   kbn = keyn->block.first;
-   while (kbn) {
-   
-   if (kbn->data) kbn->data = MEM_dupallocN(kbn->data);
-   if (kb == key->refkey) keyn->refkey = kbn;
-   
-   kbn = kbn->next;
-   kb = kb->next;
-   }
+   BLI_duplicatelist(&key_dst->block, &key_src->block);
 
-   BKE_id_copy_ensure_local(bmain, &key->id, &keyn->id);
+   KeyBlock *kb_dst, *kb_src;
+   for (kb_src = key_src->block.first, kb_dst = key_dst->block.first;
+kb_dst;
+kb_src = kb_src->next, kb_dst = kb_dst->next)
+   {
+   if (kb_dst->data) {
+   kb_dst->data = MEM_dupallocN(kb_dst->data);
+   }
+   if (kb_src == key_src->refkey) {
+   key_dst->refkey = kb_dst;
+   }
+   }
+}
 
-   return keyn;
+Key *BKE_key_copy(Main *bmain, const Key *key)
+{
+   Key *key_copy;
+   BKE_id_copy_ex(bmain, &key->id, (ID **)&key_copy, 0, false);
+   return key_copy;
 }
 
+/* XXX TODO get rid of this! */
 Key *BKE_key_copy_nolib(Key *key)
 {
Key *keyn;
diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index b008604a29b..356f86cbca6 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -532,7 +532,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID 
**r_newid, const int flag, con
 
if (!test) {
/* Check to be removed of course, just here until all 
BKE_xxx_copy_ex functions are done. */
-   if (ELEM(GS(id->name), ID_OB)) {
+   if (ELEM(GS(id->name), ID_OB, ID_ME, ID_KE)) {
BKE_libblock_copy_ex(bmain, id, r_newid, flag);
}
}
@@ -542,7 +542,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID 
**r_newid, const int flag, con
if 

[Bf-blender-cvs] [3a86873b68b] id_copy_refactor: Make object copying fully compatible/aware of new copy flag system.

2017-06-20 Thread Bastien Montagne
Commit: 3a86873b68b809165c46f58512ac0fbcc889d8cd
Author: Bastien Montagne
Date:   Tue Jun 20 13:39:30 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB3a86873b68b809165c46f58512ac0fbcc889d8cd

Make object copying fully compatible/aware of new copy flag system.

(continuation of previous WIP commit, sorry about that one :/ ).

This commits changes quite a few things, distributing new copying flags
into sub-data copying code (mostly concerns ID refcounting or not).

It also removes ID refcounting handling from Modifiers' copy callback
(this was ugly from the start, proved to be problematic in current
master, and generally bad practice). This is now done by calling code.

Also, it brings back ID refcounting handling to main BKE_library's copy
code, which means in generic ID copying lower-level IDType-specific copy
code should not use it at all. Support at lower-level remains needed
though, unfortunately, to cope with partial copying tools etc.

===

M   source/blender/blenkernel/BKE_action.h
M   source/blender/blenkernel/BKE_constraint.h
M   source/blender/blenkernel/BKE_idprop.h
M   source/blender/blenkernel/BKE_library.h
M   source/blender/blenkernel/BKE_modifier.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/BKE_pointcache.h
M   source/blender/blenkernel/BKE_rigidbody.h
M   source/blender/blenkernel/BKE_sca.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/constraint.c
M   source/blender/blenkernel/intern/idprop.c
M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/modifier.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenkernel/intern/rigidbody.c
M   source/blender/blenkernel/intern/sca.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/physics/particle_object.c
M   source/blender/modifiers/intern/MOD_wave.c
M   source/blender/modifiers/intern/MOD_weightvgedit.c
M   source/blender/modifiers/intern/MOD_weightvgmix.c
M   source/blender/modifiers/intern/MOD_weightvgproximity.c

===

diff --git a/source/blender/blenkernel/BKE_action.h 
b/source/blender/blenkernel/BKE_action.h
index 5db0c3c9130..8ff5ab5b279 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -150,6 +150,7 @@ void BKE_pose_free_data_ex(struct bPose 
*pose, bool do_id_user);
 void BKE_pose_free_data(struct bPose *pose);
 void BKE_pose_free(struct bPose *pose);
 void BKE_pose_free_ex(struct bPose *pose, bool do_id_user);
+void BKE_pose_copy_data_ex(struct bPose **dst, const struct 
bPose *src, const int flag, const bool copy_constraints);
 void BKE_pose_copy_data(struct bPose **dst, const struct bPose 
*src, const bool copy_constraints);
 void BKE_pose_channel_copy_data(struct bPoseChannel *pchan, 
const struct bPoseChannel *pchan_from);
 struct bPoseChannel *BKE_pose_channel_find_name(const struct bPose *pose, 
const char *name);
diff --git a/source/blender/blenkernel/BKE_constraint.h 
b/source/blender/blenkernel/BKE_constraint.h
index 047d1787f76..4e0eb5c65ac 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -120,6 +120,7 @@ void BKE_constraint_unique_name(struct bConstraint *con, 
struct ListBase *list);
 void BKE_constraints_free(struct ListBase *list);
 void BKE_constraints_free_ex(struct ListBase *list, bool do_id_user);
 void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, 
bool do_extern);
+void BKE_constraints_copy_ex(struct ListBase *dst, const struct ListBase *src, 
const int flag, bool do_extern);
 void BKE_constraints_id_loop(struct ListBase *list, ConstraintIDFunc func, 
void *userdata);
 void BKE_constraint_free_data(struct bConstraint *con);
 void BKE_constraint_free_data_ex(struct bConstraint *con, bool do_id_user);
diff --git a/source/blender/blenkernel/BKE_idprop.h 
b/source/blender/blenkernel/BKE_idprop.h
index ab8728faedb..5d8cd02756d 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -58,7 +58,7 @@ typedef union IDPropertyTemplate {
 /* --- Property Array Type -- */
 
 IDProperty *IDP_NewIDPArray(const char *name) ATTR_WARN_UNUSED_RESULT 
ATTR_NONNULL();
-IDProperty *IDP_CopyIDPArray(const IDProperty *array) ATTR_WARN_UNUSED_RESULT 
ATTR_NONNULL();
+IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag) 
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 
 /* shallow copies item */
 void IDP_SetIndexArray(struct IDProperty *prop, int index, s

[Bf-blender-cvs] [babc0c9bd71] id_copy_refactor: Fix (unreported) bad copying code of Surface Deform modifier.

2017-06-20 Thread Bastien Montagne
Commit: babc0c9bd71de106cef1945630b003af28259dd2
Author: Bastien Montagne
Date:   Mon Jun 19 14:57:40 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rBbabc0c9bd71de106cef1945630b003af28259dd2

Fix (unreported) bad copying code of Surface Deform modifier.

===

M   source/blender/modifiers/intern/MOD_surfacedeform.c

===

diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c 
b/source/blender/modifiers/intern/MOD_surfacedeform.c
index 79e3eb5f3df..b692137b604 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -138,7 +138,9 @@ static void copyData(ModifierData *md, ModifierData *target)
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
SurfaceDeformModifierData *tsmd = (SurfaceDeformModifierData *)target;
 
-   *tsmd = *smd;
+   freeData(target);
+
+   modifier_copyData_generic(md, target);
 
if (smd->verts) {
tsmd->verts = MEM_dupallocN(smd->verts);

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


[Bf-blender-cvs] [d0af31b317c] id_copy_refactor: Fix T51762: Unit test script_alembic_import is failing.

2017-06-20 Thread Sybren A. Stüvel
Commit: d0af31b317c6e2fb98f56c085fcd7366bc57938a
Author: Sybren A. Stüvel
Date:   Mon Jun 19 17:50:43 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rBd0af31b317c6e2fb98f56c085fcd7366bc57938a

Fix T51762: Unit test script_alembic_import is failing.

Implemented workaround for use with the legacy depsgraph.

===

M   tests/python/CMakeLists.txt
M   tests/python/bl_alembic_import_test.py

===

diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index d4326d48d6d..9e1ebcbe669 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -474,6 +474,7 @@ if(WITH_ALEMBIC)
--python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
--
--testdir "${TEST_SRC_DIR}/alembic"
+   --with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
)
 
else()
@@ -487,6 +488,7 @@ if(WITH_ALEMBIC)
--python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
--
--testdir "${TEST_SRC_DIR}/alembic"
+   --with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
)
 
endif()
diff --git a/tests/python/bl_alembic_import_test.py 
b/tests/python/bl_alembic_import_test.py
index 0e7257d30b9..d8cd64a1d56 100644
--- a/tests/python/bl_alembic_import_test.py
+++ b/tests/python/bl_alembic_import_test.py
@@ -129,6 +129,9 @@ class SimpleImportTest(AbstractAlembicTest):
 bpy.data.cache_files[fname].filepath = relpath.replace('1.abc', 
'2.abc')
 bpy.context.scene.update()
 
+if args.with_legacy_depsgraph:
+bpy.context.scene.frame_set(10)
+
 x, y, z = cube.matrix_world.to_euler('XYZ')
 self.assertAlmostEqual(x, math.pi / 2, places=5)
 self.assertAlmostEqual(y, 0)
@@ -213,6 +216,8 @@ def main():
 
 parser = argparse.ArgumentParser()
 parser.add_argument('--testdir', required=True, type=pathlib.Path)
+parser.add_argument('--with-legacy-depsgraph', default=False,
+type=lambda v: v in {'ON', 'YES', 'TRUE'})
 args, remaining = parser.parse_known_args(argv)
 
 unittest.main(argv=remaining)

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


[Bf-blender-cvs] [596c20c677a] id_copy_refactor: Alembic tests: make failures a bit easier to diagnose.

2017-06-20 Thread Sybren A. Stüvel
Commit: 596c20c677a7f66a45c271b0de71be7d35453280
Author: Sybren A. Stüvel
Date:   Mon Jun 19 17:55:51 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB596c20c677a7f66a45c271b0de71be7d35453280

Alembic tests: make failures a bit easier to diagnose.

===

M   tests/python/alembic_tests.py

===

diff --git a/tests/python/alembic_tests.py b/tests/python/alembic_tests.py
index e36a6391298..96a68de9801 100755
--- a/tests/python/alembic_tests.py
+++ b/tests/python/alembic_tests.py
@@ -157,6 +157,8 @@ class AbstractAlembicTest(unittest.TestCase):
 if proptype == 'CompoundProperty':
 # To read those, call self.abcprop() on it.
 continue
+if len(parts) < 2:
+raise ValueError('Error parsing result from abcprop: %s', 
info.strip())
 valtype_and_arrsize, name_and_extent = parts[1:]
 
 # Parse name and extent

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


[Bf-blender-cvs] [12a5a628f35] id_copy_refactor: Fixed bl_load_py_modules / script_load_modules unit test

2017-06-20 Thread Sybren A. Stüvel
Commit: 12a5a628f355993fac8240a63dd91c33dc65c4bb
Author: Sybren A. Stüvel
Date:   Mon Jun 19 15:28:28 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB12a5a628f355993fac8240a63dd91c33dc65c4bb

Fixed bl_load_py_modules / script_load_modules unit test

It tried to assert that
addons/io_blend_utils/blender_bam-unpacked.whl/__init__.py was loaded when
the io_blend_utils module was imported. However, this happens only on
demand, and not directly when importing the add-on.

===

M   tests/python/bl_load_py_modules.py

===

diff --git a/tests/python/bl_load_py_modules.py 
b/tests/python/bl_load_py_modules.py
index 5908ba14718..4935491a6be 100644
--- a/tests/python/bl_load_py_modules.py
+++ b/tests/python/bl_load_py_modules.py
@@ -36,6 +36,9 @@ BLACKLIST = {
 "cycles",
 "io_export_dxf",  # TODO, check on why this fails
 'io_import_dxf',  # Because of cydxfentity.so dependency
+
+# The unpacked wheel is only loaded when actually used, not directly on 
import:
+"io_blend_utils/blender_bam-unpacked.whl",
 }
 
 # Some modules need to add to the `sys.path`.

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


[Bf-blender-cvs] [0687d8bdce4] id_copy_refactor: Removed trailing spaces

2017-06-20 Thread Sybren A. Stüvel
Commit: 0687d8bdce4bf38398f48b2922c9ba82f0f270d6
Author: Sybren A. Stüvel
Date:   Mon Jun 19 10:46:07 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB0687d8bdce4bf38398f48b2922c9ba82f0f270d6

Removed trailing spaces

===

M   tests/python/CMakeLists.txt

===

diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index bd8ecbfce69..d4326d48d6d 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -468,9 +468,9 @@ if(WITH_ALEMBIC)
--testdir "${TEST_SRC_DIR}/alembic"
--alembic-root "${ALEMBIC_ROOT_DIR}"
)
-   add_test(NAME script_alembic_import 
-   COMMAND 
-   "$" ${TEST_BLENDER_EXE_PARAMS} 
+   add_test(NAME script_alembic_import
+   COMMAND
+   "$" ${TEST_BLENDER_EXE_PARAMS}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
--
--testdir "${TEST_SRC_DIR}/alembic"

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


[Bf-blender-cvs] [b72ba5c78d1] id_copy_refactor: Use for/else instead of setting 'ok' variable.

2017-06-20 Thread Sybren A. Stüvel
Commit: b72ba5c78d12b3c31205de2cb3e5dd0f9cca8168
Author: Sybren A. Stüvel
Date:   Mon Jun 19 15:25:58 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rBb72ba5c78d12b3c31205de2cb3e5dd0f9cca8168

Use for/else instead of setting 'ok' variable.

This is more efficient, and this use case is exactly what the else clause
is for.

===

M   tests/python/bl_load_py_modules.py

===

diff --git a/tests/python/bl_load_py_modules.py 
b/tests/python/bl_load_py_modules.py
index c13679d16f0..5908ba14718 100644
--- a/tests/python/bl_load_py_modules.py
+++ b/tests/python/bl_load_py_modules.py
@@ -211,11 +211,10 @@ def load_modules():
  [(os.sep + f + ".py")  for f in BLACKLIST])
 
 for f in source_files:
-ok = False
 for ignore in ignore_paths:
 if ignore in f:
-ok = True
-if not ok:
+break
+else:
 raise Exception("Source file %r not loaded in test" % f)
 
 print("loaded %d modules" % len(loaded_files))

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


[Bf-blender-cvs] [5f6725337aa] id_copy_refactor: Fix T51840: UI redraw in node editor header missing on pointcache bake

2017-06-20 Thread Thomas Beck
Commit: 5f6725337aa184add9f6b27e0b0f8840e5dd5f50
Author: Thomas Beck
Date:   Sun Jun 18 16:26:09 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB5f6725337aa184add9f6b27e0b0f8840e5dd5f50

Fix T51840: UI redraw in node editor header missing on pointcache bake

Missing a notifier handler in the node editor

===

M   source/blender/editors/space_node/space_node.c

===

diff --git a/source/blender/editors/space_node/space_node.c 
b/source/blender/editors/space_node/space_node.c
index bbdf6feef01..2267316d257 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -753,6 +753,10 @@ static void node_region_listener(bScreen *UNUSED(sc), 
ScrArea *UNUSED(sa), ARegi
break;
}
break;
+   case NC_WM:
+   if (wmn->data == ND_JOB)
+   ED_region_tag_redraw(ar);
+   break;
case NC_SCENE:
case NC_MATERIAL:
case NC_TEXTURE:

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


[Bf-blender-cvs] [749a8daf26f] id_copy_refactor: Fix compiler warnings from own recent rB0d5c7e5e36b9.

2017-06-20 Thread Bastien Montagne
Commit: 749a8daf26f2eaae72f2620308e28541c871e832
Author: Bastien Montagne
Date:   Mon Jun 19 14:43:44 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB749a8daf26f2eaae72f2620308e28541c871e832

Fix compiler warnings from own recent rB0d5c7e5e36b9.

===

M   source/blender/modifiers/intern/MOD_dynamicpaint.c

===

diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c 
b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index d54e052e438..83a42504180 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -62,11 +62,11 @@ static void copyData(ModifierData *md, ModifierData *target)
 
if (tpmd->canvas) {
for (DynamicPaintSurface *surface = 
tpmd->canvas->surfaces.first; surface; surface = surface->next) {
-   id_us_plus(surface->init_texture);
+   id_us_plus((ID *)surface->init_texture);
}
}
if (tpmd->brush) {
-   id_us_plus(tpmd->brush->mat);
+   id_us_plus((ID *)tpmd->brush->mat);
}
 }

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


[Bf-blender-cvs] [77046ba9d85] id_copy_refactor: Fix (unreported) Dynamic Paint modifier not increasing ID usercount in copy function.

2017-06-20 Thread Bastien Montagne
Commit: 77046ba9d85ad3834fc7b82a60c820b0afcc59f6
Author: Bastien Montagne
Date:   Mon Jun 19 12:25:41 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB77046ba9d85ad3834fc7b82a60c820b0afcc59f6

Fix (unreported) Dynamic Paint modifier not increasing ID usercount in copy 
function.

*Sigh* One more example of why we should keep ID management handling in
as few places as possible! It's impossible to keep more than a few
places in sync regarding which ID pointer is refcounted etc.

===

M   source/blender/modifiers/intern/MOD_dynamicpaint.c

===

diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c 
b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index bb75d655802..d54e052e438 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -36,6 +36,7 @@
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_dynamicpaint.h"
+#include "BKE_library.h"
 #include "BKE_library_query.h"
 #include "BKE_modifier.h"
 
@@ -58,6 +59,15 @@ static void copyData(ModifierData *md, ModifierData *target)
DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target;

dynamicPaint_Modifier_copy(pmd, tpmd);
+
+   if (tpmd->canvas) {
+   for (DynamicPaintSurface *surface = 
tpmd->canvas->surfaces.first; surface; surface = surface->next) {
+   id_us_plus(surface->init_texture);
+   }
+   }
+   if (tpmd->brush) {
+   id_us_plus(tpmd->brush->mat);
+   }
 }
 
 static void freeData(ModifierData *md)

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


[Bf-blender-cvs] [44b1680fbf2] id_copy_refactor: WIP

2017-06-20 Thread Bastien Montagne
Commit: 44b1680fbf2f8bd34d45fb69527e59118197800f
Author: Bastien Montagne
Date:   Mon Jun 19 12:16:46 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB44b1680fbf2f8bd34d45fb69527e59118197800f

WIP

===

M   source/blender/blenkernel/intern/modifier.c
M   source/blender/modifiers/intern/MOD_armature.c
M   source/blender/modifiers/intern/MOD_bevel.c
M   source/blender/modifiers/intern/MOD_displace.c

===

diff --git a/source/blender/blenkernel/intern/modifier.c 
b/source/blender/blenkernel/intern/modifier.c
index 2276d56b9c6..1dc11e870d4 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -59,6 +59,8 @@
 
 #include "BKE_appdir.h"
 #include "BKE_key.h"
+#include "BKE_library.h"
+#include "BKE_library_query.h"
 #include "BKE_multires.h"
 #include "BKE_DerivedMesh.h"
 
@@ -269,14 +271,37 @@ void modifier_copyData_generic(const ModifierData 
*md_src, ModifierData *md_dst)
memcpy(md_dst_data, md_src_data, (size_t)mti->structSize - data_size);
 }
 
-void modifier_copyData(ModifierData *md, ModifierData *target)
+static void modifier_copy_data_id_us_cb(void *UNUSED(userData), Object 
*UNUSED(ob), ID **idpoin, int cb_flag)
+{
+   ID *id = *idpoin;
+   if (id != NULL && (cb_flag & IDWALK_CB_USER) != 0) {
+   id_us_plus(id);
+   }
+}
+
+void modifier_copyData_ex(ModifierData *md, ModifierData *target, const int 
flag)
 {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
target->mode = md->mode;
 
-   if (mti->copyData)
+   if (mti->copyData) {
mti->copyData(md, target);
+   }
+
+   if ((flag & LIB_ID_COPY_NO_USER_REFCOUNT) == 0) {
+   if (mti->foreachIDLink) {
+   mti->foreachIDLink(target, NULL, 
modifier_copy_data_id_us_cb, NULL);
+   }
+   else if (mti->foreachObjectLink) {
+   mti->foreachObjectLink(target, NULL, (ObjectWalkFunc 
*)modifier_copy_data_id_us_cb, NULL);
+   }
+   }
+}
+
+void modifier_copyData(ModifierData *md, ModifierData *target)
+{
+   modifier_copyData_ex(md, target, 0);
 }
 
 
diff --git a/source/blender/modifiers/intern/MOD_armature.c 
b/source/blender/modifiers/intern/MOD_armature.c
index 2400dbcb898..f2f76f13883 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -64,13 +64,13 @@ static void initData(ModifierData *md)
 
 static void copyData(ModifierData *md, ModifierData *target)
 {
+#if 0
ArmatureModifierData *amd = (ArmatureModifierData *) md;
+#endif
ArmatureModifierData *tamd = (ArmatureModifierData *) target;
 
-   tamd->object = amd->object;
-   tamd->deformflag = amd->deformflag;
-   tamd->multi = amd->multi;
-   BLI_strncpy(tamd->defgrp_name, amd->defgrp_name, 
sizeof(tamd->defgrp_name));
+   modifier_copyData_generic(md, target);
+   tamd->prevCos = NULL;
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData 
*UNUSED(md))
diff --git a/source/blender/modifiers/intern/MOD_bevel.c 
b/source/blender/modifiers/intern/MOD_bevel.c
index 5874029ae08..93dc0203f83 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -65,19 +65,11 @@ static void initData(ModifierData *md)
 
 static void copyData(ModifierData *md, ModifierData *target)
 {
+#if 0
BevelModifierData *bmd = (BevelModifierData *) md;
BevelModifierData *tbmd = (BevelModifierData *) target;
-
-   tbmd->value = bmd->value;
-   tbmd->res = bmd->res;
-   tbmd->flags = bmd->flags;
-   tbmd->val_flags = bmd->val_flags;
-   tbmd->lim_flags = bmd->lim_flags;
-   tbmd->e_flags = bmd->e_flags;
-   tbmd->mat = bmd->mat;
-   tbmd->profile = bmd->profile;
-   tbmd->bevel_angle = bmd->bevel_angle;
-   BLI_strncpy(tbmd->defgrp_name, bmd->defgrp_name, 
sizeof(tbmd->defgrp_name));
+#endif
+   modifier_copyData_generic(md, target);
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_displace.c 
b/source/blender/modifiers/intern/MOD_displace.c
index 3325f05025f..fb8c0dd05a5 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -75,14 +75,10 @@ static void copyData(ModifierData *md, ModifierData *target)
 {
 #if 0
DisplaceModifierData *dmd = (DisplaceModifierData *) md;
-#endif
DisplaceModifierData *tdmd = (DisplaceModifierData *) target;
+#endif
 
modifier_copyData_generic(md, target);
-
-   if (tdmd->texture) {
-   id_us_plus(&tdmd->texture->id);
-   }
 }
 
 static void freeData(ModifierData *md)

_

[Bf-blender-cvs] [258634b43c6] id_copy_refactor: Fix (unreported) missing Image usercount increase when copying UVProject modifier.

2017-06-20 Thread Bastien Montagne
Commit: 258634b43c6dae7c76d415d3882840352589c4f8
Author: Bastien Montagne
Date:   Mon Jun 19 15:05:08 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB258634b43c6dae7c76d415d3882840352589c4f8

Fix (unreported) missing Image usercount increase when copying UVProject 
modifier.

===

M   source/blender/modifiers/intern/MOD_uvproject.c

===

diff --git a/source/blender/modifiers/intern/MOD_uvproject.c 
b/source/blender/modifiers/intern/MOD_uvproject.c
index 78dc1ea8bcb..01468c1143a 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -45,6 +45,7 @@
 
 
 #include "BKE_camera.h"
+#include "BKE_library.h"
 #include "BKE_library_query.h"
 #include "BKE_mesh.h"
 #include "BKE_DerivedMesh.h"
@@ -70,9 +71,12 @@ static void copyData(ModifierData *md, ModifierData *target)
 {
 #if 0
UVProjectModifierData *umd = (UVProjectModifierData *) md;
-   UVProjectModifierData *tumd = (UVProjectModifierData *) target;
 #endif
+   UVProjectModifierData *tumd = (UVProjectModifierData *) target;
+
modifier_copyData_generic(md, target);
+
+   id_us_plus((ID *)tumd->image);
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData 
*UNUSED(md))

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


[Bf-blender-cvs] [20e3434c5f1] id_copy_refactor: Fix (unreported) bad copying code in Mesh Deform modifier.

2017-06-20 Thread Bastien Montagne
Commit: 20e3434c5f14769f485dbee40fd4c84ddec19e6b
Author: Bastien Montagne
Date:   Mon Jun 19 12:55:11 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB20e3434c5f14769f485dbee40fd4c84ddec19e6b

Fix (unreported) bad copying code in Mesh Deform modifier.

===

M   source/blender/modifiers/intern/MOD_meshdeform.c

===

diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c 
b/source/blender/modifiers/intern/MOD_meshdeform.c
index 406ce398ee0..b1938395a7b 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -83,7 +83,7 @@ static void copyData(ModifierData *md, ModifierData *target)
MeshDeformModifierData *mmd = (MeshDeformModifierData *) md;
MeshDeformModifierData *tmmd = (MeshDeformModifierData *) target;
 
-   *tmmd = *mmd;
+   modifier_copyData_generic(md, target);
 
if (mmd->bindinfluences) tmmd->bindinfluences = 
MEM_dupallocN(mmd->bindinfluences);
if (mmd->bindoffsets) tmmd->bindoffsets = 
MEM_dupallocN(mmd->bindoffsets);
@@ -91,8 +91,8 @@ static void copyData(ModifierData *md, ModifierData *target)
if (mmd->dyngrid) tmmd->dyngrid = MEM_dupallocN(mmd->dyngrid);
if (mmd->dyninfluences) tmmd->dyninfluences = 
MEM_dupallocN(mmd->dyninfluences);
if (mmd->dynverts) tmmd->dynverts = MEM_dupallocN(mmd->dynverts);
-   if (mmd->bindweights) tmmd->dynverts = MEM_dupallocN(mmd->bindweights); 
 /* deprecated */
-   if (mmd->bindcos) tmmd->dynverts = MEM_dupallocN(mmd->bindcos);  /* 
deprecated */
+   if (mmd->bindweights) tmmd->bindweights = 
MEM_dupallocN(mmd->bindweights);  /* deprecated */
+   if (mmd->bindcos) tmmd->bindcos = MEM_dupallocN(mmd->bindcos);  /* 
deprecated */
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)

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


[Bf-blender-cvs] [2d3b6b5ad7c] id_copy_refactor: Fix (unreported) bad copying of Ocean modifier.

2017-06-20 Thread Bastien Montagne
Commit: 2d3b6b5ad7cdd8a8ecf5f32f21f99bd0ca3fcf0d
Author: Bastien Montagne
Date:   Mon Jun 19 14:40:08 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB2d3b6b5ad7cdd8a8ecf5f32f21f99bd0ca3fcf0d

Fix (unreported) bad copying of Ocean modifier.

Was needlessly complicated code, forgot to copy a value (foam_fade), and
was utterly leaking memory!

===

M   source/blender/modifiers/intern/MOD_ocean.c

===

diff --git a/source/blender/modifiers/intern/MOD_ocean.c 
b/source/blender/modifiers/intern/MOD_ocean.c
index e77cc655c16..2c0bfc86e7d 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -160,40 +160,19 @@ static void freeData(ModifierData *md)
 static void copyData(ModifierData *md, ModifierData *target)
 {
 #ifdef WITH_OCEANSIM
+#if 0
OceanModifierData *omd = (OceanModifierData *) md;
+#endif
OceanModifierData *tomd = (OceanModifierData *) target;
 
-   tomd->geometry_mode = omd->geometry_mode;
-   tomd->resolution = omd->resolution;
-   tomd->spatial_size = omd->spatial_size;
-
-   tomd->wind_velocity = omd->wind_velocity;
-
-   tomd->damp = omd->damp;
-   tomd->smallest_wave = omd->smallest_wave;
-   tomd->depth = omd->depth;
+   freeData(target);
 
-   tomd->wave_alignment = omd->wave_alignment;
-   tomd->wave_direction = omd->wave_direction;
-   tomd->wave_scale = omd->wave_scale;
-
-   tomd->chop_amount = omd->chop_amount;
-   tomd->foam_coverage = omd->foam_coverage;
-   tomd->time = omd->time;
-
-   tomd->seed = omd->seed;
-   tomd->flag = omd->flag;
+   modifier_copyData_generic(md, target);
 
tomd->refresh = 0;
 
-   tomd->size = omd->size;
-   tomd->repeat_x = omd->repeat_x;
-   tomd->repeat_y = omd->repeat_y;
-
/* XXX todo: copy cache runtime too */
tomd->cached = 0;
-   tomd->bakestart = omd->bakestart;
-   tomd->bakeend = omd->bakeend;
tomd->oceancache = NULL;
 
tomd->ocean = BKE_ocean_add();

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


[Bf-blender-cvs] [46af186d21d] id_copy_refactor: Cleanup: doxygen comments

2017-06-20 Thread Campbell Barton
Commit: 46af186d21d7dc97fd9aae6874bfc1ff9424a9c6
Author: Campbell Barton
Date:   Mon Jun 19 09:33:23 2017 +1000
Branches: id_copy_refactor
https://developer.blender.org/rB46af186d21d7dc97fd9aae6874bfc1ff9424a9c6

Cleanup: doxygen comments

Also remove duplicate & mismatching comments from grease-pencil header.
Keep comments close to implementation to avoid getting out of sync.

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/intern/GHOST_WindowCocoa.h
M   intern/memutil/MEM_CacheLimiterC-Api.h
M   source/blender/alembic/intern/abc_exporter.cc
M   source/blender/alembic/intern/abc_util.h
M   source/blender/blenkernel/intern/bvhutils.c
M   source/blender/blenkernel/intern/mesh_evaluate.c
M   source/blender/blenlib/intern/BLI_ghash.c
M   source/blender/blenlib/intern/math_geom.c
M   source/blender/blenlib/intern/math_matrix.c
M   source/blender/blenlib/intern/string_utf8.c
M   source/blender/editors/armature/armature_naming.c
M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/space_image/image_ops.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/editors/transform/transform_snap_object.c
M   source/blender/freestyle/intern/geometry/matrix_util.h
M   source/blender/imbuf/IMB_imbuf_types.h
M   source/blender/python/intern/bpy_rna.c
M   source/blender/render/intern/source/zbuf.c
M   source/gameengine/GamePlayer/common/GPC_MouseDevice.h

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 6887063eae9..967d3f58143 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -43,7 +43,7 @@ extern "C" {
  * Creates a "handle" for a C++ GHOST object.
  * A handle is just an opaque pointer to an empty struct.
  * In the API the pointer is casted to the actual C++ class.
- * \param name Name of the handle to create.
+ * The 'name' argument to the macro is the name of the handle to create.
  */
 
 GHOST_DECLARE_HANDLE(GHOST_SystemHandle);
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h 
b/intern/ghost/intern/GHOST_WindowCocoa.h
index b234291396b..5168c48ca2f 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -56,7 +56,7 @@ public:
 * \param systemCocoa   The associated system class to forward 
events to
 * \param title The text shown in the title bar 
of the window.
 * \param left  The coordinate of the left edge 
of the window.
-* \param top   The coordinate of the top edge 
of the window.
+* \param bottomThe coordinate of the bottom 
edge of the window.
 * \param width The width the window.
 * \param heightThe height the window.
 * \param state The state the window is 
initially opened with.
diff --git a/intern/memutil/MEM_CacheLimiterC-Api.h 
b/intern/memutil/MEM_CacheLimiterC-Api.h
index 0fe5469a4d4..b5680890eb8 100644
--- a/intern/memutil/MEM_CacheLimiterC-Api.h
+++ b/intern/memutil/MEM_CacheLimiterC-Api.h
@@ -61,8 +61,8 @@ bool MEM_CacheLimiter_is_disabled(void);
  * Create new MEM_CacheLimiter object
  * managed objects are destructed with the data_destructor
  *
- * @param data_destructor
- * @return A new MEM_CacheLimter object
+ * \param data_destructor
+ * \return A new MEM_CacheLimter object
  */
 
 MEM_CacheLimiterC *new_MEM_CacheLimiter(MEM_CacheLimiter_Destruct_Func 
data_destructor,
@@ -73,7 +73,7 @@ MEM_CacheLimiterC 
*new_MEM_CacheLimiter(MEM_CacheLimiter_Destruct_Func data_dest
  *
  * Frees the memory of the CacheLimiter but does not touch managed objects!
  *
- * @param This "This" pointer
+ * \param This "This" pointer
  */
 
 void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This);
@@ -81,8 +81,8 @@ void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This);
 /**
  * Manage object
  *
- * @param This "This" pointer, data data object to manage
- * @return CacheLimiterHandle to ref, unref, touch the managed object
+ * \param This "This" pointer, data data object to manage
+ * \return CacheLimiterHandle to ref, unref, touch the managed object
  */
 
 MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC *This, void 
*data);
@@ -90,7 +90,7 @@ MEM_CacheLimiterHandleC 
*MEM_CacheLimiter_insert(MEM_CacheLimiterC *This, void *
 /**
  * Free objects until memory constraints are satisfied
  *
- * @param This "This" pointer
+ * \param This "This" pointer
  */
 
 void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC *This);
@@ -99,7 +99,7 @@ void MEM_CacheLimiter_enforce_limits(MEM_CacheLimiterC *This);
  * Unmanage object previously inserted o

[Bf-blender-cvs] [f45300856cf] id_copy_refactor: Add Cone: tip soft-min should be zero

2017-06-20 Thread Campbell Barton
Commit: f45300856cfbdcaf31390643d329e9e4febf71f7
Author: Campbell Barton
Date:   Sun Jun 18 02:07:22 2017 +1000
Branches: id_copy_refactor
https://developer.blender.org/rBf45300856cfbdcaf31390643d329e9e4febf71f7

Add Cone: tip soft-min should be zero

Default value should be included in range.

===

M   source/blender/editors/mesh/editmesh_add.c

===

diff --git a/source/blender/editors/mesh/editmesh_add.c 
b/source/blender/editors/mesh/editmesh_add.c
index 3725590c188..07fedffaf80 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -384,7 +384,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
/* props */
RNA_def_int(ot->srna, "vertices", 32, 3, MESH_ADD_VERTS_MAXI, 
"Vertices", "", 3, 500);
RNA_def_float_distance(ot->srna, "radius1", 1.0f, 0.0, 
OBJECT_ADD_SIZE_MAXF, "Radius 1", "", 0.001, 100.00);
-   RNA_def_float_distance(ot->srna, "radius2", 0.0f, 0.0, 
OBJECT_ADD_SIZE_MAXF, "Radius 2", "", 0.001, 100.00);
+   RNA_def_float_distance(ot->srna, "radius2", 0.0f, 0.0, 
OBJECT_ADD_SIZE_MAXF, "Radius 2", "", 0.0, 100.00);
RNA_def_float_distance(ot->srna, "depth", 2.0f, 0.0, 
OBJECT_ADD_SIZE_MAXF, "Depth", "", 0.001, 100.00);
RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Base Fill 
Type", "");

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


[Bf-blender-cvs] [147735587c2] id_copy_refactor: Fix (unreported) memory leak in Fluid modifier copying.

2017-06-20 Thread Bastien Montagne
Commit: 147735587c27f96b08b762a91f9989c805c97f02
Author: Bastien Montagne
Date:   Mon Jun 19 12:21:14 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB147735587c27f96b08b762a91f9989c805c97f02

Fix (unreported) memory leak in Fluid modifier copying.

Also generally simplify/sanitize this copy code.

===

M   source/blender/modifiers/intern/MOD_fluidsim.c
M   source/blender/modifiers/intern/MOD_fluidsim_util.c

===

diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c 
b/source/blender/modifiers/intern/MOD_fluidsim.c
index c202c5e1cb4..1964e940cb2 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -68,12 +68,13 @@ static void copyData(ModifierData *md, ModifierData *target)
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target;

-   if (tfluidmd->fss)
-   MEM_freeN(tfluidmd->fss);
-   
-   tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
-   if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) {
-   tfluidmd->fss->meshVelocities = 
MEM_dupallocN(tfluidmd->fss->meshVelocities);
+   fluidsim_free(tfluidmd);
+
+   if (fluidmd->fss) {
+   tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
+   if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) {
+   tfluidmd->fss->meshVelocities = 
MEM_dupallocN(tfluidmd->fss->meshVelocities);
+   }
}
 }
 
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c 
b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 2ecf06057db..3684e947fe0 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -150,9 +150,8 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
if (fluidmd && fluidmd->fss) {
if (fluidmd->fss->meshVelocities) {
MEM_freeN(fluidmd->fss->meshVelocities);
-   fluidmd->fss->meshVelocities = NULL;
}
-   MEM_freeN(fluidmd->fss);
+   MEM_SAFE_FREE(fluidmd->fss);
}

return;

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


[Bf-blender-cvs] [d8de7724109] id_copy_refactor: Docs: Fix file:line links in generated API docs

2017-06-20 Thread Campbell Barton
Commit: d8de7724109877ba506340326d72ec0c019443dc
Author: Campbell Barton
Date:   Sun Jun 18 02:33:13 2017 +1000
Branches: id_copy_refactor
https://developer.blender.org/rBd8de7724109877ba506340326d72ec0c019443dc

Docs: Fix file:line links in generated API docs

===

M   doc/python_api/sphinx_doc_gen.py

===

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index c8bf0243d2c..3b0e8f52c83 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1613,10 +1613,8 @@ def pyrna2sphinx(basepath):
 else:
 url_base = API_BASEURL
 
-fw("   :file: `%s <%s/%s>`_:%d\n\n" % (location[0],
-   url_base,
-   location[0],
-   location[1]))
+fw("   :file: `%s\\:%d <%s/%s$%d>`_\n\n" %
+   (location[0], location[1], url_base, location[0], 
location[1]))
 
 file.close()

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


[Bf-blender-cvs] [780310578a0] id_copy_refactor: Fix unreported: Copy-pasting nodes crashes when they have an undefined type

2017-06-20 Thread Lukas Stockner
Commit: 780310578a0c39fa9badde0010f1e1ee8a8a9194
Author: Lukas Stockner
Date:   Sun Jun 18 05:13:32 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB780310578a0c39fa9badde0010f1e1ee8a8a9194

Fix unreported: Copy-pasting nodes crashes when they have an undefined type

===

M   source/blender/editors/space_node/node_edit.c

===

diff --git a/source/blender/editors/space_node/node_edit.c 
b/source/blender/editors/space_node/node_edit.c
index 9dc39b1839b..5f8f839025f 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2086,7 +2086,7 @@ static int node_clipboard_paste_exec(bContext *C, 
wmOperator *op)
/* make sure all clipboard nodes would be valid in the target tree */
all_nodes_valid = true;
for (node = clipboard_nodes_lb->first; node; node = node->next) {
-   if (!node->typeinfo->poll_instance(node, ntree)) {
+   if (!node->typeinfo->poll_instance || 
!node->typeinfo->poll_instance(node, ntree)) {
all_nodes_valid = false;
BKE_reportf(op->reports, RPT_ERROR, "Cannot add node %s 
into node tree %s", node->name, ntree->id.name + 2);
}

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


[Bf-blender-cvs] [6493328e372] id_copy_refactor: Guarded allocator: Fix type in macro definition

2017-06-20 Thread Sergey Sharybin
Commit: 6493328e3722a473021a80438265a0bad2a1e554
Author: Sergey Sharybin
Date:   Sat Jun 17 16:13:30 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB6493328e3722a473021a80438265a0bad2a1e554

Guarded allocator: Fix type in macro definition

The crash did not happen yet because we always had proper vmemh defined in
the parent scope.

Patch by Ivan Ivanov (aka obiwanus), thanks!

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

===

M   intern/guardedalloc/intern/mallocn_lockfree_impl.c

===

diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c 
b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
index ce8a5b29ece..b4838cdca18 100644
--- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c
+++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -64,9 +64,9 @@ enum {
MEMHEAD_ALIGN_FLAG = 2,
 };
 
-#define MEMHEAD_FROM_PTR(ptr) (((MemHead*) vmemh) - 1)
+#define MEMHEAD_FROM_PTR(ptr) (((MemHead*) ptr) - 1)
 #define PTR_FROM_MEMHEAD(memhead) (memhead + 1)
-#define MEMHEAD_ALIGNED_FROM_PTR(ptr) (((MemHeadAligned*) vmemh) - 1)
+#define MEMHEAD_ALIGNED_FROM_PTR(ptr) (((MemHeadAligned*) ptr) - 1)
 #define MEMHEAD_IS_MMAP(memhead) ((memhead)->len & (size_t) MEMHEAD_MMAP_FLAG)
 #define MEMHEAD_IS_ALIGNED(memhead) ((memhead)->len & (size_t) 
MEMHEAD_ALIGN_FLAG)

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


[Bf-blender-cvs] [e61dbcd2849] id_copy_refactor: Fix T51774: Children particles hair interpolation not correct with textures or dp.

2017-06-20 Thread Bastien Montagne
Commit: e61dbcd28492b6bafd962b56aa179fe7d9e739e5
Author: Bastien Montagne
Date:   Sun Jun 18 23:54:52 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rBe61dbcd28492b6bafd962b56aa179fe7d9e739e5

Fix T51774: Children particles hair interpolation not correct with textures or 
dp.

Children where always getting at least one segment of fixed length...

Now fully hidden ones (zero length) get no segment at all.

Note that even very short ones keep getting one 'unit' length segment - would
rather avoid changing that at this point, given how complex children
particles 'length' can get with all kind of modifiers... Think we can
live with that for now anyway.

===

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

===

diff --git a/source/blender/blenkernel/intern/particle_child.c 
b/source/blender/blenkernel/intern/particle_child.c
index 842de869291..bfcda89a635 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -355,9 +355,13 @@ void psys_apply_child_modifiers(ParticleThreadContext 
*ctx, struct ListBase *mod
 
{
const float step_length = 1.0f / (float)(totkeys - 1);
-   
float cur_length = 0.0f;
-   
+
+   if (max_length <= 0.0f) {
+   keys->segments = -1;
+   totkeys = 0;
+   }
+
/* we have to correct velocity because of kink & clump */
for (k = 0, key = keys; k < totkeys; ++k, ++key) {
if (k >= 2) {

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


[Bf-blender-cvs] [2e9580e4175] id_copy_refactor: PyAPI: Fix warning about indent

2017-06-20 Thread Aaron Carlisle
Commit: 2e9580e4175caa395e10fcc43f3aabb764fbea63
Author: Aaron Carlisle
Date:   Fri Jun 16 12:30:18 2017 -0400
Branches: id_copy_refactor
https://developer.blender.org/rB2e9580e4175caa395e10fcc43f3aabb764fbea63

PyAPI: Fix warning about indent

===

M   source/blender/python/intern/bpy_props.c

===

diff --git a/source/blender/python/intern/bpy_props.c 
b/source/blender/python/intern/bpy_props.c
index 2656e612b18..20faa5aa576 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -2862,7 +2862,7 @@ PyDoc_STRVAR(BPy_PointerProperty_doc,
   "name=\"\", "
   "description=\"\", "
   "options={'ANIMATABLE'}, "
-  "update=None,\n"
+  "update=None, "
   "poll=None)\n"
 "\n"
 "   Returns a new pointer property definition.\n"

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


[Bf-blender-cvs] [09e5d1bc849] id_copy_refactor: Usual i18n/UI messages fixes.

2017-06-20 Thread Bastien Montagne
Commit: 09e5d1bc849862f9792ba9a25d4ed0cf90fe91da
Author: Bastien Montagne
Date:   Fri Jun 16 12:50:24 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB09e5d1bc849862f9792ba9a25d4ed0cf90fe91da

Usual i18n/UI messages fixes.

Please do not add useless tooltips! We have enough messages to translate
already...

===

M   release/datafiles/colormanagement/config.ocio
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/makesrna/intern/rna_sequencer.c

===

diff --git a/release/datafiles/colormanagement/config.ocio 
b/release/datafiles/colormanagement/config.ocio
index 5bed23cf210..71223ea828e 100644
--- a/release/datafiles/colormanagement/config.ocio
+++ b/release/datafiles/colormanagement/config.ocio
@@ -304,7 +304,7 @@ colorspaces:
 equalitygroup:
 bitdepth: 32f
 description: |
-  Log based filmic shaper with 16.5 stops of latitude, and 25 stops of 
dynamic range.
+  Log based filmic shaper with 16.5 stops of latitude, and 25 stops of 
dynamic range
 isdata: false
 allocation: lg2
 allocationvars: [-12.473931188, 12.526068812]
diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 174feec0e22..fc6df49cf6c 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -846,7 +846,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot)
/* identifiers */
ot->name = "Insert Blank Frame";
ot->idname = "GPENCIL_OT_blank_frame_add";
-   ot->description = "Inserts a blank frame on the current frame "
+   ot->description = "Insert a blank frame on the current frame "
  "(all subsequently existing frames, if any, are 
shifted right by one frame)";

/* callbacks */
diff --git a/source/blender/makesrna/intern/rna_sequencer.c 
b/source/blender/makesrna/intern/rna_sequencer.c
index 84b62721999..6f8aa32da86 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1126,7 +1126,7 @@ static void rna_def_strip_crop(BlenderRNA *brna)

prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "bottom");
-   RNA_def_property_ui_text(prop, "Bottom", "Number of pixels to crop from 
the buttom");
+   RNA_def_property_ui_text(prop, "Bottom", "Number of pixels to crop from 
the bottom");
RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, 
"rna_SequenceCrop_update");

@@ -2338,7 +2338,7 @@ static void rna_def_text(StructRNA *srna)
 
prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, 
PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shadow_color");
-   RNA_def_property_ui_text(prop, "Shadow Color", "Shadow color");
+   RNA_def_property_ui_text(prop, "Shadow Color", "");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, 
"rna_Sequence_update");
 
prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);

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


[Bf-blender-cvs] [0e78b3b794c] id_copy_refactor: Fix T51810: Add minimal example of usage of translation API for non-official addons.

2017-06-20 Thread Bastien Montagne
Commit: 0e78b3b794cce6ae7d3de84c6dcc455e0867a277
Author: Bastien Montagne
Date:   Fri Jun 16 16:43:46 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB0e78b3b794cce6ae7d3de84c6dcc455e0867a277

Fix T51810: Add minimal example of usage of translation API for non-official 
addons.

===

M   doc/python_api/examples/bpy.app.translations.py

===

diff --git a/doc/python_api/examples/bpy.app.translations.py 
b/doc/python_api/examples/bpy.app.translations.py
index e41623d2885..4256147ef31 100644
--- a/doc/python_api/examples/bpy.app.translations.py
+++ b/doc/python_api/examples/bpy.app.translations.py
@@ -32,3 +32,62 @@ Module References
 -
 
 """
+
+import bpy
+
+# This block can be automatically generated by UI translations addon, which 
also handles conversion with PO format.
+# See also 
https://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender#Translating_non-official_addons
+# It can (should) also be put in a different, specific py file.
+
+# # BEGIN AUTOGENERATED I18N SECTION #
+# NOTE: You can safely move around this auto-generated block (with the 
begin/end markers!),
+#   and edit the translations by hand.
+#   Just carefully respect the format of the tuple!
+
+# Tuple of tuples ((msgctxt, msgid), (sources, gen_comments), (lang, 
translation, (is_fuzzy, comments)), ...)
+translations_tuple = (
+(("*", ""),
+ ((), ()),
+ ("fr_FR", "Project-Id-Version: Copy Settings 0.1.5 
(r0)\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2013-04-18 
15:27:45.563524\nPO-Revision-Date: 2013-04-18 15:38+0100\nLast-Translator: 
Bastien Montagne \nLanguage-Team: LANGUAGE 
\nLanguage: __POT__\nMIME-Version: 1.0\nContent-Type: text/plain; 
charset=UTF-8\nContent-Transfer-Encoding: 8bit\n",
+   (False,
+("Blender's translation file (po format).",
+ "Copyright (C) 2013 The Blender Foundation.",
+ "This file is distributed under the same license as the 
Blender package.",
+ "FIRST AUTHOR , YEAR."))),
+),
+(("Operator", "Render: Copy Settings"),
+ (("bpy.types.SCENE_OT_render_copy_settings",),
+  ()),
+ ("fr_FR", "Rendu : copier réglages",
+   (False, ())),
+),
+(("*", "Copy render settings from current scene to others"),
+ (("bpy.types.SCENE_OT_render_copy_settings",),
+  ()),
+ ("fr_FR", "Copier les réglages de rendu depuis la scène courante vers 
d’autres",
+   (False, ())),
+),
+# ... etc, all messages from your addon.
+)
+
+translations_dict = {}
+for msg in translations_tuple:
+key = msg[0]
+for lang, trans, (is_fuzzy, comments) in msg[2:]:
+if trans and not is_fuzzy:
+translations_dict.setdefault(lang, {})[key] = trans
+
+# # END AUTOGENERATED I18N SECTION #
+
+# Define remaining addon (operators, UI...) here.
+
+def register():
+   # Usual operator/UI/etc. registration...
+
+bpy.app.translations.register(__name__, translations_dict)
+
+
+def unregister():
+bpy.app.translations.unregister(__name__)
+
+   # Usual operator/UI/etc. unregistration...

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


[Bf-blender-cvs] [5909d32aecc] fracture_modifier: allow a bit "cleaner" cut edges when keep distort is not set, else they keep jaggy

2017-06-20 Thread Martin Felke
Commit: 5909d32aecc1754533d023b293d48757e6a74186
Author: Martin Felke
Date:   Tue Jun 20 16:59:01 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rB5909d32aecc1754533d023b293d48757e6a74186

allow a bit "cleaner" cut edges when keep distort is not set, else they keep 
jaggy

===

M   source/blender/modifiers/intern/MOD_fracture.c

===

diff --git a/source/blender/modifiers/intern/MOD_fracture.c 
b/source/blender/modifiers/intern/MOD_fracture.c
index c65885d1867..0bbc13f6070 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -3358,10 +3358,12 @@ static void prepare_automerge(FractureModifierData 
*fmd, BMesh *bm)
 
for (sv = vg->verts.first; sv; sv = sv->next)
{
-   v2 = bm->vtable[sv->index];
-   add_v3_v3(co, v2->co);
-   add_v3_v3(no, v2->no);
-   verts++;
+   if (!sv->exceeded || fmd->keep_distort) {
+   v2 = bm->vtable[sv->index];
+   add_v3_v3(co, v2->co);
+   add_v3_v3(no, v2->no);
+   verts++;
+   }
}
 
inverse = 1.0f/(float)verts;

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


[Bf-blender-cvs] [c2f4308e6ba] blender2.8: Fix blenderplayer build (tm)

2017-06-20 Thread Dalai Felinto
Commit: c2f4308e6ba21d4bcbed0aa36b6c770967160771
Author: Dalai Felinto
Date:   Tue Jun 20 15:51:42 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBc2f4308e6ba21d4bcbed0aa36b6c770967160771

Fix blenderplayer build (tm)

===

M   source/blenderplayer/bad_level_call_stubs/stubs.c

===

diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c 
b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 255ac28b64e..226b44e882d 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -363,7 +363,6 @@ struct wmManipulatorMapType 
*WM_manipulatormaptype_ensure(const struct wmManipul
 struct wmManipulatorMap *WM_manipulatormap_new_from_type(const struct 
wmManipulatorMapType_Params *wmap_params) RET_NULL
 void WM_manipulatormaptype_group_init_runtime(
 const struct Main *bmain, struct wmManipulatorMapType *mmap_type, 
struct wmManipulatorGroupType *wgt) RET_NONE
-void WM_manipulatorgrouptype_unregister(struct bContext *C, struct Main 
*bmain, struct wmManipulatorGroupType *wgt) RET_NONE
 
 #ifdef WITH_INPUT_NDOF
 void WM_ndof_deadzone_set(float deadzone) RET_NONE

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


[Bf-blender-cvs] [63d71edfcab] blender2.8: Fix collada build after gawain rename/refactor

2017-06-20 Thread Dalai Felinto
Commit: 63d71edfcabbb3a8c58326adad7a51644a0e550a
Author: Dalai Felinto
Date:   Tue Jun 20 15:42:06 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB63d71edfcabbb3a8c58326adad7a51644a0e550a

Fix collada build after gawain rename/refactor

Collada files should not have been touched.

Bug introduced on: c31f24c63b875e8c9a7cacd2733d3e8614eff74d

===

M   source/blender/collada/MeshImporter.cpp

===

diff --git a/source/blender/collada/MeshImporter.cpp 
b/source/blender/collada/MeshImporter.cpp
index 402534a8e4c..9c95d4de695 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -67,7 +67,7 @@ static const std::string bc_get_dae_name(T *node)
return node->getName().size() ? node->getName(): node->getOriginalId();
 }
 
-static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::Gwn_PrimType 
type)
+static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType 
type)
 {
switch (type) {
case COLLADAFW::MeshPrimitive::LINES:
@@ -274,7 +274,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)  // 
checks if mesh has su
for (unsigned i = 0; i < prim_arr.getCount(); i++) {
 
COLLADAFW::MeshPrimitive *mp = prim_arr[i];
-   COLLADAFW::MeshPrimitive::Gwn_PrimType type = 
mp->getPrimitiveType();
+   COLLADAFW::MeshPrimitive::PrimitiveType type = 
mp->getPrimitiveType();
 
const char *type_str = bc_primTypeToStr(type);

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


[Bf-blender-cvs] [e3b1d562a77] master: Fix (unreported) missing Image usercount increase when copying UVProject modifier.

2017-06-20 Thread Bastien Montagne
Commit: e3b1d562a770edf397cb4423579c5d715c67da9c
Author: Bastien Montagne
Date:   Mon Jun 19 15:05:08 2017 +0200
Branches: master
https://developer.blender.org/rBe3b1d562a770edf397cb4423579c5d715c67da9c

Fix (unreported) missing Image usercount increase when copying UVProject 
modifier.

===

M   source/blender/modifiers/intern/MOD_uvproject.c

===

diff --git a/source/blender/modifiers/intern/MOD_uvproject.c 
b/source/blender/modifiers/intern/MOD_uvproject.c
index 78dc1ea8bcb..01468c1143a 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -45,6 +45,7 @@
 
 
 #include "BKE_camera.h"
+#include "BKE_library.h"
 #include "BKE_library_query.h"
 #include "BKE_mesh.h"
 #include "BKE_DerivedMesh.h"
@@ -70,9 +71,12 @@ static void copyData(ModifierData *md, ModifierData *target)
 {
 #if 0
UVProjectModifierData *umd = (UVProjectModifierData *) md;
-   UVProjectModifierData *tumd = (UVProjectModifierData *) target;
 #endif
+   UVProjectModifierData *tumd = (UVProjectModifierData *) target;
+
modifier_copyData_generic(md, target);
+
+   id_us_plus((ID *)tumd->image);
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData 
*UNUSED(md))

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