[Bf-blender-cvs] [e87ddda149b] blender2.8: Better fix for duplicate objects not moving them

2017-05-03 Thread Dalai Felinto
Commit: e87ddda149b49746b33f843d32bfe5df06322336
Author: Dalai Felinto
Date:   Thu May 4 00:21:28 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBe87ddda149b49746b33f843d32bfe5df06322336

Better fix for duplicate objects not moving them

(original fix on 51a977a86f6f)

===

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

===

diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 4f17901d0e2..c2bf9f377d7 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -791,9 +791,6 @@ static void layer_collection_object_add(SceneLayer *sl, 
LayerCollection *lc, Obj
 
if (is_selectable) {
base->flag |= BASE_SELECTABLED;
-   }
-
-   if (ob->base_flag) {
base->flag |= BASE_SELECTED;
}

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


[Bf-blender-cvs] [b1858b4d2f4] blender2.8: Merge remote-tracking branch 'origin/master' into blender2.8

2017-05-03 Thread Dalai Felinto
Commit: b1858b4d2f4b6efeab1aef991aaac5ee45f6f2a7
Author: Dalai Felinto
Date:   Wed May 3 23:55:29 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBb1858b4d2f4b6efeab1aef991aaac5ee45f6f2a7

Merge remote-tracking branch 'origin/master' into blender2.8

===



===



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


[Bf-blender-cvs] [e0f4fbd45ad] workspaces: Merge branch 'blender2.8' into workspaces

2017-05-03 Thread Julian Eisel
Commit: e0f4fbd45ad6e57b315950a04d6a873b1cf3e5b2
Author: Julian Eisel
Date:   Wed May 3 23:49:53 2017 +0200
Branches: workspaces
https://developer.blender.org/rBe0f4fbd45ad6e57b315950a04d6a873b1cf3e5b2

Merge branch 'blender2.8' into workspaces

Conflicts:
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_280.c

===



===

diff --cc source/blender/blenkernel/BKE_layer.h
index a152846b439,a54cce73c7f..b64a28da13d
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@@ -57,8 -57,9 +57,10 @@@ struct Scene
  struct SceneCollection;
  struct SceneLayer;
  
+ void BKE_layer_exit(void);
+ 
  struct SceneLayer *BKE_scene_layer_render_active(const struct Scene *scene);
 +struct SceneLayer *BKE_scene_layer_context_active_ex(const struct Main 
*bmain, const struct Scene *scene);
  struct SceneLayer *BKE_scene_layer_context_active(const struct Scene *scene);
  struct SceneLayer *BKE_scene_layer_add(struct Scene *scene, const char *name);
  
diff --cc source/blender/blenkernel/intern/scene.c
index ace8641eb1f,44e29e5b994..5aa3e87d335
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@@ -1418,9 -1418,15 +1419,15 @@@ static bool check_rendered_viewport_vis
wmWindowManager *wm = bmain->wm.first;
wmWindow *window;
for (window = wm->windows.first; window != NULL; window = window->next) 
{
 -  bScreen *screen = window->screen;
 -  Scene *scene = screen->scene;
 +  const bScreen *screen = 
BKE_workspace_active_screen_get(window->workspace_hook);
- 
-   for (ScrArea *area = screen->areabase.first; area != NULL; area 
= area->next) {
++  Scene *scene = window->scene;
+   ScrArea *area;
+   RenderEngineType *type = RE_engines_find(scene->r.engine);
+   if ((type->draw_engine != NULL) || (type->render_to_view == 
NULL)) {
+   continue;
+   }
+   const bool use_legacy = (type->flag & RE_USE_LEGACY_PIPELINE) 
!= 0;
+   for (area = screen->areabase.first; area != NULL; area = 
area->next) {
View3D *v3d = area->spacedata.first;
if (area->spacetype != SPACE_VIEW3D) {
continue;
diff --cc source/blender/blenloader/intern/readfile.c
index 243e0adeb30,5f533f02bd1..2c2b2c1ba28
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -6412,8 -6313,7 +6430,9 @@@ static void direct_link_scene(FileData 
  
sce->collection_properties = newdataadr(fd, sce->collection_properties);
IDP_DirectLinkGroup_OrFree(>collection_properties, (fd->flags & 
FD_FLAGS_SWITCH_ENDIAN), fd);
+   BKE_layer_collection_engine_settings_validate(sce);
 +
 +  direct_link_scene_update_screen_data(fd, >workspaces, 
>screen);
  }
  
  /*  READ WM * */
diff --cc source/blender/blenloader/intern/versioning_280.c
index 2a65fbd48c3,70c35788527..6a28132f460
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -283,55 -182,36 +283,51 @@@ void do_versions_after_linking_280(Mai
scene->basact = NULL;
}
}
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(main, 280, 0)) {
 +  IDPropertyTemplate val = {0};
 +  for (Scene *scene = main->scene.first; scene; scene = 
scene->id.next) {
 +  scene->collection_properties = IDP_New(IDP_GROUP, , 
ROOT_PROP);
 +  
BKE_layer_collection_engine_settings_create(scene->collection_properties);
 +  }
+ 
+   for (bScreen *screen = main->screen.first; screen; screen = 
screen->id.next) {
+   for (ScrArea *sa = screen->areabase.first; sa; sa = 
sa->next) {
+   for (SpaceLink *sl = sa->spacedata.first; sl; 
sl = sl->next) {
+   if (sl->spacetype == SPACE_OUTLINER) {
+   SpaceOops *soutliner = 
(SpaceOops *)sl;
+   SceneLayer *layer = 
BKE_scene_layer_context_active(screen->scene);
+ 
+   soutliner->outlinevis = 
SO_ACT_LAYER;
+ 
+   if 
(BLI_listbase_count_ex(>layer_collections, 2) == 1) {
+   if 
(soutliner->treestore == NULL) {
+   
soutliner->treestore = BLI_mempool_create(
+  

[Bf-blender-cvs] [ad8587b7980] master: [msvc/make.bat] Limit the amount of simultaneously compiled projects.

2017-05-03 Thread lazydodo
Commit: ad8587b7980c836e6b65955398f2b970401823fb
Author: lazydodo
Date:   Wed May 3 15:15:35 2017 -0600
Branches: master
https://developer.blender.org/rBad8587b7980c836e6b65955398f2b970401823fb

[msvc/make.bat] Limit the amount of simultaneously compiled projects.

This was set to maxcpu which in an 8 core box would be 8, each project would 
then spawn
8 instances of cl.exe, making a possible of 64 simultaneously running compiler 
instances
slowing the compile down instead of speeding it up.

===

M   make.bat

===

diff --git a/make.bat b/make.bat
index f818df5fcc1..988cb5f4c68 100644
--- a/make.bat
+++ b/make.bat
@@ -257,7 +257,7 @@ echo msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:build ^
/property:Configuration=%BUILD_TYPE% ^
-   /maxcpucount ^
+   /maxcpucount:2 ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% ^
/flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log >> 
%BUILD_DIR%\rebuild.cmd
@@ -273,7 +273,7 @@ msbuild ^
%BUILD_DIR%\Blender.sln ^
/target:build ^
/property:Configuration=%BUILD_TYPE% ^
-   /maxcpucount ^
+   /maxcpucount:2 ^
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM% ^
/flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log

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


[Bf-blender-cvs] [c171f0b3c96] master: Fix Cycles build on Windows

2017-05-03 Thread Dalai Felinto
Commit: c171f0b3c96cb2d01fd6b6919f4dbec1a81c8da9
Author: Dalai Felinto
Date:   Wed May 3 21:16:45 2017 +0200
Branches: master
https://developer.blender.org/rBc171f0b3c96cb2d01fd6b6919f4dbec1a81c8da9

Fix Cycles build on Windows

===

M   intern/cycles/util/util_types.h

===

diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index aacf7c1bd8e..feab7996aee 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -94,6 +94,7 @@ CCL_NAMESPACE_BEGIN
 #ifndef __KERNEL_OPENCL__
 typedef unsigned char uchar;
 typedef unsigned int uint;
+typedef unsigned short ushort;
 #endif
 
 /* Fixed Bits Types */

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


[Bf-blender-cvs] [606d1f2b6e3] blender2.8: Fix projection paint initialization failing

2017-05-03 Thread Campbell Barton
Commit: 606d1f2b6e35025fc20205ce6a0cc6bcf4724a22
Author: Campbell Barton
Date:   Thu May 4 05:06:56 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB606d1f2b6e35025fc20205ce6a0cc6bcf4724a22

Fix projection paint initialization failing

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c 
b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 901f24844e4..b667bb59922 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5205,7 +5205,7 @@ void *paint_proj_new_stroke(bContext *C, Object *ob, 
const float mouse[2], int m
 
project_state_init(C, ob, ps, mode);
 
-   if (ps->ob == NULL || !(ps->ob->lay & ps->v3d->lay)) {
+   if (ps->ob == NULL || !(ob->base_flag & BASE_VISIBLED)) {
ps_handle->ps_views_tot = i + 1;
goto fail;
}

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


[Bf-blender-cvs] [51a977a86f6] blender2.8: Select new object bases using object's base flag

2017-05-03 Thread Campbell Barton
Commit: 51a977a86f6f37a403caad6b9f91853baf400a0a
Author: Campbell Barton
Date:   Thu May 4 04:14:58 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB51a977a86f6f37a403caad6b9f91853baf400a0a

Select new object bases using object's base flag

This fixes object duplicate operator.

===

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

===

diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 1a920a155b8..4f17901d0e2 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -793,6 +793,10 @@ static void layer_collection_object_add(SceneLayer *sl, 
LayerCollection *lc, Obj
base->flag |= BASE_SELECTABLED;
}
 
+   if (ob->base_flag) {
+   base->flag |= BASE_SELECTED;
+   }
+
BLI_addtail(>object_bases, BLI_genericNodeN(base));
 }

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


[Bf-blender-cvs] [62189a5ab7d] blender2.8: Fix potential crash introduced by weightpaint engine when no active object

2017-05-03 Thread Dalai Felinto
Commit: 62189a5ab7d9465a33f1d4e7e6d4f30168ffae22
Author: Dalai Felinto
Date:   Wed May 3 20:10:54 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB62189a5ab7d9465a33f1d4e7e6d4f30168ffae22

Fix potential crash introduced by weightpaint engine when no active object

===

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

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index a2c7458d395..3758f3d1278 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2538,7 +2538,12 @@ static void 
rna_LayerCollectionEngineSettings_weight_wire_update(bContext *C, Po
 {
Scene *scene = CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
-   BKE_mesh_batch_cache_dirty(sl->basact->object->data, 
BKE_MESH_BATCH_DIRTY_WEIGHT);
+   Object *ob = OBACT_NEW;
+
+   if (ob != NULL) {
+   BKE_mesh_batch_cache_dirty(ob, BKE_MESH_BATCH_DIRTY_WEIGHT);
+   }
+
/* TODO(sergey): Use proper flag for tagging here. */
DAG_id_tag_update(>id, 0);
 }

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


[Bf-blender-cvs] [628dad4f010] blender2.8: Fix building on Windows and blenderplayer linking after weightpaint engine

2017-05-03 Thread Dalai Felinto
Commit: 628dad4f010b9f18db08aaa0f587c493cb9731c2
Author: Dalai Felinto
Date:   Wed May 3 20:22:48 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB628dad4f010b9f18db08aaa0f587c493cb9731c2

Fix building on Windows and blenderplayer linking after weightpaint engine

Those problems were introduced on 20f95de6ba2d32dcff553251ff4de2efd5b76955.

===

M   source/blender/draw/modes/paint_weight_mode.c
M   source/blenderplayer/bad_level_call_stubs/stubs.c

===

diff --git a/source/blender/draw/modes/paint_weight_mode.c 
b/source/blender/draw/modes/paint_weight_mode.c
index 2819dcbc6c5..971e483ae81 100644
--- a/source/blender/draw/modes/paint_weight_mode.c
+++ b/source/blender/draw/modes/paint_weight_mode.c
@@ -49,20 +49,14 @@ typedef struct PAINT_WEIGHT_PassList {
struct DRWPass *vert_overlay;
 } PAINT_WEIGHT_PassList;
 
-typedef struct PAINT_WEIGHT_FramebufferList {
-} PAINT_WEIGHT_FramebufferList;
-
-typedef struct PAINT_WEIGHT_TextureList {
-} PAINT_WEIGHT_TextureList;
-
 typedef struct PAINT_WEIGHT_StorageList {
struct PAINT_WEIGHT_PrivateData *g_data;
 } PAINT_WEIGHT_StorageList;
 
 typedef struct PAINT_WEIGHT_Data {
void *engine_type;
-   PAINT_WEIGHT_FramebufferList *fbl;
-   PAINT_WEIGHT_TextureList *txl;
+   DRWViewportEmptyList *fbl;
+   DRWViewportEmptyList *txl;
PAINT_WEIGHT_PassList *psl;
PAINT_WEIGHT_StorageList *stl;
 } PAINT_WEIGHT_Data;
@@ -210,7 +204,6 @@ void PAINT_WEIGHT_collection_settings_create(IDProperty 
*properties)
BKE_collection_engine_property_add_bool(properties, "use_wire", false);
 }
 
-
 static const DrawEngineDataSize PAINT_WEIGHT_data_size = 
DRW_VIEWPORT_DATA_SIZE(PAINT_WEIGHT_Data);
 
 DrawEngineType draw_engine_paint_weight_type = {
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c 
b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 0ab0059fd07..5f129be5f9b 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -701,6 +701,7 @@ void RE_engine_register_pass(struct RenderEngine *engine, 
struct Scene *scene, s
 void OBJECT_collection_settings_create(struct IDProperty *properties) RET_NONE
 void EDIT_MESH_collection_settings_create(struct IDProperty *properties) 
RET_NONE
 void EDIT_ARMATURE_collection_settings_create(struct IDProperty *properties) 
RET_NONE
+void PAINT_WEIGHT_collection_settings_create(struct IDProperty *properties) 
RET_NONE
 void DRW_object_engine_data_free(struct Object *ob) RET_NONE
 
 /* python */

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


[Bf-blender-cvs] [8c2b98ffa5c] blender2.8: Cleanup: line length

2017-05-03 Thread Campbell Barton
Commit: 8c2b98ffa5c2b7b846688e5442d299beeea4d90f
Author: Campbell Barton
Date:   Thu May 4 03:35:01 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB8c2b98ffa5c2b7b846688e5442d299beeea4d90f

Cleanup: line length

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 6b54184cd55..b4496aa871b 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -332,8 +332,10 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, 
const int types)
rdata->tangent_ofs = MEM_mallocN(sizeof(*rdata->tangent_ofs) * 
rdata->uv_ct, "rdata->tangent_ofs");
 
/* Allocate max */
-   rdata->auto_vcol = MEM_callocN(sizeof(*rdata->auto_vcol) * 
rdata->vcol_ct, "rdata->auto_vcol");
-   rdata->auto_names = MEM_mallocN(sizeof(*rdata->auto_names) * 
(rdata->vcol_ct + rdata->uv_ct), "rdata->auto_names");
+   rdata->auto_vcol = MEM_callocN(
+   sizeof(*rdata->auto_vcol) * rdata->vcol_ct, 
"rdata->auto_vcol");
+   rdata->auto_names = MEM_mallocN(
+   sizeof(*rdata->auto_names) * (rdata->vcol_ct + 
rdata->uv_ct), "rdata->auto_names");
 
/* XXX FIXME XXX */
/* We use a hash to identify each data layer based on its name.
@@ -385,7 +387,8 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, 
const int types)
 
float (*loopnors)[3] = 
CustomData_get_layer(>ldata, CD_NORMAL);
 
-   rdata->mtangent[i] = 
CustomData_add_layer(>ldata, CD_MLOOPTANGENT, CD_CALLOC, NULL, bm->totloop);
+   rdata->mtangent[i] = 
CustomData_add_layer(
+   >ldata, CD_MLOOPTANGENT, 
CD_CALLOC, NULL, bm->totloop);
CustomData_set_layer_flag(>ldata, 
CD_MLOOPTANGENT, CD_FLAG_TEMPORARY);
 
BKE_mesh_loop_tangents_ex(bm->mvert, 
bm->totvert, bm->mloop, rdata->mtangent[i],
@@ -403,7 +406,8 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, 
const int types)
 
float (*loopnors)[3] = 
CustomData_get_layer(>ldata, CD_NORMAL);
 
-   rdata->mtangent[i] = 
CustomData_add_layer(>ldata, CD_MLOOPTANGENT, CD_CALLOC, NULL, me->totloop);
+   rdata->mtangent[i] = 
CustomData_add_layer(
+   >ldata, CD_MLOOPTANGENT, 
CD_CALLOC, NULL, me->totloop);
CustomData_set_layer_flag(>ldata, 
CD_MLOOPTANGENT, CD_FLAG_TEMPORARY);
 
BKE_mesh_loop_tangents_ex(me->mvert, 
me->totvert, me->mloop, rdata->mtangent[i],
@@ -412,9 +416,12 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, 
const int types)
}
}
 
-   rdata->uv_active = 
CustomData_get_active_layer_index(>ldata, CD_MLOOPUV) - 
CustomData_get_layer_index(>ldata, CD_MLOOPUV);
-   rdata->vcol_active = 
CustomData_get_active_layer_index(>ldata, CD_MLOOPCOL) - 
CustomData_get_layer_index(>ldata, CD_MLOOPCOL);
-   rdata->tangent_active = 
CustomData_get_active_layer_index(>ldata, CD_MLOOPTANGENT) - 
CustomData_get_layer_index(>ldata, CD_MLOOPTANGENT);
+   rdata->uv_active = CustomData_get_active_layer_index(
+   >ldata, CD_MLOOPUV) - 
CustomData_get_layer_index(>ldata, CD_MLOOPUV);
+   rdata->vcol_active = CustomData_get_active_layer_index(
+   >ldata, CD_MLOOPCOL) - 
CustomData_get_layer_index(>ldata, CD_MLOOPCOL);
+   rdata->tangent_active = CustomData_get_active_layer_index(
+   >ldata, CD_MLOOPTANGENT) - 
CustomData_get_layer_index(>ldata, CD_MLOOPTANGENT);
 
rdata->orco = CustomData_get_layer(>vdata, CD_ORCO);
 
@@ -1013,7 +1020,9 @@ static bool mesh_render_data_looptri_cos_weights_get(
 float *(*r_vert_cos)[3], float *(*r_vert_weights)[3],
 short **r_tri_nor, short *(*r_vert_nors)[3], bool *r_is_smooth, int 
index)
 {
-   BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | 
MR_DATATYPE_LOOP | MR_DATATYPE_DVERT  | MR_DATATYPE_POLY));
+   BLI_assert(
+   rdata->types &
+   (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | 
MR_DATATYPE_POLY | MR_DATATYPE_DVERT));
 
if (rdata->edit_bmesh) {
const BMLoop **bm_looptri = (const BMLoop 
**)rdata->edit_bmesh->looptris[tri_idx];
@@ -1872,9 +1881,12 @@ 

[Bf-blender-cvs] [d96171ab53b] blender2.8: Correct struct type (harmless)

2017-05-03 Thread Campbell Barton
Commit: d96171ab53b14e75aa075eece661eb9919b8fb02
Author: Campbell Barton
Date:   Thu May 4 03:14:08 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBd96171ab53b14e75aa075eece661eb9919b8fb02

Correct struct type (harmless)

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 5a5d0260699..6b54184cd55 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -121,7 +121,7 @@ typedef struct MeshRenderData {
MPoly *mpoly;
float (*orco)[3];
MLoopUV **mloopuv;
-   MCol **mcol;
+   MLoopCol **mloopcol;
float (**mtangent)[4];
MDeformVert *dvert;
 
@@ -320,7 +320,7 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, 
const int types)
rdata->vcol_ct = CustomData_number_of_layers(>ldata, 
CD_MLOOPCOL);
 
rdata->mloopuv = MEM_mallocN(sizeof(*rdata->mloopuv) * 
rdata->uv_ct, "rdata->mloopuv");
-   rdata->mcol = MEM_mallocN(sizeof(*rdata->mcol) * 
rdata->vcol_ct, "rdata->mcol");
+   rdata->mloopcol = MEM_mallocN(sizeof(*rdata->mloopcol) * 
rdata->vcol_ct, "rdata->mloopcol");
rdata->mtangent = MEM_mallocN(sizeof(*rdata->mtangent) * 
rdata->uv_ct, "rdata->mtangent");
 
rdata->uv_names = MEM_mallocN(sizeof(*rdata->uv_names) * 
rdata->uv_ct, "rdata->uv_names");
@@ -346,7 +346,7 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, 
const int types)
const char *name = 
CustomData_get_layer_name(>ldata, CD_MLOOPCOL, i);
unsigned int hash = BLI_ghashutil_strhash_p(name);
BLI_snprintf(rdata->vcol_names[i], 
sizeof(*rdata->vcol_names), "c%u", hash);
-   rdata->mcol[i] = CustomData_get_layer_n(>ldata, 
CD_MLOOPCOL, i);
+   rdata->mloopcol[i] = CustomData_get_layer_n(>ldata, 
CD_MLOOPCOL, i);
if (rdata->edit_bmesh) {
rdata->vcol_ofs[i] = 
CustomData_get_n_offset(>edit_bmesh->bm->ldata, CD_MLOOPCOL, i);
}
@@ -453,7 +453,7 @@ static void mesh_render_data_free(MeshRenderData *rdata)
MEM_SAFE_FREE(rdata->tangent_ofs);
MEM_SAFE_FREE(rdata->orco);
MEM_SAFE_FREE(rdata->mloopuv);
-   MEM_SAFE_FREE(rdata->mcol);
+   MEM_SAFE_FREE(rdata->mloopcol);
MEM_SAFE_FREE(rdata->mtangent);
MEM_SAFE_FREE(rdata->loose_verts);
MEM_SAFE_FREE(rdata->loose_edges);
@@ -837,15 +837,15 @@ static void mesh_render_data_looptri_cols_get(
 {
if (rdata->edit_bmesh) {
const BMLoop **bm_looptri = (const BMLoop 
**)rdata->edit_bmesh->looptris[tri_idx];
-   (*r_vert_cols)[0] = &((MCol 
*)BM_ELEM_CD_GET_VOID_P(bm_looptri[0], rdata->vcol_ofs[vcol_layer]))->a;
-   (*r_vert_cols)[1] = &((MCol 
*)BM_ELEM_CD_GET_VOID_P(bm_looptri[1], rdata->vcol_ofs[vcol_layer]))->a;
-   (*r_vert_cols)[2] = &((MCol 
*)BM_ELEM_CD_GET_VOID_P(bm_looptri[2], rdata->vcol_ofs[vcol_layer]))->a;
+   (*r_vert_cols)[0] = &((MLoopCol 
*)BM_ELEM_CD_GET_VOID_P(bm_looptri[0], rdata->vcol_ofs[vcol_layer]))->r;
+   (*r_vert_cols)[1] = &((MLoopCol 
*)BM_ELEM_CD_GET_VOID_P(bm_looptri[1], rdata->vcol_ofs[vcol_layer]))->r;
+   (*r_vert_cols)[2] = &((MLoopCol 
*)BM_ELEM_CD_GET_VOID_P(bm_looptri[2], rdata->vcol_ofs[vcol_layer]))->r;
}
else {
const MLoopTri *mlt = >mlooptri[tri_idx];
-   (*r_vert_cols)[0] = >mcol[vcol_layer][mlt->tri[0]].a;
-   (*r_vert_cols)[1] = >mcol[vcol_layer][mlt->tri[1]].a;
-   (*r_vert_cols)[2] = >mcol[vcol_layer][mlt->tri[2]].a;
+   (*r_vert_cols)[0] = >mloopcol[vcol_layer][mlt->tri[0]].r;
+   (*r_vert_cols)[1] = >mloopcol[vcol_layer][mlt->tri[1]].r;
+   (*r_vert_cols)[2] = >mloopcol[vcol_layer][mlt->tri[2]].r;
}
 }
 
@@ -1053,7 +1053,7 @@ static bool mesh_render_data_looptri_cos_weights_get(
BMesh *bm = rdata->edit_bmesh->bm;
 
if (CustomData_has_layer(>vdata, CD_MDEFORMVERT)) {
-   BMIter viter;
+   BMIter viter;
BMVert *vert;
int i;

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


[Bf-blender-cvs] [20f95de6ba2] blender2.8: Weight painting with draw manager

2017-05-03 Thread Luca Rood
Commit: 20f95de6ba2d32dcff553251ff4de2efd5b76955
Author: Luca Rood
Date:   Wed May 3 18:55:40 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB20f95de6ba2d32dcff553251ff4de2efd5b76955

Weight painting with draw manager

This implements weight rendering with the draw manager, with all drawing
options (Shading, wire, face masking, vertex masking).

This is part of T51208

Reviewers: campbellbarton

Subscribers: dfelinto

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

===

M   release/scripts/startup/bl_ui/properties_collection.py
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/deform.c
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/object_deform.c
M   source/blender/draw/DRW_engine.h
M   source/blender/draw/intern/draw_cache.c
M   source/blender/draw/intern/draw_cache.h
M   source/blender/draw/intern/draw_cache_impl.h
M   source/blender/draw/intern/draw_cache_impl_mesh.c
M   source/blender/draw/modes/object_mode.c
M   source/blender/draw/modes/paint_weight_mode.c
M   source/blender/editors/mesh/editface.c
M   source/blender/editors/sculpt_paint/paint_stroke.c
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader.c
A   
source/blender/gpu/shaders/gpu_shader_simple_lighting_smooth_color_alpha_frag.glsl
M   source/blender/makesdna/DNA_ID.h
M   source/blender/makesdna/DNA_layer_types.h
M   source/blender/makesrna/intern/rna_mesh.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_collection.py 
b/release/scripts/startup/bl_ui/properties_collection.py
index c1e2b00966c..0cd0194ff33 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -112,11 +112,30 @@ class 
COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel):
 col.template_override_property(collection_props, scene_props, 
"normals_length")
 
 
+class COLLECTION_PT_paint_weight_mode_settings(CollectionButtonsPanel, Panel):
+bl_label = "Weight Paint Mode Settings"
+
+@classmethod
+def poll(cls, context):
+ob = context.object
+return ob and (ob.mode == 'WEIGHT_PAINT')
+
+def draw(self, context):
+layout = self.layout
+scene_props = context.scene.collection_properties['WeightPaintMode']
+collection = context.layer_collection
+collection_props = collection.engine_overrides['WeightPaintMode']
+
+col = layout.column()
+col.template_override_property(collection_props, scene_props, 
"use_shading")
+col.template_override_property(collection_props, scene_props, 
"use_wire")
+
 classes = (
 COLLECTION_PT_context_collection,
 COLLECTION_PT_clay_settings,
 COLLECTION_PT_object_mode_settings,
 COLLECTION_PT_edit_mode_settings,
+COLLECTION_PT_paint_weight_mode_settings,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index a24ce490262..db6f40756a4 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -411,6 +411,7 @@ void BKE_mesh_eval_geometry(struct EvaluationContext 
*eval_ctx,
 enum {
BKE_MESH_BATCH_DIRTY_ALL = 0,
BKE_MESH_BATCH_DIRTY_SELECT,
+   BKE_MESH_BATCH_DIRTY_WEIGHT,
 };
 void BKE_mesh_batch_cache_dirty(struct Mesh *me, int mode);
 void BKE_mesh_batch_cache_free(struct Mesh *me);
diff --git a/source/blender/blenkernel/intern/deform.c 
b/source/blender/blenkernel/intern/deform.c
index 13b1aab5e1c..22ba050e4fb 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -54,6 +54,7 @@
 #include "BKE_customdata.h"
 #include "BKE_data_transfer.h"
 #include "BKE_deform.h"  /* own include */
+#include "BKE_mesh.h"
 #include "BKE_mesh_mapping.h"
 #include "BKE_object_deform.h"
 
@@ -73,6 +74,8 @@ bDeformGroup *BKE_defgroup_new(Object *ob, const char *name)
BLI_addtail(>defbase, defgroup);
defgroup_unique_name(defgroup, ob);
 
+   BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_WEIGHT);
+
return defgroup;
 }
 
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index d9398ae83c7..1a920a155b8 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1088,6 +1088,22 @@ static void 
layer_collection_create_mode_settings_edit(IDProperty *root, const b
IDP_AddToGroup(root, props);
 }
 
+static void layer_collection_create_mode_settings_paint_weight(IDProperty 

[Bf-blender-cvs] [6abcd6cfd54] master: Fix error in node flag check

2017-05-03 Thread Campbell Barton
Commit: 6abcd6cfd545ecd3cb61b4ece065b10890779cd6
Author: Campbell Barton
Date:   Thu May 4 02:57:39 2017 +1000
Branches: master
https://developer.blender.org/rB6abcd6cfd545ecd3cb61b4ece065b10890779cd6

Fix error in node flag check

===

M   source/blender/editors/space_node/drawnode.c
M   source/blender/nodes/composite/nodes/node_composite_image.c

===

diff --git a/source/blender/editors/space_node/drawnode.c 
b/source/blender/editors/space_node/drawnode.c
index b7c41f04879..9b517425c1f 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3608,7 +3608,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, 
bNodeLink *link)
return;
if (link->fromsock->flag & SOCK_UNAVAIL)
return;
-   if ((link->fromsock->flag & SOCK_VIRTUAL) || 
(link->fromsock->flag & SOCK_VIRTUAL))
+   if ((link->fromsock->flag & SOCK_VIRTUAL) || 
(link->tosock->flag & SOCK_VIRTUAL))
do_dashed = true;
 
if (link->flag & NODE_LINK_VALID) {
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c 
b/source/blender/nodes/composite/nodes/node_composite_image.c
index 510e24554f0..f1fdaa32ce4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -193,7 +193,7 @@ void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode 
*node, Scene *scene,
 {
RLayerUpdateData *data = node->storage;
 
-   if (scene == NULL || srl == NULL || data == NULL || node->id != scene) {
+   if (scene == NULL || srl == NULL || data == NULL || node->id != (ID 
*)scene) {
return;
}

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


[Bf-blender-cvs] [b9451c04931] blender2.8: Merge branch 'master' into 28

2017-05-03 Thread Campbell Barton
Commit: b9451c04931d228161c1fb212c6c7a09545a86b7
Author: Campbell Barton
Date:   Thu May 4 02:58:26 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBb9451c04931d228161c1fb212c6c7a09545a86b7

Merge branch 'master' into 28

===



===



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


[Bf-blender-cvs] [82e242cc728] blender2.8: Merge branch 'master' into blender2.8

2017-05-03 Thread Lukas Stockner
Commit: 82e242cc7287ce56d10f88a76de5418a7b20e239
Author: Lukas Stockner
Date:   Wed May 3 18:33:02 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB82e242cc7287ce56d10f88a76de5418a7b20e239

Merge branch 'master' into blender2.8

===



===

diff --cc source/blender/blenloader/intern/versioning_270.c
index 0b6be6ab08d,c187766b586..a097e0a9e48
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@@ -1609,30 -1609,31 +1609,54 @@@ void blo_do_versions_270(FileData *fd, 
}
}
}
+ 
+   FOREACH_NODETREE(main, ntree, id) {
+   if (ntree->type == NTREE_COMPOSIT) {
+   bNode *node;
+   for (node = ntree->nodes.first; node; node = 
node->next) {
+   if (node->type == CMP_NODE_R_LAYERS) {
+   int pass_index = 0;
+   const char *sockname;
+   for (bNodeSocket *sock = 
node->outputs.first; sock && pass_index < 31; sock = sock->next, pass_index++) {
+   if (sock->storage == 
NULL) {
+   NodeImageLayer 
*sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
+   sock->storage = 
sockdata;
+   
BLI_strncpy(sockdata->pass_name, node_cmp_rlayers_sock_to_pass(pass_index), 
sizeof(sockdata->pass_name));
+ 
+   if (pass_index 
== 0) sockname = "Image";
+   else if 
(pass_index == 1) sockname = "Alpha";
+   else sockname = 
node_cmp_rlayers_sock_to_pass(pass_index);
+   
BLI_strncpy(sock->name, sockname, sizeof(sock->name));
+   }
+   }
+   }
+   }
+   }
+   } FOREACH_NODETREE_END
}
 +
 +  {
 +  if (!DNA_struct_elem_find(fd->filesdna, "View3DDebug", "char", 
"background")) {
 +  bScreen *screen;
 +
 +  for (screen = main->screen.first; screen; screen = 
screen->id.next) {
 +  ScrArea *sa;
 +  for (sa = screen->areabase.first; sa; sa = 
sa->next) {
 +  SpaceLink *sl;
 +
 +  for (sl = sa->spacedata.first; sl; sl = 
sl->next) {
 +  switch (sl->spacetype) {
 +  case SPACE_VIEW3D:
 +  {
 +  View3D *v3d = 
(View3D *)sl;
 +  
v3d->debug.background = V3D_DEBUG_BACKGROUND_NONE;
 +  }
 +  }
 +  }
 +  }
 +  }
 +  }
 +  }
  }
  
  void do_versions_after_linking_270(Main *main)
diff --cc source/blender/draw/engines/basic/basic_engine.c
index bdcdefe414a,000..169c67f9702
mode 100644,00..100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@@ -1,257 -1,0 +1,257 @@@
 +/*
 + * Copyright 2016, Blender Foundation.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * Contributor(s): Blender Institute
 + *
 + */
 +
 +/** \file basic_engine.h
 + *  

[Bf-blender-cvs] [2564d929fc5] blender2.8: Correct over-alloc struct declaration

2017-05-03 Thread Campbell Barton
Commit: 2564d929fc5f75403bc5ca051fb33bc7b8874646
Author: Campbell Barton
Date:   Thu May 4 02:14:51 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB2564d929fc5f75403bc5ca051fb33bc7b8874646

Correct over-alloc struct declaration

===

M   source/blender/makesdna/DNA_action_types.h

===

diff --git a/source/blender/makesdna/DNA_action_types.h 
b/source/blender/makesdna/DNA_action_types.h
index 87749c3b768..90d6bbb4f1e 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -180,6 +180,7 @@ typedef enum eMotionPaths_BakeFlag {
MOTIONPATH_BAKE_HAS_PATHS   = (1 << 2)
 } eMotionPath_BakeFlag;
 
+/* runtime */
 #
 #
 typedef struct bPoseChannelDrawData {
@@ -187,7 +188,8 @@ typedef struct bPoseChannelDrawData {
float wire_color[4];
 
int bbone_matrix_len;
-   float bbone_matrix[32][4][4];
+   /* keep last */
+   float bbone_matrix[0][4][4];
 } bPoseChannelDrawData;
 
 /*  */

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


[Bf-blender-cvs] [673e6fc5357] blender2.8: Draw Manager: Bring pose bones to the pose engine

2017-05-03 Thread Dalai Felinto
Commit: 673e6fc535793ddb4858231d19ebc35c6a7b4d7c
Author: Dalai Felinto
Date:   Wed May 3 16:34:28 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB673e6fc535793ddb4858231d19ebc35c6a7b4d7c

Draw Manager: Bring pose bones to the pose engine

Note: We should test if the armature is the "armature modifier" parent of the
object.

If any good samaritan feels like tackling this, the function to change
is: DRW_pose_mode_armature

===

M   source/blender/draw/intern/draw_common.h
M   source/blender/draw/modes/object_mode.c
M   source/blender/draw/modes/pose_mode.c

===

diff --git a/source/blender/draw/intern/draw_common.h 
b/source/blender/draw/intern/draw_common.h
index 6dbf7cba417..d1af67fcdfd 100644
--- a/source/blender/draw/intern/draw_common.h
+++ b/source/blender/draw/intern/draw_common.h
@@ -118,4 +118,8 @@ void DRW_shgroup_armature_edit(
 struct Object *ob, struct DRWPass *pass_bone_solid,
 struct DRWPass *pass_bone_wire, struct DRWShadingGroup 
*shgrp_relationship_lines);
 
+/* pose_mode.c */
+bool DRW_pose_mode_armature(
+struct Object *ob, struct Object *active_ob);
+
 #endif /* __DRAW_COMMON__ */
diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 4b4c2f0abb6..4a77a9f4c6a 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1249,15 +1249,10 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
{
bArmature *arm = ob->data;
if (arm->edbo == NULL) {
-   if ((ob->mode & OB_MODE_POSE) && (ob == 
OBACT_NEW)) {
-   DRW_shgroup_armature_pose(
-   ob, psl->bone_solid, 
psl->bone_wire,
-   
stl->g_data->relationship_lines);
-   }
-   else {
+   if (DRW_state_is_select() || 
!DRW_pose_mode_armature(ob, OBACT_NEW)) {
DRW_shgroup_armature_object(
-   ob, sl, psl->bone_solid, 
psl->bone_wire,
-   
stl->g_data->relationship_lines);
+   ob, sl, 
psl->bone_solid, psl->bone_wire,
+   
stl->g_data->relationship_lines);
}
}
break;
diff --git a/source/blender/draw/modes/pose_mode.c 
b/source/blender/draw/modes/pose_mode.c
index 176e44199b3..19ec4057bb5 100644
--- a/source/blender/draw/modes/pose_mode.c
+++ b/source/blender/draw/modes/pose_mode.c
@@ -33,6 +33,8 @@
 
 #include "draw_mode_engines.h"
 
+extern GlobalsUboStorage ts;
+
 /* *** LISTS *** */
 /* All lists are per viewport specific datas.
  * They are all free when viewport changes engines
@@ -41,94 +43,31 @@
  * for POSE_PassList */
 
 typedef struct POSE_PassList {
-   /* Declare all passes here and init them in
-* POSE_cache_init().
-* Only contains (DRWPass *) */
-   struct DRWPass *pass;
+   struct DRWPass *bone_solid;
+   struct DRWPass *bone_wire;
+   struct DRWPass *relationship;
 } POSE_PassList;
 
-typedef struct POSE_FramebufferList {
-   /* Contains all framebuffer objects needed by this engine.
-* Only contains (GPUFrameBuffer *) */
-   struct GPUFrameBuffer *fb;
-} POSE_FramebufferList;
-
-typedef struct POSE_TextureList {
-   /* Contains all framebuffer textures / utility textures
-* needed by this engine. Only viewport specific textures
-* (not per object). Only contains (GPUTexture *) */
-   struct GPUTexture *texture;
-} POSE_TextureList;
-
 typedef struct POSE_StorageList {
-   /* Contains any other memory block that the engine needs.
-* Only directly MEM_(m/c)allocN'ed blocks because they are
-* free with MEM_freeN() when viewport is freed.
-* (not per object) */
-   struct CustomStruct *block;
struct POSE_PrivateData *g_data;
 } POSE_StorageList;
 
 typedef struct POSE_Data {
-   /* Struct returned by DRW_viewport_engine_data_get.
-* If you don't use one of these, just make it a (void *) */
-   // void *fbl;
-   void *engine_type; /* Required */
-   POSE_FramebufferList *fbl;
-   POSE_TextureList *txl;
+   void *engine_type;
+   DRWViewportEmptyList *fbl;
+   DRWViewportEmptyList *txl;
POSE_PassList *psl;
POSE_StorageList *stl;
 } POSE_Data;
 
 /* *** STATIC *** */
 
-static struct {
-   /* Custom shaders :
-* Add sources to source/blender/draw/modes/shaders
- 

[Bf-blender-cvs] [3bf31c6d234] blender2.8: Move pose-bone colors into draw_data

2017-05-03 Thread Campbell Barton
Commit: 3bf31c6d234537e2207fc71b1ef016f800803ca9
Author: Campbell Barton
Date:   Thu May 4 01:32:16 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB3bf31c6d234537e2207fc71b1ef016f800803ca9

Move pose-bone colors into draw_data

Also only allocate necessary number of bone segments.

===

M   source/blender/blenkernel/intern/action.c
M   source/blender/draw/intern/draw_armature.c
M   source/blender/makesdna/DNA_action_types.h

===

diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 9889ebc56ef..30097a98b40 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -580,7 +580,7 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, const bool 
copy_constraints)
pchan->prop = IDP_CopyProperty(pchan->prop);
}
 
-   pchan->draw_data = NULL;  /* Drawing cache of bbone matrices, 
no need to copy. */
+   pchan->draw_data = NULL;  /* Drawing cache, no need to copy. */
}
 
/* for now, duplicate Bone Groups too when doing this */
@@ -770,7 +770,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool 
do_id_user)
MEM_freeN(pchan->prop);
}
 
-   /* Cached bbone matrices, for new draw manager rendering code. */
+   /* Cached data, for new draw manager rendering code. */
MEM_SAFE_FREE(pchan->draw_data);
 }
 
diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index cd04ecc62f7..68104dafc07 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -551,7 +551,7 @@ static const float *get_bone_solid_color(
 #endif
 
if (arm->flag & ARM_POSEMODE) {
-   float *disp_color = (float *)pchan->disp_solid_color;
+   float *disp_color = pchan->draw_data->solid_color;
set_pchan_color(PCHAN_COLOR_SOLID, boneflag, constflag, 
disp_color);
disp_color[3] = 1.0;
return disp_color;
@@ -586,7 +586,7 @@ static const float *get_bone_wire_color(
}
}
else if (arm->flag & ARM_POSEMODE) {
-   float *disp_color = (float *)pchan->disp_wire_color;
+   float *disp_color = pchan->draw_data->wire_color;
set_pchan_color(PCHAN_COLOR_NORMAL, boneflag, constflag, 
disp_color);
disp_color[3] = 1.0;
return disp_color;
@@ -623,6 +623,23 @@ static const float *get_bone_wire_color(
 /** \name Helper Utils
  * \{ */
 
+static void pchan_draw_data_init(bPoseChannel *pchan)
+{
+
+   if (pchan->draw_data != NULL) {
+   if (pchan->draw_data->bbone_matrix_len != 
pchan->bone->segments) {
+   MEM_SAFE_FREE(pchan->draw_data);
+   }
+   }
+
+   if (pchan->draw_data == NULL) {
+   bPoseChannelDrawData *draw_data;
+   /* We just allocate max allowed segcount, we can always refine 
this later if really needed. */
+   pchan->draw_data = MEM_mallocN(sizeof(*draw_data) + 
sizeof(Mat4) * pchan->bone->segments, __func__);
+   pchan->draw_data->bbone_matrix_len = pchan->bone->segments;
+   }
+}
+
 static void draw_bone_update_disp_matrix_default(EditBone *eBone, bPoseChannel 
*pchan)
 {
float s[4][4], ebmat[4][4];
@@ -737,7 +754,6 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
float length, xwidth, zwidth;
float (*bone_mat)[4];
float (*disp_mat)[4];
-   float (*disp_tail_mat)[4];
short bbone_segments;
 
/* TODO : This should be moved to depsgraph or armature refresh
@@ -749,7 +765,6 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
zwidth = pchan->bone->zwidth;
bone_mat = pchan->pose_mat;
disp_mat = pchan->disp_mat;
-   disp_tail_mat = pchan->disp_tail_mat;
bbone_segments = pchan->bone->segments;
}
else {
@@ -761,7 +776,6 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
zwidth = eBone->zwidth;
bone_mat = ebmat;
disp_mat = eBone->disp_mat;
-   disp_tail_mat = eBone->disp_tail_mat;
bbone_segments = eBone->segments;
}
 
@@ -771,12 +785,7 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
/* Note that we need this even for one-segment bones, because box 
drawing need specific weirdo matrix for the box,
 * that we cannot use to draw end points & co. */
if (pchan) {
-   Mat4 *bbones_mat = pchan->draw_data;
-   if 

[Bf-blender-cvs] [15189baa523] master: "Fix" root cause of T51260 Forward compatibility crash fter adding new IDProp type.

2017-05-03 Thread Bastien Montagne
Commit: 15189baa5231d70c1363192eb01b83fa946f36f0
Author: Bastien Montagne
Date:   Wed May 3 17:01:00 2017 +0200
Branches: master
https://developer.blender.org/rB15189baa5231d70c1363192eb01b83fa946f36f0

"Fix" root cause of T51260 Forward compatibility crash fter adding new IDProp 
type.

We unfortunately cannot fix this for previous versions of Blender, but
at least the issue (Blender crashing on unknown IDProp types) should now
be addressed for future.

Simply reset unknown IDProp types to integer one, and reset its value to zero.

===

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

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index eabe2feb4d7..1d74e126d95 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2107,8 +2107,19 @@ static void IDP_DirectLinkProperty(IDProperty *prop, int 
switch_endian, FileData
BLI_endian_switch_int32(>data.val2);
BLI_endian_switch_int64((int64_t 
*)>data.val);
}
-   
break;
+   case IDP_INT:
+   case IDP_FLOAT:
+   case IDP_ID:
+   break;  /* Nothing special to do here. */
+   default:
+   /* Unknown IDP type, nuke it (we cannot handle unknown 
types everywhere in code,
+* IDP are way too polymorphic to do it safely. */
+   printf("%s: found unknown IDProperty type %d, reset to 
Integer one !\n", __func__, prop->type);
+   /* Note: we do not attempt to free unknown prop, we 
have no way to know how to do that! */
+   prop->type = IDP_INT;
+   prop->subtype = 0;
+   IDP_Int(prop) = 0;
}
 }

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


[Bf-blender-cvs] [4cf7fc3b3a4] master: Render API/Cycles: Identify Render Passes by their name instead of a type flag

2017-05-03 Thread Lukas Stockner
Commit: 4cf7fc3b3a4d032f0c0db632a46d40806e906cf1
Author: Lukas Stockner
Date:   Wed May 3 00:21:18 2017 +0200
Branches: master
https://developer.blender.org/rB4cf7fc3b3a4d032f0c0db632a46d40806e906cf1

Render API/Cycles: Identify Render Passes by their name instead of a type flag

Previously, every RenderPass would have a bitfield that specified its type. 
That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they 
were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and 
changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve 
compatibility, 32 pass names are reserved for the old hardcoded passes.

To support these arbitrary passes, the Render Result compositor node now adds 
dynamic sockets. For compatibility, the old hardcoded sockets are always stored 
and just hidden when the corresponding pass isn't available.

To use these changes, the Render Engine API now includes a function that allows 
render engines to add arbitrary passes to the render result. To be able to add 
options for these passes, addons can now add their own properties to 
SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to 
implement a callback that registers all the passes that will be generated.

>From a user perspective, nothing should change with this commit.

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

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

===

M   intern/cycles/blender/addon/__init__.py
M   intern/cycles/blender/addon/engine.py
M   intern/cycles/blender/addon/properties.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/blender_python.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/image.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/blenloader/intern/writefile.c
M   source/blender/compositor/CMakeLists.txt
M   source/blender/compositor/intern/COM_NodeGraph.cpp
M   source/blender/compositor/nodes/COM_ImageNode.cpp
M   source/blender/compositor/nodes/COM_RenderLayersNode.cpp
M   source/blender/compositor/nodes/COM_RenderLayersNode.h
M   source/blender/compositor/operations/COM_RenderLayersProg.cpp
M   source/blender/compositor/operations/COM_RenderLayersProg.h
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/render/render_update.c
M   source/blender/editors/space_image/image_buttons.c
M   source/blender/editors/space_node/drawnode.c
M   source/blender/editors/space_node/node_edit.c
M   source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/makesrna/intern/rna_render.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_composite.h
M   source/blender/nodes/composite/node_composite_tree.c
M   source/blender/nodes/composite/nodes/node_composite_image.c
M   source/blender/render/CMakeLists.txt
M   source/blender/render/extern/include/RE_engine.h
M   source/blender/render/extern/include/RE_pipeline.h
M   source/blender/render/intern/include/render_result.h
M   source/blender/render/intern/include/rendercore.h
M   source/blender/render/intern/source/envmap.c
M   source/blender/render/intern/source/external_engine.c
M   source/blender/render/intern/source/pipeline.c
M   source/blender/render/intern/source/render_result.c
M   source/blender/render/intern/source/rendercore.c
M   source/blender/render/intern/source/zbuf.c
M   source/blenderplayer/bad_level_call_stubs/stubs.c

===

diff --git a/intern/cycles/blender/addon/__init__.py 
b/intern/cycles/blender/addon/__init__.py
index eb792af7264..a2d6262fb20 100644
--- a/intern/cycles/blender/addon/__init__.py
+++ b/intern/cycles/blender/addon/__init__.py
@@ -102,6 +102,9 @@ class CyclesRender(bpy.types.RenderEngine):
 else:
 self.report({'ERROR'}, "OSL support disabled in this build.")
 
+def update_render_passes(self, scene, srl):
+engine.register_passes(self, scene, srl)
+
 
 

[Bf-blender-cvs] [71366b9f2ad] greasepencil-object: Cleanup: make code more compact

2017-05-03 Thread Antonio Vazquez
Commit: 71366b9f2ada0f023af611912a59e97a35bbd80b
Author: Antonio Vazquez
Date:   Wed May 3 16:45:48 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB71366b9f2ada0f023af611912a59e97a35bbd80b

Cleanup: make code more compact

===

M   source/blender/draw/engines/gpencil/gpencil_draw.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw.c 
b/source/blender/draw/engines/gpencil/gpencil_draw.c
index d35f0ce9e33..39ef388b387 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw.c
@@ -64,9 +64,8 @@ static void gpencil_set_stroke_point(RegionView3D *rv3d, 
VertexBuffer *vbo, floa
const float pixsize = ED_view3d_pixel_size(rv3d, viewfpt);
float scale_thickness;
if (rv3d->is_persp) {
-   scale_thickness = (defaultpixsize / pixsize); 
/* need a factor to mimmic old glLine size, 10.0f works fine */
-   scale_thickness *= 10.0f;
+   scale_thickness = (defaultpixsize / pixsize) * 10.0f;
}
else {
scale_thickness = (1.0f / pixsize) / 100.0f;

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


[Bf-blender-cvs] [6ad29aaeece] greasepencil-object: Increase thickness limit parameter

2017-05-03 Thread Antonio Vazquez
Commit: 6ad29aaeececc841760012ea46dba9455430993a
Author: Antonio Vazquez
Date:   Wed May 3 16:41:33 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6ad29aaeececc841760012ea46dba9455430993a

Increase thickness limit parameter

===

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

===

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index c2d3cdc7d06..6111ab7aa44 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -129,15 +129,7 @@ static void rna_GPencilLayer_line_width_range(PointerRNA 
*ptr, int *min, int *ma
 {
bGPDlayer *gpl = ptr->data;

-   /* The restrictions on max width here are due to OpenGL on Windows not 
supporting
-* any widths greater than 10 (for driver-drawn) strokes/points.
-*
-* Although most of our 2D strokes also don't suffer from this 
restriction,
-* it's relatively hard to test for that. So, for now, only volumetric 
strokes
-* get to be larger...
-*/
-
-   /* From GP v2 this value is used to increase or decrease the thickness 
of the stroke */
+   /* From GP v2 this value is used to increase or decrease the 
thickness of the stroke */
if (gpl->flag & GP_LAYER_VOLUMETRIC) {
*min = -300;
*max = 300;
@@ -146,11 +138,11 @@ static void rna_GPencilLayer_line_width_range(PointerRNA 
*ptr, int *min, int *ma
*softmax = 100;
}
else {
-   *min = -10;
-   *max = 10;
+   *min = -50;
+   *max = 50;

-   *softmin = -10;
-   *softmax = 10;
+   *softmin = -50;
+   *softmax = 50;
}
 }
 
@@ -959,7 +951,6 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
/* Line Thickness change */
prop = RNA_def_property(srna, "line_change", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "thickness");
-   //RNA_def_property_range(prop, 1, 10); /* 10 px limit comes from 
Windows OpenGL limits for natively-drawn strokes */
RNA_def_property_int_funcs(prop, NULL, NULL, 
"rna_GPencilLayer_line_width_range");
RNA_def_property_ui_text(prop, "Thickness", "Thickness change to apply 
to current strokes (in pixels)");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");

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


[Bf-blender-cvs] [1f167037923] blender2.8: Error in last commit

2017-05-03 Thread Campbell Barton
Commit: 1f167037923fafb198cbe9cf44544e1bbb66b827
Author: Campbell Barton
Date:   Thu May 4 00:43:34 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB1f167037923fafb198cbe9cf44544e1bbb66b827

Error in last commit

===

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

===

diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index 36aabdf7735..cd04ecc62f7 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -1252,7 +1252,7 @@ static void DRW_shgroup_armature(
g_data.bone_wire = pass_bone_wire;
g_data.relationship_lines = shgrp_relationship_lines;
 
-   memset(_color, 0x0, sizeof(g_data));
+   memset(_color, 0x0, sizeof(g_color));
 }
 
 void DRW_shgroup_armature_object(

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


[Bf-blender-cvs] [f5f93bc576b] greasepencil-object: WIP: new method to calculate scale of the stroke thickness

2017-05-03 Thread Antonio Vazquez
Commit: f5f93bc576babca2c8ef303ce357042e6b1db7de
Author: Antonio Vazquez
Date:   Wed May 3 16:31:23 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBf5f93bc576babca2c8ef303ce357042e6b1db7de

WIP: new method to calculate scale of the stroke thickness

The previous scale method was not valid because only was affected by viewport, 
but not by GP object or Stroke location. Now, the pixel size is calculated 
depending of zdepth and used to scale the stroke thickness.

Maybe there are other ways to do it, but this approach works, so we keep it 
before finding better methods

===

M   source/blender/draw/engines/gpencil/gpencil_draw.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw.c 
b/source/blender/draw/engines/gpencil/gpencil_draw.c
index b318a20606f..d35f0ce9e33 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw.c
@@ -48,22 +48,38 @@
 #include "UI_resources.h"
 
 /* set stroke point to vbo */
-static void gpencil_set_stroke_point(VertexBuffer *vbo, const bGPDspoint *pt, 
int idx,
+static void gpencil_set_stroke_point(RegionView3D *rv3d, VertexBuffer *vbo, 
float matrix[4][4], const bGPDspoint *pt, int idx,
unsigned int pos_id, 
unsigned int color_id,
unsigned int 
thickness_id, short thickness,
const float ink[4], bool inverse)
 {
float fpt[3];
+   float viewfpt[3];
+   copy_v3_v3(fpt, >x);
+   
+   copy_v3_v3(viewfpt, >x);
+   mul_m4_v3(matrix, viewfpt);
+
+   const float defaultpixsize = rv3d->pixsize * U.pixelsize;
+   const float pixsize = ED_view3d_pixel_size(rv3d, viewfpt);
+   float scale_thickness;
+   if (rv3d->is_persp) {
+   scale_thickness = (defaultpixsize / pixsize); 
+   /* need a factor to mimmic old glLine size, 10.0f works fine */
+   scale_thickness *= 10.0f;
+   }
+   else {
+   scale_thickness = (1.0f / pixsize) / 100.0f;
+   }
 
float alpha = ink[3] * pt->strength;
CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
float col[4] = { ink[0], ink[1], ink[2], alpha };
VertexBuffer_set_attrib(vbo, color_id, idx, col);
 
-   float thick = max_ff(pt->pressure * thickness, 1.0f);
+   float thick = max_ff(pt->pressure * thickness * scale_thickness, 1.0f);
VertexBuffer_set_attrib(vbo, thickness_id, idx, );

-   copy_v3_v3(fpt, >x);
if (inverse) {
mul_v3_fl(fpt, -1.0f);
}
@@ -98,8 +114,11 @@ Batch *gpencil_get_point_geom(bGPDspoint *pt, short 
thickness, const float ink[4
 }
 
 /* create batch geometry data for stroke shader */
-Batch *gpencil_get_stroke_geom(bGPDstroke *gps, short thickness, const float 
ink[4])
+Batch *gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short 
thickness, const float ink[4])
 {
+   const DRWContextState *draw_ctx = DRW_context_state_get();
+   RegionView3D *rv3d = draw_ctx->rv3d;
+
bGPDspoint *points = gps->points;
int totpoints = gps->totpoints;
/* if cyclic needs more vertex */
@@ -122,27 +141,27 @@ Batch *gpencil_get_stroke_geom(bGPDstroke *gps, short 
thickness, const float ink
for (int i = 0; i < totpoints; i++, pt++) {
/* first point for adjacency (not drawn) */
if (i == 0) {
-   gpencil_set_stroke_point(vbo, pt, idx, pos_id, 
color_id, thickness_id, thickness, ink, true);
+   gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, pt, 
idx, pos_id, color_id, thickness_id, thickness, ink, true);
++idx;
}
/* set point */
-   gpencil_set_stroke_point(vbo, pt, idx, pos_id, color_id, 
thickness_id, thickness, ink, false);
+   gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, pt, idx, 
pos_id, color_id, thickness_id, thickness, ink, false);
++idx;
}
 
if (gps->flag & GP_STROKE_CYCLIC && totpoints > 2) {
/* draw line to first point to complete the cycle */
-   gpencil_set_stroke_point(vbo, [0], idx, pos_id, 
color_id, thickness_id, thickness, ink, false);
+   gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, [0], 
idx, pos_id, color_id, thickness_id, thickness, ink, false);
++idx;
/* now add adjacency points using 2nd & 3rd point to get smooth 
transition */
-   gpencil_set_stroke_point(vbo, [1], idx, pos_id, 

[Bf-blender-cvs] [827818d37dd] blender2.8: Rename bPoseChannel's temp/cache pointer for DrawManager to draw_data.

2017-05-03 Thread Bastien Montagne
Commit: 827818d37dd2c9caf16ddc2c2b8d9415d6afc3b9
Author: Bastien Montagne
Date:   Wed May 3 16:10:25 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB827818d37dd2c9caf16ddc2c2b8d9415d6afc3b9

Rename bPoseChannel's temp/cache pointer for DrawManager to draw_data.

More generic name, this remains a temp solution anyway, until we have
proper handling of temp data from 'magic DEG'! ;)

===

M   source/blender/blenkernel/intern/action.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/draw/intern/draw_armature.c
M   source/blender/makesdna/DNA_action_types.h

===

diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 44ee9aa7bf1..9889ebc56ef 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -580,7 +580,7 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, const bool 
copy_constraints)
pchan->prop = IDP_CopyProperty(pchan->prop);
}
 
-   pchan->bbone_matrices = NULL;  /* Drawing cache of bbone 
matrices, no need to copy. */
+   pchan->draw_data = NULL;  /* Drawing cache of bbone matrices, 
no need to copy. */
}
 
/* for now, duplicate Bone Groups too when doing this */
@@ -771,7 +771,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool 
do_id_user)
}
 
/* Cached bbone matrices, for new draw manager rendering code. */
-   MEM_SAFE_FREE(pchan->bbone_matrices);
+   MEM_SAFE_FREE(pchan->draw_data);
 }
 
 void BKE_pose_channel_free(bPoseChannel *pchan)
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 4cb0595dde9..7567fce3778 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5065,7 +5065,7 @@ static void direct_link_pose(FileData *fd, bPose *pose)
/* in case this value changes in future, clamp else we get 
undefined behavior */
CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 
-   pchan->bbone_matrices = NULL;
+   pchan->draw_data = NULL;
}
pose->ikdata = NULL;
if (pose->ikparam != NULL) {
diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index 5eca979341c..36aabdf7735 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -771,10 +771,10 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
/* Note that we need this even for one-segment bones, because box 
drawing need specific weirdo matrix for the box,
 * that we cannot use to draw end points & co. */
if (pchan) {
-   Mat4 *bbones_mat = pchan->bbone_matrices;
+   Mat4 *bbones_mat = pchan->draw_data;
if (bbones_mat == NULL) {
/* We just allocate max allowed segcount, we can always 
refine this later if really needed. */
-   bbones_mat = pchan->bbone_matrices = 
MEM_mallocN(sizeof(*bbones_mat) * MAX_BBONE_SUBDIV, __func__);
+   bbones_mat = pchan->draw_data = 
MEM_mallocN(sizeof(*bbones_mat) * MAX_BBONE_SUBDIV, __func__);
}
 
if (bbone_segments > 1) {
@@ -957,7 +957,7 @@ static void draw_bone_wire(
}
 
if (pchan) {
-   Mat4 *bbones_mat = pchan->bbone_matrices;
+   Mat4 *bbones_mat = pchan->draw_data;
BLI_assert(bbones_mat != NULL);
 
for (int i = pchan->bone->segments; i--; bbones_mat++) {
@@ -992,7 +992,7 @@ static void draw_bone_box(
}
 
if (pchan) {
-   Mat4 *bbones_mat = pchan->bbone_matrices;
+   Mat4 *bbones_mat = pchan->draw_data;
BLI_assert(bbones_mat != NULL);
 
for (int i = pchan->bone->segments; i--; bbones_mat++) {
diff --git a/source/blender/makesdna/DNA_action_types.h 
b/source/blender/makesdna/DNA_action_types.h
index 51d6b000739..d4fd54ce7ad 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -265,7 +265,7 @@ typedef struct bPoseChannel {
float disp_wire_color[4];
 
void*temp;  /* use for outliner */
-   void *bbone_matrices;   /* Used to cache each bbone's segment 
matrix. */
+   void *draw_data;/* Used to cache each bbone's segment 
matrix. */
 } bPoseChannel;

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


[Bf-blender-cvs] [6824ee0595c] blender2.8: Fix bad scaling of BBone single-segment bones in new Armature drawing code.

2017-05-03 Thread Bastien Montagne
Commit: 6824ee0595c9dd7d1c18864f2bbb8363d5fe69a5
Author: Bastien Montagne
Date:   Wed May 3 15:33:30 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB6824ee0595c9dd7d1c18864f2bbb8363d5fe69a5

Fix bad scaling of BBone single-segment bones in new Armature drawing code.

Reported by @campbellbarton over irc, thanks.

===

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

===

diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index cff8c0d010f..5eca979341c 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -765,21 +765,19 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
bbone_segments = eBone->segments;
}
 
-   copy_m4_m4(disp_mat, bone_mat);
-   copy_m4_m4(disp_tail_mat, disp_mat);
-   translate_m4(disp_tail_mat, 0.0f, length, 0.0f);
-
size_to_mat4(s, (const float[3]){xwidth, length / bbone_segments, 
zwidth});
 
/* Compute BBones segment matrices... */
-   if (bbone_segments > 1) {
-   if (pchan) {
-   Mat4 *bbones_mat = pchan->bbone_matrices;
-   if (bbones_mat == NULL) {
-   /* We just allocate max allowed segcount, we 
can always refine this later if really needed. */
-   bbones_mat = pchan->bbone_matrices = 
MEM_mallocN(sizeof(*bbones_mat) * MAX_BBONE_SUBDIV, __func__);
-   }
+   /* Note that we need this even for one-segment bones, because box 
drawing need specific weirdo matrix for the box,
+* that we cannot use to draw end points & co. */
+   if (pchan) {
+   Mat4 *bbones_mat = pchan->bbone_matrices;
+   if (bbones_mat == NULL) {
+   /* We just allocate max allowed segcount, we can always 
refine this later if really needed. */
+   bbones_mat = pchan->bbone_matrices = 
MEM_mallocN(sizeof(*bbones_mat) * MAX_BBONE_SUBDIV, __func__);
+   }
 
+   if (bbone_segments > 1) {
b_bone_spline_setup(pchan, 0, bbones_mat);
 
for (int i = bbone_segments; i--; bbones_mat++) {
@@ -788,8 +786,13 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
}
}
else {
-   float (*bbones_mat)[4][4] = eBone->disp_bbone_mat;
+   mul_m4_m4m4(bbones_mat->mat, bone_mat, s);
+   }
+   }
+   else {
+   float (*bbones_mat)[4][4] = eBone->disp_bbone_mat;
 
+   if (bbone_segments > 1) {
ebone_spline_preview(eBone, bbones_mat);
 
for (int i = bbone_segments; i--; bbones_mat++) {
@@ -797,10 +800,13 @@ static void draw_bone_update_disp_matrix_bbone(EditBone 
*eBone, bPoseChannel *pc
mul_m4_m4m4(*bbones_mat, disp_mat, *bbones_mat);
}
}
+   else {
+   mul_m4_m4m4(*bbones_mat, bone_mat, s);
+   }
}
-   else {
-   mul_m4_m4m4(disp_mat, disp_mat, s);
-   }
+
+   /* Grrr... We need default display matrix to draw end points, axes, 
etc. :( */
+   draw_bone_update_disp_matrix_default(eBone, pchan);
 }
 
 static void draw_bone_update_disp_matrix_custom(bPoseChannel *pchan)
@@ -950,7 +956,7 @@ static void draw_bone_wire(
DRW_select_load_id(select_id | BONESEL_BONE);
}
 
-   if (pchan && pchan->bone->segments > 1) {
+   if (pchan) {
Mat4 *bbones_mat = pchan->bbone_matrices;
BLI_assert(bbones_mat != NULL);
 
@@ -958,22 +964,16 @@ static void draw_bone_wire(
DRW_shgroup_bone_wire_wire(bbones_mat->mat, col_wire);
}
}
-   else if (eBone && eBone->segments > 1) {
+   else if (eBone) {
for (int i = 0; i < eBone->segments; i++) {
DRW_shgroup_bone_wire_wire(eBone->disp_bbone_mat[i], 
col_wire);
}
}
-   else {
-   DRW_shgroup_bone_wire_wire(BONE_VAR(eBone, pchan, disp_mat), 
col_wire);
-   }
 
if (select_id != -1) {
DRW_select_load_id(-1);
}
 
-   /* Grrr... We need to restore default display matrix to draw end 
points, axes, etc. :( */
-   draw_bone_update_disp_matrix_default(eBone, pchan);
-
if (eBone) {
draw_points(eBone, pchan, arm, boneflag, constflag, select_id);
}
@@ -991,7 +991,7 @@ static void draw_bone_box(
DRW_select_load_id(select_id | BONESEL_BONE);
}
 
-   if (pchan && 

[Bf-blender-cvs] [3c91fbf6bef] blender2.8: Draw Manager: Use color-sets for solid pose-bones

2017-05-03 Thread Campbell Barton
Commit: 3c91fbf6befbc69de45ee1e4bba57fee95b9bb1a
Author: Campbell Barton
Date:   Thu May 4 00:16:31 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB3c91fbf6befbc69de45ee1e4bba57fee95b9bb1a

Draw Manager: Use color-sets for solid pose-bones

===

M   source/blender/draw/intern/draw_armature.c
M   source/blender/makesdna/DNA_action_types.h

===

diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index ec44de60645..cff8c0d010f 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -212,6 +212,9 @@ static void 
UNUSED_FUNCTION(DRW_shgroup_bone_relationship_lines)(const float hea
 /*  */
 
 /** \name Drawing Theme Helpers
+ *
+ * Note, this section is duplicate of code in 'drawarmature.c'.
+ *
  * \{ */
 
 /* global here is reset before drawing each bone */
@@ -512,7 +515,9 @@ static void update_color(const float const_color[4])
 #undef NO_ALPHA
 }
 
-static const float *get_bone_solid_color(const EditBone *eBone, const 
bPoseChannel *pchan, const bArmature *arm)
+static const float *get_bone_solid_color(
+const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm,
+const int boneflag, const short constflag)
 {
if (g_theme.const_color)
return g_theme.bone_solid_color;
@@ -545,12 +550,18 @@ static const float *get_bone_solid_color(const EditBone 
*eBone, const bPoseChann
UNUSED_VARS(eBone, pchan, arm);
 #endif
 
+   if (arm->flag & ARM_POSEMODE) {
+   float *disp_color = (float *)pchan->disp_solid_color;
+   set_pchan_color(PCHAN_COLOR_SOLID, boneflag, constflag, 
disp_color);
+   disp_color[3] = 1.0;
+   return disp_color;
+   }
+
return g_theme.bone_solid_color;
 }
 
 static const float *get_bone_wire_color(
-const EditBone *eBone, const bPoseChannel *pchan,
-const bArmature *arm,
+const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm,
 const int boneflag, const short constflag)
 {
if (g_theme.const_color)
@@ -575,9 +586,10 @@ static const float *get_bone_wire_color(
}
}
else if (arm->flag & ARM_POSEMODE) {
-   set_pchan_color(PCHAN_COLOR_NORMAL, boneflag, constflag, (float 
*)pchan->disp_color);
-   ((float *)pchan->disp_color)[3] = 1.0;
-   return pchan->disp_color;
+   float *disp_color = (float *)pchan->disp_wire_color;
+   set_pchan_color(PCHAN_COLOR_NORMAL, boneflag, constflag, 
disp_color);
+   disp_color[3] = 1.0;
+   return disp_color;
 
 
 #if 0
@@ -845,7 +857,7 @@ static void draw_points(
}
}
else if (arm->flag & ARM_POSEMODE) {
-   col_solid_root = col_solid_tail = get_bone_solid_color(eBone, 
pchan, arm);
+   col_solid_root = col_solid_tail = get_bone_solid_color(eBone, 
pchan, arm, boneflag, constflag);
col_wire_root = col_wire_tail = get_bone_wire_color(eBone, 
pchan, arm, boneflag, constflag);
}
 
@@ -895,7 +907,7 @@ static void draw_bone_custom_shape(
 const int boneflag, const short constflag,
 const int select_id)
 {
-   const float *col_solid = get_bone_solid_color(eBone, pchan, arm);
+   const float *col_solid = get_bone_solid_color(eBone, pchan, arm, 
boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, 
boneflag, constflag);
const float (*disp_mat)[4] = pchan->custom_tx ? 
pchan->custom_tx->disp_mat : pchan->disp_mat;
 
@@ -972,7 +984,7 @@ static void draw_bone_box(
 const int boneflag, const short constflag,
 const int select_id)
 {
-   const float *col_solid = get_bone_solid_color(eBone, pchan, arm);
+   const float *col_solid = get_bone_solid_color(eBone, pchan, arm, 
boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, 
boneflag, constflag);
 
if (select_id != -1) {
@@ -1016,7 +1028,7 @@ static void draw_bone_octahedral(
 const int boneflag, const short constflag,
 const int select_id)
 {
-   const float *col_solid = get_bone_solid_color(eBone, pchan, arm);
+   const float *col_solid = get_bone_solid_color(eBone, pchan, arm, 
boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, 
boneflag, constflag);
 
if (select_id != -1) {
diff --git a/source/blender/makesdna/DNA_action_types.h 
b/source/blender/makesdna/DNA_action_types.h
index 4a42d178d05..51d6b000739 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -261,7 +261,8 @@ 

[Bf-blender-cvs] [e0722a2c071] blender2.8: Draw Manager: use pose bone theme and constraint colors

2017-05-03 Thread Campbell Barton
Commit: e0722a2c071309aabaf0b14bf8c4c3b8508b5075
Author: Campbell Barton
Date:   Thu May 4 00:00:17 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBe0722a2c071309aabaf0b14bf8c4c3b8508b5075

Draw Manager: use pose bone theme and constraint colors

===

M   source/blender/draw/intern/draw_armature.c
M   source/blender/makesdna/DNA_action_types.h

===

diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index 9bc19443499..ec44de60645 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -211,6 +211,256 @@ static void 
UNUSED_FUNCTION(DRW_shgroup_bone_relationship_lines)(const float hea
 
 /*  */
 
+/** \name Drawing Theme Helpers
+ * \{ */
+
+/* global here is reset before drawing each bone */
+struct {
+   const ThemeWireColor *bcolor;
+} g_color;
+
+/* values of colCode for set_pchan_color */
+enum {
+   PCHAN_COLOR_NORMAL  = 0,/* normal drawing */
+   PCHAN_COLOR_SOLID,  /* specific case where "solid" color is 
needed */
+   PCHAN_COLOR_CONSTS, /* "constraint" colors (which 
may/may-not be suppressed) */
+
+   PCHAN_COLOR_SPHEREBONE_BASE,/* for the 'stick' of sphere (envelope) 
bones */
+   PCHAN_COLOR_SPHEREBONE_END, /* for the ends of sphere (envelope) 
bones */
+   PCHAN_COLOR_LINEBONE/* for the middle of line-bones */
+};
+
+/* This function sets the color-set for coloring a certain bone */
+static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
+{
+   bPose *pose = (ob) ? ob->pose : NULL;
+   bArmature *arm = (ob) ? ob->data : NULL;
+   bActionGroup *grp = NULL;
+   short color_index = 0;
+
+   /* sanity check */
+   if (ELEM(NULL, ob, arm, pose, pchan)) {
+   g_color.bcolor = NULL;
+   return;
+   }
+
+   /* only try to set custom color if enabled for armature */
+   if (arm->flag & ARM_COL_CUSTOM) {
+   /* currently, a bone can only use a custom color set if it's 
group (if it has one),
+* has been set to use one
+*/
+   if (pchan->agrp_index) {
+   grp = (bActionGroup *)BLI_findlink(>agroups, 
(pchan->agrp_index - 1));
+   if (grp)
+   color_index = grp->customCol;
+   }
+   }
+
+   /* bcolor is a pointer to the color set to use. If NULL, then the 
default
+* color set (based on the theme colors for 3d-view) is used.
+*/
+   if (color_index > 0) {
+   bTheme *btheme = UI_GetTheme();
+   g_color.bcolor = >tarm[(color_index - 1)];
+   }
+   else if (color_index == -1) {
+   /* use the group's own custom color set (grp is always != NULL 
here) */
+   g_color.bcolor = >cs;
+   }
+   else {
+   g_color.bcolor = NULL;
+   }
+}
+
+/* This function is for brightening/darkening a given color (like 
UI_GetThemeColorShade3ubv()) */
+static void cp_shade_color3ub(unsigned char cp[3], const int offset)
+{
+   int r, g, b;
+
+   r = offset + (int) cp[0];
+   CLAMP(r, 0, 255);
+   g = offset + (int) cp[1];
+   CLAMP(g, 0, 255);
+   b = offset + (int) cp[2];
+   CLAMP(b, 0, 255);
+
+   cp[0] = r;
+   cp[1] = g;
+   cp[2] = b;
+}
+
+/* This function sets the gl-color for coloring a certain bone (based on 
bcolor) */
+static bool set_pchan_color(short colCode, const int boneflag, const short 
constflag, float r_color[4])
+{
+   float *fcolor = r_color;
+   const ThemeWireColor *bcolor = g_color.bcolor;
+
+   switch (colCode) {
+   case PCHAN_COLOR_NORMAL:
+   {
+   if (bcolor) {
+   unsigned char cp[4] = {255};
+
+   if (boneflag & BONE_DRAW_ACTIVE) {
+   copy_v3_v3_char((char *)cp, 
bcolor->active);
+   if (!(boneflag & BONE_SELECTED)) {
+   cp_shade_color3ub(cp, -80);
+   }
+   }
+   else if (boneflag & BONE_SELECTED) {
+   copy_v3_v3_char((char *)cp, 
bcolor->select);
+   }
+   else {
+   /* a bit darker than solid */
+   copy_v3_v3_char((char *)cp, 
bcolor->solid);
+   cp_shade_color3ub(cp, -50);
+   }
+
+   

[Bf-blender-cvs] [6bf4115c139] master: Cycles: Split kernel - sort shaders

2017-05-03 Thread Hristo Gueorguiev
Commit: 6bf4115c13962c99d1cdc97f2be92c4922f3fd33
Author: Hristo Gueorguiev
Date:   Wed May 3 15:30:45 2017 +0200
Branches: master
https://developer.blender.org/rB6bf4115c13962c99d1cdc97f2be92c4922f3fd33

Cycles: Split kernel - sort shaders

Reduce thread divergence in kernel_shader_eval.

Rays are sorted in blocks of 2048 according to shader->id.

On R9 290 Classroom is ~30% faster, and Pabellon Barcelone is ~8% faster.

No sorting for CUDA split kernel.

Reviewers: sergey, maiself

Reviewed By: maiself

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

===

M   intern/cycles/device/device_split_kernel.cpp
M   intern/cycles/device/device_split_kernel.h
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
M   intern/cycles/kernel/kernels/cuda/kernel_split.cu
M   intern/cycles/kernel/kernels/opencl/kernel_shader_eval.cl
A   intern/cycles/kernel/kernels/opencl/kernel_shader_setup.cl
A   intern/cycles/kernel/kernels/opencl/kernel_shader_sort.cl
M   intern/cycles/kernel/kernels/opencl/kernel_split.cl
M   intern/cycles/kernel/split/kernel_shader_eval.h
A   intern/cycles/kernel/split/kernel_shader_setup.h
A   intern/cycles/kernel/split/kernel_shader_sort.h
M   intern/cycles/kernel/split/kernel_split_data_types.h

===

diff --git a/intern/cycles/device/device_split_kernel.cpp 
b/intern/cycles/device/device_split_kernel.cpp
index bb3089c5418..9118793aad6 100644
--- a/intern/cycles/device/device_split_kernel.cpp
+++ b/intern/cycles/device/device_split_kernel.cpp
@@ -39,6 +39,8 @@ DeviceSplitKernel::DeviceSplitKernel(Device *device) : 
device(device)
kernel_do_volume = NULL;
kernel_queue_enqueue = NULL;
kernel_indirect_background = NULL;
+   kernel_shader_setup = NULL;
+   kernel_shader_sort = NULL;
kernel_shader_eval = NULL;
kernel_holdout_emission_blurring_pathtermination_ao = NULL;
kernel_subsurface_scatter = NULL;
@@ -64,6 +66,8 @@ DeviceSplitKernel::~DeviceSplitKernel()
delete kernel_do_volume;
delete kernel_queue_enqueue;
delete kernel_indirect_background;
+   delete kernel_shader_setup;
+   delete kernel_shader_sort;
delete kernel_shader_eval;
delete kernel_holdout_emission_blurring_pathtermination_ao;
delete kernel_subsurface_scatter;
@@ -89,6 +93,8 @@ bool DeviceSplitKernel::load_kernels(const 
DeviceRequestedFeatures& requested_fe
LOAD_KERNEL(do_volume);
LOAD_KERNEL(queue_enqueue);
LOAD_KERNEL(indirect_background);
+   LOAD_KERNEL(shader_setup);
+   LOAD_KERNEL(shader_sort);
LOAD_KERNEL(shader_eval);
LOAD_KERNEL(holdout_emission_blurring_pathtermination_ao);
LOAD_KERNEL(subsurface_scatter);
@@ -241,6 +247,8 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
ENQUEUE_SPLIT_KERNEL(do_volume, global_size, 
local_size);
ENQUEUE_SPLIT_KERNEL(queue_enqueue, 
global_size, local_size);
ENQUEUE_SPLIT_KERNEL(indirect_background, 
global_size, local_size);
+   ENQUEUE_SPLIT_KERNEL(shader_setup, global_size, 
local_size);
+   ENQUEUE_SPLIT_KERNEL(shader_sort, global_size, 
local_size);
ENQUEUE_SPLIT_KERNEL(shader_eval, global_size, 
local_size);

ENQUEUE_SPLIT_KERNEL(holdout_emission_blurring_pathtermination_ao, global_size, 
local_size);
ENQUEUE_SPLIT_KERNEL(subsurface_scatter, 
global_size, local_size);
diff --git a/intern/cycles/device/device_split_kernel.h 
b/intern/cycles/device/device_split_kernel.h
index 55548122c0c..58c2fdbb077 100644
--- a/intern/cycles/device/device_split_kernel.h
+++ b/intern/cycles/device/device_split_kernel.h
@@ -61,6 +61,8 @@ private:
SplitKernelFunction *kernel_do_volume;
SplitKernelFunction *kernel_queue_enqueue;
SplitKernelFunction *kernel_indirect_background;
+   SplitKernelFunction *kernel_shader_setup;
+   SplitKernelFunction *kernel_shader_sort;
SplitKernelFunction *kernel_shader_eval;
SplitKernelFunction 
*kernel_holdout_emission_blurring_pathtermination_ao;
SplitKernelFunction *kernel_subsurface_scatter;
diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index a92e8bc4aee..9bb0455b9d5 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -21,6 +21,8 @@ set(SRC
kernels/opencl/kernel_lamp_emission.cl
kernels/opencl/kernel_do_volume.cl
kernels/opencl/kernel_indirect_background.cl
+   

[Bf-blender-cvs] [2bec7c60705] blender2.8: Code Style: Don't add padding in a function call

2017-05-03 Thread Dalai Felinto
Commit: 2bec7c607053f7c5b99de720d43811428e5855f3
Author: Dalai Felinto
Date:   Wed May 3 14:32:16 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB2bec7c607053f7c5b99de720d43811428e5855f3

Code Style: Don't add padding in a function call

===

M   source/blender/draw/modes/object_mode.c

===

diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index f28b0af5eb1..4b4c2f0abb6 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -870,7 +870,7 @@ static void DRW_shgroup_lamp(OBJECT_StorageList *stl, 
Object *ob, SceneLayer *sl
mul_m4_m4m4(spotblendmat, shapemat, sizemat);
 
if (la->mode & LA_SQUARE) {
-   
DRW_shgroup_call_dynamic_add(stl->g_data->lamp_spot_pyramid,color, , 
shapemat);
+   
DRW_shgroup_call_dynamic_add(stl->g_data->lamp_spot_pyramid, color, , 
shapemat);
 
/* hide line if it is zero size or overlaps with outer 
border,
 * previously it adjusted to always to show it but that 
seems
@@ -880,7 +880,7 @@ static void DRW_shgroup_lamp(OBJECT_StorageList *stl, 
Object *ob, SceneLayer *sl
}
}
else {
-   
DRW_shgroup_call_dynamic_add(stl->g_data->lamp_spot_cone,  color, shapemat);
+   
DRW_shgroup_call_dynamic_add(stl->g_data->lamp_spot_cone, color, shapemat);
 
/* hide line if it is zero size or overlaps with outer 
border,
 * previously it adjusted to always to show it but that 
seems
@@ -890,7 +890,7 @@ static void DRW_shgroup_lamp(OBJECT_StorageList *stl, 
Object *ob, SceneLayer *sl
}
}
 
-   DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit,
color, >clipsta, >clipend, ob->obmat);
+   DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit, color, 
>clipsta, >clipend, ob->obmat);
DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit_points, 
color, >clipsta, >clipend, ob->obmat);
}
else if (la->type == LA_HEMI) {

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


[Bf-blender-cvs] [6f9c839f444] master: Cycles: Fix OpenCL compilation failure after recent color changes

2017-05-03 Thread Sergey Sharybin
Commit: 6f9c839f444f92c4b0c336a6f5e31cb9660d7dbc
Author: Sergey Sharybin
Date:   Wed May 3 14:11:19 2017 +0200
Branches: master
https://developer.blender.org/rB6f9c839f444f92c4b0c336a6f5e31cb9660d7dbc

Cycles: Fix OpenCL compilation failure after recent color changes

It is really confusing to have some functions available in some devices
and not on another devices.

===

M   intern/cycles/blender/blender_curves.cpp
M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/kernel/svm/svm_image.h
M   intern/cycles/util/util_color.h

===

diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index ed361cc971e..42b985305ea 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -776,17 +776,17 @@ static void ExportCurveTriangleVcol(ParticleCurveData 
*CData,
 
for(int curvekey = CData->curve_firstkey[curve]; 
curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; 
curvekey++) {
for(int section = 0; section < resol; 
section++) {
-   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear(CData->curve_vcol[curve]));
+   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
vertexindex++;
-   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear(CData->curve_vcol[curve]));
+   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
vertexindex++;
-   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear(CData->curve_vcol[curve]));
+   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
vertexindex++;
-   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear(CData->curve_vcol[curve]));
+   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
vertexindex++;
-   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear(CData->curve_vcol[curve]));
+   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
vertexindex++;
-   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear(CData->curve_vcol[curve]));
+   cdata[vertexindex] = 
color_float_to_byte(color_srgb_to_scene_linear_v3(CData->curve_vcol[curve]));
vertexindex++;
}
}
@@ -1004,7 +1004,7 @@ void BlenderSync::sync_curves(Mesh *mesh,
 
for(size_t curve = 0; curve < 
CData.curve_vcol.size(); curve++)
if(!(CData.curve_keynum[curve] 
<= 1 || CData.curve_length[curve] == 0.0f))
-   fdata[i++] = 
color_srgb_to_scene_linear(CData.curve_vcol[curve]);
+   fdata[i++] = 
color_srgb_to_scene_linear_v3(CData.curve_vcol[curve]);
}
}
}
diff --git a/intern/cycles/blender/blender_mesh.cpp 
b/intern/cycles/blender/blender_mesh.cpp
index 54571b1fea1..f13b9db7013 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -356,7 +356,7 @@ static void attr_create_vertex_color(Scene *scene,
int n = p->loop_total();
for(int i = 0; i < n; i++) {
float3 color = 
get_float3(l->data[p->loop_start() + i].color());
-   *(cdata++) = 
color_float_to_byte(color_srgb_to_scene_linear(color));
+   *(cdata++) = 
color_float_to_byte(color_srgb_to_scene_linear_v3(color));
}
}
}
@@ -380,11 +380,11 @@ static void attr_create_vertex_color(Scene *scene,
face_split_tri_indices(nverts[i], 
face_flags[i], tri_a, tri_b);
 
uchar4 colors[4];
-  

[Bf-blender-cvs] [60886670cd8] blender2.8: Move GPU compositing out of draw-manager off-screen drawing

2017-05-03 Thread Campbell Barton
Commit: 60886670cd8fec73a1db339590acd861f91f747c
Author: Campbell Barton
Date:   Wed May 3 22:13:57 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB60886670cd8fec73a1db339590acd861f91f747c

Move GPU compositing out of draw-manager off-screen drawing

Also no need to use VP_legacy_ prefix here.

===

M   source/blender/editors/space_view3d/view3d_draw.c

===

diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index c00a3e2b0b7..ceb8f69acaf 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2467,14 +2467,14 @@ static void view3d_stereo3d_setup_offscreen(
const bool is_left = STREQ(viewname, STEREO_LEFT_NAME);
 
BKE_camera_multiview_view_matrix(>r, v3d->camera, 
is_left, viewmat);
-   VP_legacy_view3d_main_region_setup_view(scene, v3d, ar, 
viewmat, winmat);
+   view3d_main_region_setup_view(scene, v3d, ar, viewmat, winmat);
}
else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
float viewmat[4][4];
Object *camera = BKE_camera_multiview_render(scene, 
v3d->camera, viewname);
 
BKE_camera_multiview_view_matrix(>r, camera, false, 
viewmat);
-   VP_legacy_view3d_main_region_setup_view(scene, v3d, ar, 
viewmat, winmat);
+   view3d_main_region_setup_view(scene, v3d, ar, viewmat, winmat);
}
 }
 
@@ -2559,51 +2559,52 @@ void ED_view3d_draw_offscreen(
if ((viewname != NULL && viewname[0] != '\0') && (viewmat == NULL) && 
rv3d->persp == RV3D_CAMOB && v3d->camera)
view3d_stereo3d_setup_offscreen(scene, v3d, ar, winmat, 
viewname);
else
-   VP_legacy_view3d_main_region_setup_view(scene, v3d, ar, 
viewmat, winmat);
+   view3d_main_region_setup_view(scene, v3d, ar, viewmat, winmat);
 
-   /* framebuffer fx needed, we need to draw offscreen first */
-   if (v3d->fx_settings.fx_flag && fx) {
-   GPUSSAOSettings *ssao = NULL;
+   /* main drawing call */
+   RenderEngineType *type = RE_engines_find(scene->r.engine);
+   if (IS_VIEWPORT_LEGACY(v3d) && ((type->flag & RE_USE_LEGACY_PIPELINE) 
!= 0)) {
 
-   if (v3d->drawtype < OB_SOLID) {
-   ssao = v3d->fx_settings.ssao;
-   v3d->fx_settings.ssao = NULL;
-   }
+   /* framebuffer fx needed, we need to draw offscreen first */
+   if (v3d->fx_settings.fx_flag && fx) {
+   GPUSSAOSettings *ssao = NULL;
 
-   do_compositing = GPU_fx_compositor_initialize_passes(fx, 
>winrct, NULL, fx_settings);
+   if (v3d->drawtype < OB_SOLID) {
+   ssao = v3d->fx_settings.ssao;
+   v3d->fx_settings.ssao = NULL;
+   }
 
-   if (ssao)
-   v3d->fx_settings.ssao = ssao;
-   }
+   do_compositing = 
GPU_fx_compositor_initialize_passes(fx, >winrct, NULL, fx_settings);
+
+   if (ssao)
+   v3d->fx_settings.ssao = ssao;
+   }
 
-   /* main drawing call */
-   RenderEngineType *type = RE_engines_find(scene->r.engine);
-   if (IS_VIEWPORT_LEGACY(v3d) && ((type->flag & RE_USE_LEGACY_PIPELINE) 
!= 0)) {
VP_deprecated_view3d_draw_objects(NULL, scene, v3d, ar, NULL, 
do_bgpic, true, do_compositing ? fx : NULL);
-   }
-   else {
-   /* XXX, should take depsgraph as arg */
-   DRW_draw_render_loop_offscreen(scene->depsgraph, ar, v3d, ofs);
-   }
 
-   /* post process */
-   if (do_compositing) {
-   if (!winmat)
-   is_persp = rv3d->is_persp;
-   GPU_fx_do_composite_pass(fx, winmat, is_persp, scene, ofs);
-   }
+   /* post process */
+   if (do_compositing) {
+   if (!winmat)
+   is_persp = rv3d->is_persp;
+   GPU_fx_do_composite_pass(fx, winmat, is_persp, scene, 
ofs);
+   }
 
-   if ((v3d->flag2 & V3D_RENDER_SHADOW) == 0) {
-   /* draw grease-pencil stuff */
-   ED_region_pixelspace(ar);
+   if ((v3d->flag2 & V3D_RENDER_SHADOW) == 0) {
+   /* draw grease-pencil stuff */
+   ED_region_pixelspace(ar);
 
-   if (v3d->flag2 & V3D_SHOW_GPENCIL) {
-   /* draw grease-pencil stuff - needed to get 
paint-buffer shown too (since it's 2D) */
-   ED_gpencil_draw_view3d(NULL, scene, v3d, ar, false);
-   }
+   if 

[Bf-blender-cvs] [a2a436bba36] blender2.8: Update comment

2017-05-03 Thread Campbell Barton
Commit: a2a436bba36798040874a409a25b7ffddc45dac6
Author: Campbell Barton
Date:   Wed May 3 20:13:27 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBa2a436bba36798040874a409a25b7ffddc45dac6

Update comment

===

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

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 56f6b98cab4..c64e5b6403b 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -798,9 +798,12 @@ void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup 
*shgroup, const void *at
BLI_addtail(>calls, call);
 }
 
-/* Make sure you know what you do when using this,
- * State is not revert back at the end of the shgroup */
-
+/**
+ * State is added to #Pass.state while drawing.
+ * Use to temporarily enable draw options.
+ *
+ * Currently there is no way to disable (could add if needed).
+ */
 void DRW_shgroup_state_enable(DRWShadingGroup *shgroup, DRWState state)
 {
shgroup->state_extra |= state;

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


[Bf-blender-cvs] [825430c589e] blender2.8: Cleanup: move off-screen drawing to view3d_draw.c

2017-05-03 Thread Campbell Barton
Commit: 825430c589e80ee0bfd5ebdee1ce855e81ff76db
Author: Campbell Barton
Date:   Wed May 3 21:59:03 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB825430c589e80ee0bfd5ebdee1ce855e81ff76db

Cleanup: move off-screen drawing to view3d_draw.c

Since offscreen drawing now uses draw engine, this doesn't need to be
considered legacy.

Note that there are some calls into view3d_draw_legacy.c from view3d_draw.c
this is generally not accepted, so its only dont where there are checks
for new/old engine.
Functions exposed to do this use a VP_deprecated prefix.

===

M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/editors/space_view3d/view3d_intern.h

===

diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index 1f46a891e76..c00a3e2b0b7 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -35,6 +35,7 @@
 
 #include "BKE_camera.h"
 #include "BKE_context.h"
+#include "BKE_global.h"
 #include "BKE_key.h"
 #include "BKE_scene.h"
 #include "BKE_object.h"
@@ -48,6 +49,7 @@
 #include "BLI_rect.h"
 #include "BLI_string.h"
 #include "BLI_threads.h"
+#include "BLI_jitter.h"
 
 #include "BLT_translation.h"
 
@@ -72,11 +74,13 @@
 
 #include "DEG_depsgraph_query.h"
 
+#include "GPU_draw.h"
 #include "GPU_matrix.h"
 #include "GPU_immediate.h"
 #include "GPU_immediate_util.h"
 #include "GPU_material.h"
 #include "GPU_viewport.h"
+#include "GPU_compositing.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -88,6 +92,9 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
 #include "view3d_intern.h"  /* own include */
 
 /* prototypes */
@@ -2444,11 +2451,416 @@ void view3d_main_region_draw(const bContext *C, 
ARegion *ar)
v3d->flag |= V3D_INVALID_BACKBUF;
 }
 
-/*  legacy interface * */
+
+/*  */
+
+/** \name Offscreen Drawing
+ * \{ */
+
+static void view3d_stereo3d_setup_offscreen(
+Scene *scene, View3D *v3d, ARegion *ar,
+float winmat[4][4], const char *viewname)
+{
+   /* update the viewport matrices with the new camera */
+   if (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D) {
+   float viewmat[4][4];
+   const bool is_left = STREQ(viewname, STEREO_LEFT_NAME);
+
+   BKE_camera_multiview_view_matrix(>r, v3d->camera, 
is_left, viewmat);
+   VP_legacy_view3d_main_region_setup_view(scene, v3d, ar, 
viewmat, winmat);
+   }
+   else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
+   float viewmat[4][4];
+   Object *camera = BKE_camera_multiview_render(scene, 
v3d->camera, viewname);
+
+   BKE_camera_multiview_view_matrix(>r, camera, false, 
viewmat);
+   VP_legacy_view3d_main_region_setup_view(scene, v3d, ar, 
viewmat, winmat);
+   }
+}
+
+void ED_view3d_draw_offscreen_init(Scene *scene, SceneLayer *sl, View3D *v3d)
+{
+   RenderEngineType *type = RE_engines_find(scene->r.engine);
+   if (IS_VIEWPORT_LEGACY(v3d) && ((type->flag & RE_USE_LEGACY_PIPELINE) 
!= 0)) {
+   /* shadow buffers, before we setup matrices */
+   if (draw_glsl_material(scene, sl, NULL, v3d, v3d->drawtype)) {
+   VP_deprecated_gpu_update_lamps_shadows_world(scene, 
v3d);
+   }
+   }
+}
+
+/*
+ * Function to clear the view
+ */
+static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar)
+{
+   glClear(GL_DEPTH_BUFFER_BIT);
+
+   if (scene->world && (v3d->flag3 & V3D_SHOW_WORLD)) {
+   VP_view3d_draw_background_world(scene, v3d, ar->regiondata);
+   }
+   else {
+   VP_view3d_draw_background_none();
+   }
+}
+
+/* ED_view3d_draw_offscreen_init should be called before this to initialize
+ * stuff like shadow buffers
+ */
+void ED_view3d_draw_offscreen(
+Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy,
+float viewmat[4][4], float winmat[4][4],
+bool do_bgpic, bool do_sky, bool is_persp, const char *viewname,
+GPUFX *fx, GPUFXSettings *fx_settings,
+GPUOffScreen *ofs)
+{
+   bool do_compositing = false;
+   RegionView3D *rv3d = ar->regiondata;
+
+   /* set temporary new size */
+   int bwinx = ar->winx;
+   int bwiny = ar->winy;
+   rcti brect = ar->winrct;
+
+   ar->winx = winx;
+   ar->winy = winy;
+   ar->winrct.xmin = 0;
+   ar->winrct.ymin = 0;
+   ar->winrct.xmax = winx;
+   ar->winrct.ymax = winy;
+
+   struct bThemeState theme_state;
+   UI_Theme_Store(_state);
+   

[Bf-blender-cvs] [5f38a4a238f] blender2.8: Draw Manager: Enable Pose engine as part of the weight paint mode

2017-05-03 Thread Dalai Felinto
Commit: 5f38a4a238f34c9c4b1daedee27ecccacb884afe
Author: Dalai Felinto
Date:   Wed May 3 12:38:40 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB5f38a4a238f34c9c4b1daedee27ecccacb884afe

Draw Manager: Enable Pose engine as part of the weight paint mode

We still need to bring pose bone drawing for the pose engine.

Note: In the future, once we get face-widget selection, we will need to
make sure the pose engien only draws then if "weight paint mode" is not
enabled too.

===

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

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index cb7156368dc..56f6b98cab4 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2075,6 +2075,7 @@ static void DRW_engines_enable_from_mode(int mode)
use_drw_engine(_engine_sculpt_type);
break;
case CTX_MODE_PAINT_WEIGHT:
+   use_drw_engine(_engine_pose_type);
use_drw_engine(_engine_paint_weight_type);
break;
case CTX_MODE_PAINT_VERTEX:

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


[Bf-blender-cvs] [44991a01325] master: Cycles: Use render visibility for duplis when Render Layer option in viewport is used

2017-05-03 Thread Sergey Sharybin
Commit: 44991a0132507091d5d702e53e7e1561252ee19e
Author: Sergey Sharybin
Date:   Wed May 3 12:05:52 2017 +0200
Branches: master
https://developer.blender.org/rB44991a0132507091d5d702e53e7e1561252ee19e

Cycles: Use render visibility for duplis when Render Layer option in viewport 
is used

Previously the logic was different for duplis and regular objects: regular 
objects
were using render visibility when Render Layer option is enabled which duplis 
were
always using viewport visibility when rendering from the viewport.

This was quite confusing because caused different results in viewport and render
when artists were expecting them to match 1:1.

===

M   intern/cycles/blender/blender_object.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h

===

diff --git a/intern/cycles/blender/blender_object.cpp 
b/intern/cycles/blender/blender_object.cpp
index 2810ad15b9a..a930c439370 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -478,7 +478,7 @@ static bool object_render_hide_duplis(BL::Object& b_ob)
 
 /* Object Loop */
 
-void BlenderSync::sync_objects(BL::SpaceView3D& b_v3d, float motion_time)
+void BlenderSync::sync_objects(float motion_time)
 {
/* layer data */
uint scene_layer = render_layer.scene_layer;
@@ -506,7 +506,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D& b_v3d, 
float motion_time)
 * 1 : DAG_EVAL_PREVIEW
 * 2 : DAG_EVAL_RENDER
 */
-   int dupli_settings = preview ? 1 : 2;
+   int dupli_settings = (render_layer.use_viewport_visibility) ? 1 : 2;
 
bool cancel = false;
bool use_portal = false;
@@ -541,7 +541,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D& b_v3d, 
float motion_time)
for(b_ob.dupli_list.begin(b_dup); b_dup 
!= b_ob.dupli_list.end(); ++b_dup) {
Transform tfm = 
get_transform(b_dup->matrix());
BL::Object b_dup_ob = 
b_dup->object();
-   bool dup_hide = (b_v3d)? 
b_dup_ob.hide(): b_dup_ob.hide_render();
+   bool dup_hide = 
(render_layer.use_viewport_visibility)? b_dup_ob.hide(): b_dup_ob.hide_render();
bool in_dupli_group = 
(b_dup->type() == BL::DupliObject::type_GROUP);
bool hide_tris;
 
@@ -617,7 +617,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D& b_v3d, 
float motion_time)
 }
 
 void BlenderSync::sync_motion(BL::RenderSettings& b_render,
-  BL::SpaceView3D& b_v3d,
   BL::Object& b_override,
   int width, int height,
   void **python_thread_state)
@@ -654,7 +653,7 @@ void BlenderSync::sync_motion(BL::RenderSettings& b_render,
b_engine.frame_set(frame, subframe);
python_thread_state_save(python_thread_state);
sync_camera_motion(b_render, b_cam, width, height, 0.0f);
-   sync_objects(b_v3d, 0.0f);
+   sync_objects(0.0f);
}
 
/* always sample these times for camera motion */
@@ -688,7 +687,7 @@ void BlenderSync::sync_motion(BL::RenderSettings& b_render,
}
 
/* sync object */
-   sync_objects(b_v3d, relative_time);
+   sync_objects(relative_time);
}
 
/* we need to set the python thread state again because this
diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index 3b071bf0e7d..ff6c749b99d 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -210,10 +210,9 @@ void BlenderSync::sync_data(BL::RenderSettings& b_render,
   scene->need_motion() == Scene::MOTION_NONE ||
   scene->camera->motion_position == Camera::MOTION_POSITION_CENTER)
{
-   sync_objects(b_v3d);
+   sync_objects();
}
sync_motion(b_render,
-   b_v3d,
b_override,
width, height,
python_thread_state);
diff --git a/intern/cycles/blender/blender_sync.h 
b/intern/cycles/blender/blender_sync.h
index 36bedc505af..70a20400fa9 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -97,9 +97,8 @@ private:
/* sync */
void sync_lamps(bool update_all);
void sync_materials(bool update_all);
-   void sync_objects(BL::SpaceView3D& b_v3d, float motion_time = 0.0f);
+   void sync_objects(float motion_time = 0.0f);
void 

[Bf-blender-cvs] [50a7d104d29] blender2.8: Draw Manager: Fix pose mode not working well.

2017-05-03 Thread Dalai Felinto
Commit: 50a7d104d29a1d1a416126f582903fc8354f4e25
Author: Dalai Felinto
Date:   Wed May 3 12:10:51 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB50a7d104d29a1d1a416126f582903fc8354f4e25

Draw Manager: Fix pose mode not working well.

In the future this will allow us to implement things like face manipulators.

For now however, this is getting on the way of using pose mode
(mesh objects are drawn green).

NOTE: pose engine should also be the one taking care of pose bones

(and for that matter, X-Ray armature option should/could be a property
of the Pose engine even).

===

M   source/blender/draw/modes/pose_mode.c

===

diff --git a/source/blender/draw/modes/pose_mode.c 
b/source/blender/draw/modes/pose_mode.c
index 1eb9fcb6a11..176e44199b3 100644
--- a/source/blender/draw/modes/pose_mode.c
+++ b/source/blender/draw/modes/pose_mode.c
@@ -170,6 +170,10 @@ static void POSE_cache_populate(void *vedata, Object *ob)
 
UNUSED_VARS(psl, stl);
 
+   /* In the future this will allow us to implement face manipulators,
+* and similar functionalities. For now however, this is getting
+* on the way of using pose mode, so disabling it. */
+#if 0
if (ob->type == OB_MESH) {
/* Get geometry cache */
struct Batch *geom = DRW_cache_mesh_surface_get(ob);
@@ -177,6 +181,9 @@ static void POSE_cache_populate(void *vedata, Object *ob)
/* Add geom to a shading group */
DRW_shgroup_call_add(stl->g_data->group, geom, ob->obmat);
}
+#else
+   UNUSED_VARS(ob);
+#endif
 }
 
 /* Optional: Post-cache_populate callback */

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


[Bf-blender-cvs] [e0fded5d3a5] blender2.8: GPUMaterial: Force old outputs to fail with EEVEE.

2017-05-03 Thread Clément Foucault
Commit: e0fded5d3a57b3a3f2cb6b71be7290370099bfb9
Author: Clément Foucault
Date:   Tue May 2 19:56:44 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBe0fded5d3a57b3a3f2cb6b71be7290370099bfb9

GPUMaterial: Force old outputs to fail with EEVEE.

Workaround waiting for compatibility bit / or PyNodes.

===

M   source/blender/nodes/shader/nodes/node_shader_output.c
M   source/blender/nodes/shader/nodes/node_shader_output_material.c

===

diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c 
b/source/blender/nodes/shader/nodes/node_shader_output.c
index 789df09d898..ad6b4acdd48 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output.c
@@ -32,6 +32,8 @@
 
 #include "node_shader_util.h"
 
+#include "BKE_scene.h"
+
 /*  OUTPUT  */
 static bNodeSocketTemplate sh_node_output_in[] = {
{   SOCK_RGBA, 1, N_("Color"),  0.0f, 0.0f, 0.0f, 1.0f},
@@ -74,6 +76,10 @@ static int gpu_shader_output(GPUMaterial *mat, bNode 
*UNUSED(node), bNodeExecDat
GPU_material_enable_alpha(mat);
 #endif
 
+   if (BKE_scene_uses_blender_eevee(GPU_material_scene(mat))) {
+   return false;
+   }
+
GPU_stack_link(mat, "output_node", in, out, );
GPU_material_output_link(mat, outlink);
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c 
b/source/blender/nodes/shader/nodes/node_shader_output_material.c
index 336536b21ee..bbb72651ee5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c
@@ -27,6 +27,8 @@
 
 #include "../node_shader_util.h"
 
+#include "BKE_scene.h"
+
 /*  OUTPUT  */
 
 static bNodeSocketTemplate sh_node_output_material_in[] = {
@@ -40,6 +42,10 @@ static int node_shader_gpu_output_material(GPUMaterial *mat, 
bNode *UNUSED(node)
 {
GPUNodeLink *outlink;
 
+   if (BKE_scene_uses_blender_eevee(GPU_material_scene(mat))) {
+   return false;
+   }
+
GPU_stack_link(mat, "node_output_material", in, out, );
GPU_material_output_link(mat, outlink);

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


[Bf-blender-cvs] [54bde824457] blender2.8: Draw Manager: Introduce a foreach function for all shgroups in a pass.

2017-05-03 Thread Clément Foucault
Commit: 54bde8244578fc2002efa394b482ff3ff47f43fd
Author: Clément Foucault
Date:   Tue May 2 19:04:55 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB54bde8244578fc2002efa394b482ff3ff47f43fd

Draw Manager: Introduce a foreach function for all shgroups in a pass.

===

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 369f2f4f468..394f5d8d670 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -291,6 +291,7 @@ void DRW_shgroup_uniform_mat4(DRWShadingGroup *shgroup, 
const char *name, const
 
 /* Passes */
 DRWPass *DRW_pass_create(const char *name, DRWState state);
+void DRW_pass_foreach_shgroup(DRWPass *pass, void (*callback)(void *userData, 
DRWShadingGroup *shgrp), void *userData);
 
 /* Viewport */
 typedef enum {
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 8f103192ad8..cb7156368dc 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1023,6 +1023,13 @@ void DRW_pass_free(DRWPass *pass)
BLI_freelistN(>shgroups);
 }
 
+void DRW_pass_foreach_shgroup(DRWPass *pass, void (*callback)(void *userData, 
DRWShadingGroup *shgrp), void *userData)
+{
+   for (DRWShadingGroup *shgroup = pass->shgroups.first; shgroup; shgroup 
= shgroup->next) {
+   callback(userData, shgroup);
+   }
+}
+
 /** \} */

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


[Bf-blender-cvs] [a7404958148] blender2.8: Eevee: Add "uber" Shader Output Nodes.

2017-05-03 Thread Clément Foucault
Commit: a7404958148f1030483c7d6238ebf48abc26cf24
Author: Clément Foucault
Date:   Tue May 2 19:25:25 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBa7404958148f1030483c7d6238ebf48abc26cf24

Eevee: Add "uber" Shader Output Nodes.

Include Metallic and Specular workflow.
Clearcoat and are not implemented yet.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.c
M   source/blender/draw/engines/eevee/eevee_engine.c
M   source/blender/draw/engines/eevee/eevee_private.h
M   source/blender/draw/engines/eevee/shaders/default_frag.glsl
M   source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
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_metallic.c
A   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 bee6ae80590..2e2684a0524 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -216,6 +216,8 @@ 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("ShaderNodeOutputLamp", poll=object_shader_nodes_poll),
 NodeItem("ShaderNodeOutputWorld", poll=world_shader_nodes_poll),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 219bca0a1a9..42d62297243 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -794,6 +794,8 @@ struct ShadeResult;
 #define SH_NODE_UVALONGSTROKE  191
 #define SH_NODE_TEX_POINTDENSITY   192
 #define SH_NODE_BSDF_PRINCIPLED 193
+#define SH_NODE_OUTPUT_METALLIC194
+#define SH_NODE_OUTPUT_SPECULAR195
 
 /* 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 4b7dcc1b9b5..7c382bccfc9 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3588,6 +3588,8 @@ static void registerShaderNodes(void)
 
register_node_type_sh_output_lamp();
register_node_type_sh_output_material();
+   register_node_type_sh_output_metallic();
+   register_node_type_sh_output_specular();
register_node_type_sh_output_world();
register_node_type_sh_output_linestyle();
 
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c 
b/source/blender/draw/engines/eevee/eevee_engine.c
index 01849678366..6572abde728 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -490,20 +490,8 @@ static void EEVEE_cache_init(void *vedata)
{
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL;
psl->material_pass = DRW_pass_create("Material Shader Pass", 
state);
-
-   /* NOTE : this shading grp does not contain any geom, it's just 
here to setup uniforms & textures. */
-   stl->g_data->material_lit_grp = 
DRW_shgroup_create(e_data.default_lit, psl->material_pass);
-   DRW_shgroup_uniform_block(stl->g_data->material_lit_grp, 
"light_block", stl->light_ubo, 0);
-   DRW_shgroup_uniform_block(stl->g_data->material_lit_grp, 
"shadow_block", stl->shadow_ubo, 1);
-   DRW_shgroup_uniform_int(stl->g_data->material_lit_grp, 
"light_count", >lamps->num_light, 1);
-   DRW_shgroup_uniform_float(stl->g_data->material_lit_grp, 
"lodMax", >probes->lodmax, 1);
-   DRW_shgroup_uniform_vec3(stl->g_data->material_lit_grp, 
"shCoefs[0]", (float *)stl->probes->shcoefs, 9);
-   DRW_shgroup_uniform_vec3(stl->g_data->material_lit_grp, 
"cameraPos", e_data.camera_pos, 1);
-   DRW_shgroup_uniform_texture(stl->g_data->material_lit_grp, 
"ltcMat", e_data.ltc_mat, 0);
-   DRW_shgroup_uniform_texture(stl->g_data->material_lit_grp, 
"brdfLut", e_data.brdf_lut, 1);
-   DRW_shgroup_uniform_texture(stl->g_data->material_lit_grp, 
"probeFiltered", txl->probe_pool, 2);
-   /* NOTE : Adding Shadow Map textures 

[Bf-blender-cvs] [5570ba9c4f2] blender2.8: NodeTree: Add eevee default shader tree.

2017-05-03 Thread Clément Foucault
Commit: 5570ba9c4f2cee25a1d366c754682996040d58a9
Author: Clément Foucault
Date:   Tue May 2 19:55:02 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB5570ba9c4f2cee25a1d366c754682996040d58a9

NodeTree: Add eevee default shader tree.

===

M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/editors/space_node/node_edit.c

===

diff --git a/source/blender/blenkernel/BKE_scene.h 
b/source/blender/blenkernel/BKE_scene.h
index ba2b7160408..454fba0126e 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -153,6 +153,7 @@ bool BKE_scene_use_spherical_stereo(struct Scene *scene);
 
 bool BKE_scene_uses_blender_internal(const struct Scene *scene);
 bool BKE_scene_uses_blender_game(const struct Scene *scene);
+bool BKE_scene_uses_blender_eevee(const struct Scene *scene);
 
 void BKE_scene_disable_color_management(struct Scene *scene);
 bool BKE_scene_check_color_management_enabled(const struct Scene *scene);
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index b963dbf89fa..b2ed9668c31 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -111,6 +111,7 @@
 const char *RE_engine_id_BLENDER_RENDER = "BLENDER_RENDER";
 const char *RE_engine_id_BLENDER_GAME = "BLENDER_GAME";
 const char *RE_engine_id_BLENDER_CLAY = "BLENDER_CLAY";
+const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";
 const char *RE_engine_id_CYCLES = "CYCLES";
 
 void free_avicodecdata(AviCodecData *acd)
@@ -1791,6 +1792,11 @@ bool BKE_scene_uses_blender_game(const Scene *scene)
return STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME);
 }
 
+bool BKE_scene_uses_blender_eevee(const Scene *scene)
+{
+   return STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE);
+}
+
 void BKE_scene_base_flag_to_objects(SceneLayer *sl)
 {
Base *base = sl->object_bases.first;
diff --git a/source/blender/editors/space_node/node_edit.c 
b/source/blender/editors/space_node/node_edit.c
index fdfe316f5ed..fc3180680f8 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -397,6 +397,14 @@ void ED_node_shader_default(const bContext *C, ID *id)
Material *ma = (Material *)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;
+   }
+
if (BKE_scene_use_new_shading_nodes(scene)) {
output_type = SH_NODE_OUTPUT_MATERIAL;
shader_type = SH_NODE_BSDF_DIFFUSE;

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


[Bf-blender-cvs] [b08fc83d1da] blender2.8: Eevee: Fix Lamp Roughness.

2017-05-03 Thread Clément Foucault
Commit: b08fc83d1da8cf51bacaec10a82dbc6cdef9db43
Author: Clément Foucault
Date:   Tue May 2 20:33:59 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBb08fc83d1da8cf51bacaec10a82dbc6cdef9db43

Eevee: Fix Lamp Roughness.

===

M   source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl

===

diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl 
b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
index 0d96b7768dc..b0a99d8e72b 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
@@ -233,6 +233,8 @@ float light_common(inout LightData ld, inout ShadingData sd)
 
 vec3 eevee_surface_lit(vec3 world_normal, vec3 albedo, vec3 f0, float 
roughness, float ao)
 {
+   float roughnessSquared = roughness * roughness;
+
ShadingData sd;
sd.N = normalize(world_normal);
sd.V = (ProjectionMatrix[3][3] == 0.0) /* if perspective */
@@ -240,7 +242,7 @@ vec3 eevee_surface_lit(vec3 world_normal, vec3 albedo, vec3 
f0, float roughness,
: normalize(eye);
sd.W = worldPosition;
sd.R = reflect(-sd.V, sd.N);
-   sd.spec_dominant_dir = get_specular_dominant_dir(sd.N, sd.R, roughness);
+   sd.spec_dominant_dir = get_specular_dominant_dir(sd.N, sd.R, 
roughnessSquared);
 
vec3 radiance = vec3(0.0);
vec3 indirect_radiance = vec3(0.0);
@@ -255,7 +257,7 @@ vec3 eevee_surface_lit(vec3 world_normal, vec3 albedo, vec3 
f0, float roughness,
light_common(ld, sd);
 
float vis = light_visibility(ld, sd);
-   vec3 spec = light_specular(ld, sd, roughness, f0);
+   vec3 spec = light_specular(ld, sd, roughnessSquared, f0);
vec3 diff = light_diffuse(ld, sd, albedo);
 
radiance += vis * (diff + spec) * ld.l_color;

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


[Bf-blender-cvs] [bde44994967] blender2.8: Fix draw manager w/ cycles

2017-05-03 Thread Campbell Barton
Commit: bde449949678ab14d70509e3f69b4fafa24cfcb6
Author: Campbell Barton
Date:   Wed May 3 20:09:17 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBbde449949678ab14d70509e3f69b4fafa24cfcb6

Fix draw manager w/ cycles

8b2640f08 introduced the error,
caused by external-engine needing depth mask to be disabled,
which happened to be the case before changing state changing logic.

===

M   source/blender/draw/engines/external/external_engine.c
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/engines/external/external_engine.c 
b/source/blender/draw/engines/external/external_engine.c
index 34ca92038d1..5c7f507b34b 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -146,6 +146,8 @@ static void external_draw_scene(void *UNUSED(vedata))
ARegion *ar = draw_ctx->ar;
RenderEngineType *type;
 
+   DRW_state_reset_ex(DRW_STATE_DEFAULT & ~DRW_STATE_DEPTH_LESS);
+
/* Create render engine. */
if (!rv3d->render_engine) {
RenderEngine *engine;
diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 53fbd22e7ab..369f2f4f468 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -249,6 +249,8 @@ typedef enum {
DRW_STATE_TEST_STENCIL_ACTIVE  = (1 << 17),
 } DRWState;
 
+#define DRW_STATE_DEFAULT (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | 
DRW_STATE_DEPTH_LESS)
+
 
 DRWShadingGroup *DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass);
 DRWShadingGroup *DRW_shgroup_material_create(struct GPUMaterial *material, 
DRWPass *pass);
@@ -324,6 +326,7 @@ void DRW_draw_text_cache_queue(struct DRWTextStore *dt);
 void DRW_draw_callbacks_pre_scene(void);
 void DRW_draw_callbacks_post_scene(void);
 
+void DRW_state_reset_ex(DRWState state);
 void DRW_state_reset(void);
 
 /* Selection */
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 196f239119e..8f103192ad8 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1527,16 +1527,17 @@ void DRW_draw_callbacks_post_scene(void)
 }
 
 /* Reset state to not interfer with other UI drawcall */
-void DRW_state_reset(void)
+void DRW_state_reset_ex(DRWState state)
 {
-   DRWState state =
-   DRW_STATE_WRITE_DEPTH |
-   DRW_STATE_WRITE_COLOR |
-   DRW_STATE_DEPTH_LESS;
DST.state = ~state;
DRW_state_set(state);
 }
 
+void DRW_state_reset(void)
+{
+   DRW_state_reset_ex(DRW_STATE_DEFAULT);
+}
+
 /** \} */

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


[Bf-blender-cvs] [2a860829459] blender2.8: Validate collection properties at readile

2017-05-03 Thread Dalai Felinto
Commit: 2a8608294597f82add9c69b64bc11b9c492d46ac
Author: Dalai Felinto
Date:   Wed May 3 11:38:17 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB2a8608294597f82add9c69b64bc11b9c492d46ac

Validate collection properties at readile

The alternative would be to do version bump + doversioning every
time a new property is added.

===

M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/intern/blender.c
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_280.c

===

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index c75f9fb818d..a54cce73c7f 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -57,6 +57,8 @@ struct Scene;
 struct SceneCollection;
 struct SceneLayer;
 
+void BKE_layer_exit(void);
+
 struct SceneLayer *BKE_scene_layer_render_active(const struct Scene *scene);
 struct SceneLayer *BKE_scene_layer_context_active(const struct Scene *scene);
 struct SceneLayer *BKE_scene_layer_add(struct Scene *scene, const char *name);
@@ -113,6 +115,7 @@ struct IDProperty *BKE_scene_collection_engine_get(struct 
Scene *scene, const in
 void BKE_layer_collection_engine_settings_callback_register(struct Main 
*bmain, const char *engine_name, CollectionEngineSettingsCB func);
 void BKE_layer_collection_engine_settings_callback_free(void);
 void BKE_layer_collection_engine_settings_create(struct IDProperty *root);
+void BKE_layer_collection_engine_settings_validate(struct Scene *scene);
 
 void BKE_collection_engine_property_add_float(struct IDProperty *props, const 
char *name, float value);
 void BKE_collection_engine_property_add_int(struct IDProperty *props, const 
char *name, int value);
diff --git a/source/blender/blenkernel/intern/blender.c 
b/source/blender/blenkernel/intern/blender.c
index e85cb5d0ab6..ebb10c02683 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -54,6 +54,7 @@
 #include "BKE_global.h"
 #include "BKE_idprop.h"
 #include "BKE_image.h"
+#include "BKE_layer.h"
 #include "BKE_library.h"
 #include "BKE_node.h"
 #include "BKE_report.h"
@@ -97,6 +98,8 @@ void BKE_blender_free(void)
 
BKE_sequencer_cache_destruct();
IMB_moviecache_destruct();
+
+   BKE_layer_exit();

free_nodesystem();
 }
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index b74b6ac7e6b..d9398ae83c7 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1253,6 +1253,55 @@ void 
BKE_layer_collection_engine_settings_create(IDProperty *root)
collection_engine_settings_init(root, true);
 }
 
+/**
+ * Reference of IDProperty group scene collection settings
+ * Used when reading blendfiles, to see if there is any missing settings.
+ */
+static IDProperty *root_reference = NULL;
+
+/**
+ * Free the reference scene collection settings IDProperty group.
+ */
+static void layer_collection_engine_settings_validate_init(void)
+{
+   if (root_reference == NULL) {
+   IDPropertyTemplate val = {0};
+   root_reference = IDP_New(IDP_GROUP, , ROOT_PROP);
+   BKE_layer_collection_engine_settings_create(root_reference);
+   }
+}
+
+/**
+ * Free the reference scene collection settings IDProperty group.
+ */
+static void layer_collection_engine_settings_validate_free(void)
+{
+   if (root_reference != NULL) {
+   IDP_FreeProperty(root_reference);
+   MEM_freeN(root_reference);
+   root_reference = NULL;
+   }
+}
+
+/**
+ * Make sure Scene has all required collection settings.
+ */
+void BKE_layer_collection_engine_settings_validate(Scene *scene)
+{
+   if (root_reference == NULL) {
+   layer_collection_engine_settings_validate_init();
+   }
+
+   if (scene->collection_properties == NULL) {
+   IDPropertyTemplate val = {0};
+   scene->collection_properties = IDP_New(IDP_GROUP, , 
ROOT_PROP);
+   
BKE_layer_collection_engine_settings_create(scene->collection_properties);
+   }
+   else {
+   IDP_MergeGroup(scene->collection_properties, root_reference, 
false);
+   }
+}
+
 /* -- */
 /* Iterators */
 
@@ -1464,3 +1513,11 @@ void BKE_layer_eval_layer_collection_post(struct 
EvaluationContext *UNUSED(eval_
}
}
 }
+
+/**
+ * Free any static allocated memory.
+ */
+void BKE_layer_exit()
+{
+   layer_collection_engine_settings_validate_free();
+}
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c

[Bf-blender-cvs] [66c74242bba] blender2.8: Make IDP_MergeGroup recursive

2017-05-03 Thread Dalai Felinto
Commit: 66c74242bba3c2962ff5c3ddc02409171ec86dc3
Author: Dalai Felinto
Date:   Wed May 3 11:37:24 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB66c74242bba3c2962ff5c3ddc02409171ec86dc3

Make IDP_MergeGroup recursive

With this we also do not need IDP_MergeGroupValues anymore.
If this causes problems in the future we can always make recursion an
option (like overwrite is).

===

M   source/blender/blenkernel/BKE_idprop.h
M   source/blender/blenkernel/intern/idprop.c
M   source/blender/blenkernel/intern/layer.c

===

diff --git a/source/blender/blenkernel/BKE_idprop.h 
b/source/blender/blenkernel/BKE_idprop.h
index 1f44719e2d3..ab8728faedb 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -91,7 +91,6 @@ void IDP_ReplaceGroupInGroup(struct IDProperty *dest, const 
struct IDProperty *s
 void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop) 
ATTR_NONNULL();
 void IDP_ReplaceInGroup_ex(struct IDProperty *group, struct IDProperty *prop, 
struct IDProperty *prop_exist);
 void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool 
do_overwrite) ATTR_NONNULL();
-void IDP_MergeGroupValues(IDProperty *dest, IDProperty *src);
 bool IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop) 
ATTR_NONNULL();
 bool IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
   struct IDProperty *pnew) ATTR_NONNULL(1 /* group */, 3 
/* pnew */);
diff --git a/source/blender/blenkernel/intern/idprop.c 
b/source/blender/blenkernel/intern/idprop.c
index 27f7cac2a8e..a3bd15252cb 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -600,32 +600,8 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty 
*prop)
 }
 
 /**
- * Same as IDP_MergeGroup but recursively
- */
-void IDP_MergeGroupValues(IDProperty *dest, IDProperty *src)
-{
-   IDProperty *prop;
-
-   BLI_assert(dest->type == IDP_GROUP);
-   BLI_assert(src->type == IDP_GROUP);
-
-   for (prop = src->data.group.first; prop; prop = prop->next) {
-   if (prop->type == IDP_GROUP) {
-   IDProperty *prop_exist = IDP_GetPropertyFromGroup(dest, 
prop->name);
-
-   if (prop_exist != NULL) {
-   IDP_MergeGroupValues(prop_exist, prop);
-   continue;
-   }
-   }
-
-   IDProperty *copy = IDP_CopyProperty(prop);
-   IDP_ReplaceInGroup(dest, copy);
-   }
-}
-
-/**
  * If a property is missing in \a dest, add it.
+ * Do it recursively.
  */
 void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool 
do_overwrite)
 {
@@ -636,13 +612,29 @@ void IDP_MergeGroup(IDProperty *dest, const IDProperty 
*src, const bool do_overw
 
if (do_overwrite) {
for (prop = src->data.group.first; prop; prop = prop->next) {
+   if (prop->type == IDP_GROUP) {
+   IDProperty *prop_exist = 
IDP_GetPropertyFromGroup(dest, prop->name);
+
+   if (prop_exist != NULL) {
+   IDP_MergeGroup(prop_exist, prop, 
do_overwrite);
+   continue;
+   }
+   }
+
IDProperty *copy = IDP_CopyProperty(prop);
IDP_ReplaceInGroup(dest, copy);
}
}
else {
for (prop = src->data.group.first; prop; prop = prop->next) {
-   if (IDP_GetPropertyFromGroup(dest, prop->name) == NULL) 
{
+   IDProperty *prop_exist = IDP_GetPropertyFromGroup(dest, 
prop->name);
+   if (prop_exist != NULL) {
+   if (prop->type == IDP_GROUP) {
+   IDP_MergeGroup(prop_exist, prop, 
do_overwrite);
+   continue;
+   }
+   }
+   else {
IDProperty *copy = IDP_CopyProperty(prop);
dest->len++;
BLI_addtail(>data.group, copy);
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 6442c53635d..b74b6ac7e6b 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1391,7 +1391,7 @@ static void idproperty_reset(IDProperty **props, 
IDProperty *props_ref)
*props = IDP_New(IDP_GROUP, , ROOT_PROP);
 
if (props_ref) {
-   IDP_MergeGroupValues(*props, props_ref);
+   IDP_MergeGroup(*props, props_ref, 

[Bf-blender-cvs] [e616cd5706e] master: Cycles: Add utility function to convert float4 color from srgb to linear

2017-05-03 Thread Sergey Sharybin
Commit: e616cd5706ef359aaed481db2e4d31a3fe16cd3b
Author: Sergey Sharybin
Date:   Wed May 3 11:19:40 2017 +0200
Branches: master
https://developer.blender.org/rBe616cd5706ef359aaed481db2e4d31a3fe16cd3b

Cycles: Add utility function to convert float4 color from srgb to linear

It will use SSE2 optimized version when is possible.

===

M   intern/cycles/util/util_color.h

===

diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h
index 4d673dc34d8..114f0f9bf79 100644
--- a/intern/cycles/util/util_color.h
+++ b/intern/cycles/util/util_color.h
@@ -158,16 +158,7 @@ ccl_device float3 xyz_to_rgb(float x, float y, float z)
 }
 
 #ifndef __KERNEL_OPENCL__
-
-ccl_device float3 color_srgb_to_scene_linear(float3 c)
-{
-   return make_float3(
-   color_srgb_to_scene_linear(c.x),
-   color_srgb_to_scene_linear(c.y),
-   color_srgb_to_scene_linear(c.z));
-}
-
-#ifdef __KERNEL_SSE2__
+#  ifdef __KERNEL_SSE2__
 /*
  * Calculate initial guess for arg^exp based on float representation
  * This method gives a constant bias, which can be easily compensated by 
multiplication with bias_coeff.
@@ -222,17 +213,40 @@ ccl_device ssef color_srgb_to_scene_linear(const ssef )
ssef gte = fastpow24(gtebase);
return select(cmp, lt, gte);
 }
+#  endif  /* __KERNEL_SSE2__ */
+
+ccl_device float3 color_srgb_to_scene_linear(float3 c)
+{
+   return make_float3(color_srgb_to_scene_linear(c.x),
+  color_srgb_to_scene_linear(c.y),
+  color_srgb_to_scene_linear(c.z));
+}
+
+ccl_device float4 color_srgb_to_scene_linear(float4 c)
+{
+#ifdef __KERNEL_SSE2__
+   ssef r_ssef;
+   float4  = (float4 &)r_ssef;
+   r = c;
+   r_ssef = color_srgb_to_scene_linear(r_ssef);
+   r.w = c.w;
+   return r;
+#else
+   return make_float4(color_srgb_to_scene_linear(c.x),
+  color_srgb_to_scene_linear(c.y),
+  color_srgb_to_scene_linear(c.z),
+  c.w);
 #endif
+}
 
 ccl_device float3 color_scene_linear_to_srgb(float3 c)
 {
-   return make_float3(
-   color_scene_linear_to_srgb(c.x),
-   color_scene_linear_to_srgb(c.y),
-   color_scene_linear_to_srgb(c.z));
+   return make_float3(color_scene_linear_to_srgb(c.x),
+  color_scene_linear_to_srgb(c.y),
+  color_scene_linear_to_srgb(c.z));
 }
 
-#endif
+#endif  /* __KERNEL_OPENCL__ */
 
 ccl_device float linear_rgb_to_gray(float3 c)
 {

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


[Bf-blender-cvs] [cea0236026b] master: Cycles: Simplify code in SVM image by using new utility function

2017-05-03 Thread Sergey Sharybin
Commit: cea0236026bf5c547534afe5a875255a1857ebab
Author: Sergey Sharybin
Date:   Wed May 3 11:22:27 2017 +0200
Branches: master
https://developer.blender.org/rBcea0236026bf5c547534afe5a875255a1857ebab

Cycles: Simplify code in SVM image by using new utility function

Can not measure any performance difference, so seems the code is identical
and just shorter.

===

M   intern/cycles/kernel/svm/svm_image.h

===

diff --git a/intern/cycles/kernel/svm/svm_image.h 
b/intern/cycles/kernel/svm/svm_image.h
index 4b5e4ebac00..9d781b9cfec 100644
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@ -32,13 +32,7 @@ CCL_NAMESPACE_BEGIN
 ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float 
y, uint srgb, uint use_alpha)
 {
 #ifdef __KERNEL_CPU__
-#  ifdef __KERNEL_SSE2__
-   ssef r_ssef;
-   float4  = (float4 &)r_ssef;
-   r = kernel_tex_image_interp(id, x, y);
-#  else
float4 r = kernel_tex_image_interp(id, x, y);
-#  endif
 #elif defined(__KERNEL_OPENCL__)
float4 r = kernel_tex_image_interp(kg, id, x, y);
 #else
@@ -152,7 +146,10 @@ ccl_device float4 svm_image_texture(KernelGlobals *kg, int 
id, float x, float y,
CUtexObject tex = kernel_tex_fetch(__bindless_mapping, id);
/* float4, byte4 and half4 */
const int texture_type = kernel_tex_type(id);
-   if(texture_type == IMAGE_DATA_TYPE_FLOAT4 || texture_type == 
IMAGE_DATA_TYPE_BYTE4 || texture_type == IMAGE_DATA_TYPE_HALF4) {
+   if(texture_type == IMAGE_DATA_TYPE_FLOAT4 ||
+  texture_type == IMAGE_DATA_TYPE_BYTE4 ||
+  texture_type == IMAGE_DATA_TYPE_HALF4)
+   {
r = kernel_tex_image_interp_float4(tex, x, y);
}
/* float, byte and half */
@@ -163,43 +160,22 @@ ccl_device float4 svm_image_texture(KernelGlobals *kg, 
int id, float x, float y,
 #  endif
 #endif
 
-#ifdef __KERNEL_SSE2__
-   float alpha = r.w;
+   const float alpha = r.w;
 
if(use_alpha && alpha != 1.0f && alpha != 0.0f) {
-   r_ssef = r_ssef / ssef(alpha);
+   r /= alpha;
const int texture_type = kernel_tex_type(id);
-   if(texture_type == IMAGE_DATA_TYPE_BYTE4 || texture_type == 
IMAGE_DATA_TYPE_BYTE) {
-   r_ssef = min(r_ssef, ssef(1.0f));
+   if(texture_type == IMAGE_DATA_TYPE_BYTE4 ||
+  texture_type == IMAGE_DATA_TYPE_BYTE)
+   {
+   r = min(r, make_float4(1.0f, 1.0f, 1.0f, 1.0f));
}
r.w = alpha;
}
 
if(srgb) {
-   r_ssef = color_srgb_to_scene_linear(r_ssef);
-   r.w = alpha;
+   r = color_srgb_to_scene_linear(r);
}
-#else
-   if(use_alpha && r.w != 1.0f && r.w != 0.0f) {
-   float invw = 1.0f/r.w;
-   r.x *= invw;
-   r.y *= invw;
-   r.z *= invw;
-   
-   const int texture_type = kernel_tex_type(id);
-   if(texture_type == IMAGE_DATA_TYPE_BYTE4 || texture_type == 
IMAGE_DATA_TYPE_BYTE) {
-   r.x = min(r.x, 1.0f);
-   r.y = min(r.y, 1.0f);
-   r.z = min(r.z, 1.0f);
-   }
-   }
-
-   if(srgb) {
-   r.x = color_srgb_to_scene_linear(r.x);
-   r.y = color_srgb_to_scene_linear(r.y);
-   r.z = color_srgb_to_scene_linear(r.z);
-   }
-#endif
 
return r;
 }

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


[Bf-blender-cvs] [bf0ac873ba1] blender2.8: Fix crash loading files where outliner treestore isn't set

2017-05-03 Thread Campbell Barton
Commit: bf0ac873ba13996756f0b553c41ea36097a6dec3
Author: Campbell Barton
Date:   Wed May 3 18:10:18 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBbf0ac873ba13996756f0b553c41ea36097a6dec3

Fix crash loading files where outliner treestore isn't set

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 58724459a45..476439dfe77 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -193,6 +193,11 @@ void do_versions_after_linking_280(Main *main)
soutliner->outlinevis = 
SO_ACT_LAYER;
 
if 
(BLI_listbase_count_ex(>layer_collections, 2) == 1) {
+   if 
(soutliner->treestore == NULL) {
+   
soutliner->treestore = BLI_mempool_create(
+   
sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
+   }
+
/* Create a tree store 
element for the collection. This is normally
 * done in 
check_persistent (outliner_tree.c), but we need to access
 * it here :/ (expand 
element if it's the only one) */

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


[Bf-blender-cvs] [d116932f3a6] blender2.8: Add BBone and Wire Armature draw types to DrawManager.

2017-05-03 Thread Bastien Montagne
Commit: d116932f3a6cf081cd55aba11b4baf32b998a4d2
Author: Bastien Montagne
Date:   Wed May 3 08:34:24 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBd116932f3a6cf081cd55aba11b4baf32b998a4d2

Add BBone and Wire Armature draw types to DrawManager.

Most of this was copying/adapting code from octahedral existing draw
code, tough part was to get BBone matrices to behave as expected, they
are using a fairly specific setup...

Addresses T51365 and T51362.

===

M   source/blender/blenkernel/intern/action.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/draw/intern/draw_armature.c
M   source/blender/draw/intern/draw_cache.c
M   source/blender/draw/intern/draw_cache.h
M   source/blender/makesdna/DNA_action_types.h

===

diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 6ecbc3e7bde..44ee9aa7bf1 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -579,6 +579,8 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, const bool 
copy_constraints)
if (pchan->prop) {
pchan->prop = IDP_CopyProperty(pchan->prop);
}
+
+   pchan->bbone_matrices = NULL;  /* Drawing cache of bbone 
matrices, no need to copy. */
}
 
/* for now, duplicate Bone Groups too when doing this */
@@ -767,6 +769,9 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool 
do_id_user)
IDP_FreeProperty(pchan->prop);
MEM_freeN(pchan->prop);
}
+
+   /* Cached bbone matrices, for new draw manager rendering code. */
+   MEM_SAFE_FREE(pchan->bbone_matrices);
 }
 
 void BKE_pose_channel_free(bPoseChannel *pchan)
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index e5d5e20c8f2..b7a8e85a93d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5064,6 +5064,8 @@ static void direct_link_pose(FileData *fd, bPose *pose)

/* in case this value changes in future, clamp else we get 
undefined behavior */
CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
+
+   pchan->bbone_matrices = NULL;
}
pose->ikdata = NULL;
if (pose->ikparam != NULL) {
diff --git a/source/blender/draw/intern/draw_armature.c 
b/source/blender/draw/intern/draw_armature.c
index db153a4803c..9bc19443499 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -75,6 +75,9 @@ static struct {
/* Reset when changing current_armature */
DRWShadingGroup *bone_octahedral_solid;
DRWShadingGroup *bone_octahedral_wire;
+   DRWShadingGroup *bone_box_solid;
+   DRWShadingGroup *bone_box_wire;
+   DRWShadingGroup *bone_wire_wire;
DRWShadingGroup *bone_point_solid;
DRWShadingGroup *bone_point_wire;
DRWShadingGroup *bone_axes;
@@ -110,6 +113,38 @@ static void DRW_shgroup_bone_octahedral_wire(const float 
(*bone_mat)[4], const f
DRW_shgroup_call_dynamic_add(g_data.bone_octahedral_wire, bone_mat, 
color);
 }
 
+/* Box / B-Bone */
+static void DRW_shgroup_bone_box_solid(const float (*bone_mat)[4], const float 
color[4])
+{
+   if (g_data.bone_box_solid == NULL) {
+   struct Batch *geom = DRW_cache_bone_box_get();
+   g_data.bone_box_solid = 
shgroup_instance_objspace_solid(g_data.bone_solid, geom, g_data.ob->obmat);
+   }
+
+   DRW_shgroup_call_dynamic_add(g_data.bone_box_solid, bone_mat, color);
+}
+
+static void DRW_shgroup_bone_box_wire(const float (*bone_mat)[4], const float 
color[4])
+{
+   if (g_data.bone_box_wire == NULL) {
+   struct Batch *geom = DRW_cache_bone_box_wire_outline_get();
+   g_data.bone_box_wire = 
shgroup_instance_objspace_wire(g_data.bone_wire, geom, g_data.ob->obmat);
+   }
+
+   DRW_shgroup_call_dynamic_add(g_data.bone_box_wire, bone_mat, color);
+}
+
+/* Wire */
+static void DRW_shgroup_bone_wire_wire(const float (*bone_mat)[4], const float 
color[4])
+{
+   if (g_data.bone_wire_wire == NULL) {
+   struct Batch *geom = DRW_cache_bone_wire_wire_outline_get();
+   g_data.bone_wire_wire = 
shgroup_instance_objspace_wire(g_data.bone_wire, geom, g_data.ob->obmat);
+   }
+
+   DRW_shgroup_call_dynamic_add(g_data.bone_wire_wire, bone_mat, color);
+}
+
 /* Custom (geometry) */
 
 static void DRW_shgroup_bone_custom_solid(const float (*bone_mat)[4], const 
float color[4], Object *custom)
@@ -351,6 +386,153 @@ static void draw_bone_update_disp_matrix_default(EditBone 
*eBone, bPoseChannel *
translate_m4(disp_tail_mat, 0.0f, 1.0f, 0.0f);
 }
 
+/* XXX Direct