[Bf-blender-cvs] [ced7dd7] soc-2016-multiview: Merge branch 'master' into soc-2016-multiview

2016-06-08 Thread Tianwei Shen
Commit: ced7dd74a70790eaaa5afd6c40c45415e133d8ff
Author: Tianwei Shen
Date:   Thu Jun 9 09:49:48 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rBced7dd74a70790eaaa5afd6c40c45415e133d8ff

Merge branch 'master' into soc-2016-multiview

===



===



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


[Bf-blender-cvs] [451031f] soc-2016-layer_manager: Use new, fast and simple array iterator instead of recursive iterator

2016-06-08 Thread Julian Eisel
Commit: 451031f1904c27ceac0b1660fcd52e2b0aaf3a81
Author: Julian Eisel
Date:   Thu Jun 9 00:22:32 2016 +0200
Branches: soc-2016-layer_manager
https://developer.blender.org/rB451031f1904c27ceac0b1660fcd52e2b0aaf3a81

Use new, fast and simple array iterator instead of recursive iterator

Group positioning needs to be fixed after this, will check soon.

===

M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/intern/layer.c
M   source/blender/editors/space_layers/layers_draw.c
M   source/blender/editors/space_layers/layers_intern.h
M   source/blender/editors/space_layers/layers_ops.c
M   source/blender/editors/space_layers/layers_util.c

===

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index e6896cf..81cd051 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -58,8 +58,12 @@ void BKE_layertree_delete(LayerTree *ltree);
 bool BKE_layertree_iterate(const LayerTree *ltree, LayerTreeIterFunc foreach, 
void *customdata, const bool inverse);
 int  BKE_layertree_get_totitems(const LayerTree *ltree);
 
-#define BKE_LAYERTREE_ITER_START(ltree, idx_name, litem_name) \
-   for (int idx_name = 0; idx_name < BKE_layertree_get_totitems(ltree); 
idx_name++) { \
+/**
+ * Macro to iterate over all layer items of a tree.
+ * Don't call #BKE_layeritem_remove inside, it will mess up iteration.
+ */
+#define BKE_LAYERTREE_ITER_START(ltree, start_at, idx_name, litem_name) \
+   for (int idx_name = start_at; idx_name < 
BKE_layertree_get_totitems(ltree); idx_name++) { \
LayerTreeItem *litem_name = ltree->items_all[idx_name];
 #define BKE_LAYERTREE_ITER_END } (void)0
 
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index c12ea80..4b346c7 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -63,7 +63,7 @@ LayerTree *BKE_layertree_new(const eLayerTree_Type type)
 
 void BKE_layertree_delete(LayerTree *ltree)
 {
-   BKE_LAYERTREE_ITER_START(ltree, i, litem)
+   BKE_LAYERTREE_ITER_START(ltree, 0, i, litem)
{
/* layeritem_free does all we need in this case. No 
un-registering needed */
layeritem_free(litem);
diff --git a/source/blender/editors/space_layers/layers_draw.c 
b/source/blender/editors/space_layers/layers_draw.c
index d08a79b..29498a9 100644
--- a/source/blender/editors/space_layers/layers_draw.c
+++ b/source/blender/editors/space_layers/layers_draw.c
@@ -66,40 +66,28 @@ static int layer_tile_indent_level_get(const LayerTreeItem 
*litem)
return indent_level;
 }
 
-typedef struct TileDrawInfo {
-   const bContext *C;
-   ARegion *ar;
-   SpaceLayers *slayer;
-   uiBlock *block;
-   uiStyle *style;
-
-   float size_y;
-   int idx;
-} TileDrawInfo;
-
-static bool layer_tile_draw_cb(LayerTreeItem *litem, void *userdata)
+/**
+ * Draw the tile for \a litem.
+ * \return the height of the drawn tile.
+ */
+static float layer_tile_draw(
+LayerTreeItem *litem,
+const bContext *C, ARegion *ar, SpaceLayers *slayer, uiBlock *block, 
uiStyle *style,
+float ofs_y, int idx)
 {
-   if (!litem->draw)
-   return true; /* skip this item, but continue iterating */
-
-   TileDrawInfo *drawinfo = userdata;
-   View2D *v2d = &drawinfo->ar->v2d;
-   LayerTile *tile = BLI_ghash_lookup(drawinfo->slayer->tiles, litem);
+   LayerTile *tile = BLI_ghash_lookup(slayer->tiles, litem);
const bool expanded = litem->draw_settings && (tile->flag & 
LAYERTILE_EXPANDED);
 
const float pad_x = 4.0f * UI_DPI_FAC;
const float header_y = LAYERTILE_HEADER_HEIGHT;
 
const float ofs_x = layer_tile_indent_level_get(litem) * 
LAYERITEM_INDENT_SIZE;
-   const float ofs_y = drawinfo->size_y;
-   const rctf rect = {-v2d->cur.xmin + ofs_x, drawinfo->ar->winx,
-  -v2d->cur.ymin - ofs_y - header_y, -v2d->cur.ymin - 
ofs_y};
+   const rctf rect = {-ar->v2d.cur.xmin + ofs_x, ar->winx,
+  -ar->v2d.cur.ymin - ofs_y - header_y, 
-ar->v2d.cur.ymin - ofs_y};
int size_y = 0;
int tile_size_y = 0;
 
/* draw item itself */
-   uiBlock *block = drawinfo->block;
-
if (tile->flag & LAYERTILE_RENAME) {
uiBut *but = uiDefBut(
block, UI_BTYPE_TEXT, 1, "", rect.xmin, rect.ymin,
@@ -109,18 +97,18 @@ static bool layer_tile_draw_cb(LayerTreeItem *litem, void 
*userdata)
UI_but_flag_disable(but, UI_BUT_UNDO);
 
/* returns false if button got removed */
-   if (UI_but_active_only(drawinfo->C, drawinfo->ar, block, but) 
== false) {
+   if (UI_but_active_only(C, a

[Bf-blender-cvs] [465250a] fluid-mantaflow: need to disable some smoke functions again

2016-06-08 Thread Sebastián Barschkis
Commit: 465250ad346cfc63050eb3f0b330b7b3509dc10a
Author: Sebastián Barschkis
Date:   Wed Jun 8 22:59:15 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB465250ad346cfc63050eb3f0b330b7b3509dc10a

need to disable some smoke functions again

===

M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenkernel/intern/smoke.c

===

diff --git a/source/blender/blenkernel/intern/pointcache.c 
b/source/blender/blenkernel/intern/pointcache.c
index 4b0eb5b..817c07c 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1597,8 +1597,9 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct 
Object *ob, struct SmokeMo
pid->read_point = NULL;
pid->interpolate_point  = NULL;
 
-   pid->read_stream= ptcache_smoke_read;
-   pid->write_stream   = ptcache_smoke_write;
+   // TODO (sebbas) need to disable this again for liquids
+   pid->read_stream= NULL; //ptcache_smoke_read;
+   pid->write_stream   = NULL; //ptcache_smoke_write;
 
pid->write_openvdb_stream   = ptcache_smoke_openvdb_write;
pid->read_openvdb_stream= ptcache_smoke_openvdb_read;
diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index 15bfff5..95e829b 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -3018,7 +3018,8 @@ static void smokeModifier_process(SmokeModifierData *smd, 
Scene *scene, Object *
step(scene, ob, smd, dm, scene->r.frs_sec / 
scene->r.frs_sec_base);
}
// create shadows before writing cache so they get stored
-   smoke_calc_transparency(sds, scene);
+   // TODO (sebbas) disabled for liquid integration
+// smoke_calc_transparency(sds, scene);
 
 #ifndef WITH_MANTA
if (sds->wt)
@@ -3026,9 +3027,10 @@ static void smokeModifier_process(SmokeModifierData 
*smd, Scene *scene, Object *
smoke_turbulence_step(sds->wt, sds->fluid);
}
 #endif
-   BKE_ptcache_validate(cache, framenr);
-   if (framenr != startframe)
-   BKE_ptcache_write(&pid, framenr);
+   // TODO (sebbas) disabled for liquid integration
+// BKE_ptcache_validate(cache, framenr);
+// if (framenr != startframe)
+// BKE_ptcache_write(&pid, framenr);
 
 #ifdef DEBUG_TIME
double end = PIL_check_seconds_timer();

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


[Bf-blender-cvs] [a09387e] fluid-mantaflow: splitting up domain initialization. otherwise crashing

2016-06-08 Thread Sebastián Barschkis
Commit: a09387ee55236ac8308449a7d533f8b53550ccfa
Author: Sebastián Barschkis
Date:   Wed Jun 8 22:49:04 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBa09387ee55236ac8308449a7d533f8b53550ccfa

splitting up domain initialization. otherwise crashing

===

M   intern/mantaflow/intern/SMOKE.cpp

===

diff --git a/intern/mantaflow/intern/SMOKE.cpp 
b/intern/mantaflow/intern/SMOKE.cpp
index 53b4e75..4c41399 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -116,13 +116,11 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)
// Only start Mantaflow once. No need to start whenever new SMOKE 
objected is allocated
if (!mantaInitialized)
startMantaflow();
-
-   initDomain(smd);
-   if (mUsingHighRes) initDomainHigh(smd);

// Initialize Mantaflow variables in Python
// Liquid
if (mUsingLiquid) {
+   initDomain(smd);
initLiquid(smd);
updatePointers(smd);
return;
@@ -130,6 +128,7 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)

// Smoke
if (mUsingSmoke) {
+   initDomain(smd);
initSmoke(smd);
if (mUsingHeat)   initHeat(smd);
if (mUsingFire)   initFire(smd);
@@ -149,6 +148,7 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)
mTotalCellsHigh = mResXHigh * mResYHigh * mResZHigh;

// Initialize Mantaflow variables in Python
+   initDomainHigh(smd);
initSmokeHigh(smd);
if (mUsingFire)   initFireHigh(smd);
if (mUsingColors) initColorsHigh(smd);

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


[Bf-blender-cvs] [664d6ad] fluid-mantaflow: first customizations for liquid caching - extending the smoke cache

2016-06-08 Thread Sebastián Barschkis
Commit: 664d6ad6c6fa8f3df2aed5d73c86c2b57fe241f4
Author: Sebastián Barschkis
Date:   Wed Jun 8 16:22:40 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB664d6ad6c6fa8f3df2aed5d73c86c2b57fe241f4

first customizations for liquid caching - extending the smoke cache

===

M   release/scripts/startup/bl_ui/properties_physics_smoke.py
M   source/blender/blenkernel/BKE_pointcache.h
M   source/blender/makesdna/DNA_smoke_types.h
M   source/blender/makesrna/intern/rna_smoke.c

===

diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py 
b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 12c4075..ef36548 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -327,6 +327,9 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
 row = layout.row()
 row.label("Data Depth:")
 row.prop(domain, "data_depth", expand=True, text="Data Depth")
+elif cache_file_format == 'OBJECT':
+layout.label(text="Compression:")
+layout.prop(domain, "liquid_cache_compress_type", expand=True)
 
 cache = domain.point_cache
 point_cache_ui(self, context, cache, (cache.is_baked is False), 
'SMOKE')
diff --git a/source/blender/blenkernel/BKE_pointcache.h 
b/source/blender/blenkernel/BKE_pointcache.h
index 8238ea6..d955072 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -125,6 +125,7 @@ typedef struct PTCacheFile {
 enum {
PTCACHE_FILE_PTCACHE = 0,
PTCACHE_FILE_OPENVDB = 1,
+   PTCACHE_FILE_LIQUID = 2,
 };
 
 typedef struct PTCacheID {
diff --git a/source/blender/makesdna/DNA_smoke_types.h 
b/source/blender/makesdna/DNA_smoke_types.h
index bf321e1..40917e4 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -153,6 +153,9 @@ typedef struct SmokeDomainSettings {
char cache_file_format;
char data_depth;
char pad[2];
+   /* Liquid cache options */
+   int liquid_cache_comp;
+   char mock_pad[4]; /* unused */
 
/* Smoke uses only one cache from now on (index [0]), but keeping the 
array for now for reading old files. */
struct PointCache *point_cache[2];  /* definition is in 
DNA_object_force.h */
diff --git a/source/blender/makesrna/intern/rna_smoke.c 
b/source/blender/makesrna/intern/rna_smoke.c
index c25e8d3..82a3d51 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -436,6 +436,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow 
compression"},
{0, NULL, 0, NULL, NULL}
};
+   
+   static EnumPropertyItem liquid_cache_comp_items[] = {
+   {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Write .bobj.gz 
files, smaller in size than .obj"},
+   {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Write .obj files 
(not yet implemented)"},
+   {0, NULL, 0, NULL, NULL}
+   };
 
static EnumPropertyItem smoke_highres_sampling_items[] = {
{SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
@@ -463,6 +469,9 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 #ifdef WITH_OPENVDB
{PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file 
format"},
 #endif
+#ifdef WITH_MANTA
+   {PTCACHE_FILE_LIQUID, "OBJECT", 0, "Object files ", "Obj file 
format"},
+#endif
{0, NULL, 0, NULL, NULL}
};
 
@@ -586,6 +595,11 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "openvdb_comp");
RNA_def_property_enum_items(prop, prop_compression_items);
RNA_def_property_ui_text(prop, "Compression", "Compression method to be 
used");
+   
+   prop = RNA_def_property(srna, "liquid_cache_compress_type", PROP_ENUM, 
PROP_NONE);
+   RNA_def_property_enum_sdna(prop, NULL, "liquid_cache_comp");
+   RNA_def_property_enum_items(prop, liquid_cache_comp_items);
+   RNA_def_property_ui_text(prop, "Cache Compression", "Compression method 
to be used");
 
prop = RNA_def_property(srna, "data_depth", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_depth");

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


[Bf-blender-cvs] [80f4488] fluid-mantaflow: script cleanup (added some debug messages and remained phi grid)

2016-06-08 Thread Sebastián Barschkis
Commit: 80f4488cf6322aba4bf96ade06c40393088c1afb
Author: Sebastián Barschkis
Date:   Wed Jun 8 22:55:40 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB80f4488cf6322aba4bf96ade06c40393088c1afb

script cleanup (added some debug messages and remained phi grid)

===

M   intern/mantaflow/intern/SMOKE.cpp
M   intern/mantaflow/intern/strings/liquid_script.h
M   intern/mantaflow/intern/strings/shared_script.h
M   intern/mantaflow/intern/strings/smoke_script.h

===

diff --git a/intern/mantaflow/intern/SMOKE.cpp 
b/intern/mantaflow/intern/SMOKE.cpp
index 62f17f6..d257fc8 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -693,7 +693,7 @@ void SMOKE::updatePointers(SmokeModifierData *smd)
 
// Liquid
if (mUsingLiquid) {
-   mPhi= (float*) getGridPointer("phiTemp",
 "s");
+   mPhi= (float*) getGridPointer("phiInit",
 "s");
}

// Smoke
diff --git a/intern/mantaflow/intern/strings/liquid_script.h 
b/intern/mantaflow/intern/strings/liquid_script.h
index fc5a858..73cbdef 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -54,7 +54,7 @@ flags  = s.create(FlagGrid)\n\
 \n\
 phiParts   = s.create(LevelsetGrid)\n\
 phi= s.create(LevelsetGrid)\n\
-phiTemp= s.create(LevelsetGrid)\n\
+phiInit= s.create(LevelsetGrid)\n\
 pressure   = s.create(RealGrid)\n\
 \n\
 vel= s.create(MACGrid)\n\
@@ -73,7 +73,7 @@ gpi= s.create(IntGrid)\n";
 const std::string prep_domain = "\n\
 flags.initDomain(boundaryWidth=0)\n\
 phi.initFromFlags(flags)\n\
-phiTemp.initFromFlags(flags)\n";
+phiInit.initFromFlags(flags)\n";
 
 //
 // ADAPTIVE STEP
@@ -87,14 +87,14 @@ def manta_step(start_frame):\n\
 \n\
 # Sample particles on first frame\n\
 if (start_frame == 1):\n\
-phi.copyFrom(phiTemp)\n\
+phi.copyFrom(phiInit)\n\
 flags.updateFromLevelset(phi)\n\
 sampleLevelsetWithParticles( phi=phi, flags=flags, parts=pp, 
discretization=2, randomness=0.01 )\n\
 mapGridToPartsVec3(source=vel, parts=pp, target=pVel )\n\
 phi.save('/Users/sbarschkis/Desktop/phi.uni')\n\
 \n\
 #for i in range(int(gs.z)):\n\
-#phiTemp.printGrid(zSlice=int(i))\n\
+#phiInit.printGrid(zSlice=int(i))\n\
 while s.frame == last_frame:\n\
 global step\n\
 step = step + 1\n\
@@ -184,7 +184,7 @@ mantaMsg('Deleting grids, mesh, particlesystem')\n\
 if 'flags'  in globals() : del flags\n\
 if 'phiParts'   in globals() : del phiParts\n\
 if 'phi'in globals() : del phi\n\
-if 'phiTemp'in globals() : del phiTemp\n\
+if 'phiInit'in globals() : del phiInit\n\
 if 'pressure'   in globals() : del pressure\n\
 if 'vel'in globals() : del vel\n\
 if 'velOld' in globals() : del velOld\n\
diff --git a/intern/mantaflow/intern/strings/shared_script.h 
b/intern/mantaflow/intern/strings/shared_script.h
index c07d57d..288344a 100644
--- a/intern/mantaflow/intern/strings/shared_script.h
+++ b/intern/mantaflow/intern/strings/shared_script.h
@@ -35,6 +35,7 @@ import os, shutil, math, sys, gc\n";
 
 const std::string solver_low = "\n\
 # solver low params\n\
+mantaMsg('Solver low')\n\
 dim= $SOLVER_DIM$\n\
 res= $RES$\n\
 gs = vec3($RESX$,$RESY$,$RESZ$)\n\
@@ -43,13 +44,15 @@ s  = Solver(name='main', gridSize=gs, dim=dim)\n";
 
 const std::string solver_high = "\n\
 # solver high params\n\
+mantaMsg('Solver high')\n\
 upres  = $UPRES$\n\
 xl_gs  = vec3($HRESX$, $HRESY$, $HRESZ$)\n\
 if dim == 2: xl_gs.z = 1\n\
-xl = Solver(name = 'larger', gridSize = xl_gs)\n";
+xl = Solver(name='larger', gridSize=xl_gs)\n";
 
 const std::string adaptive_time_stepping_low = "\n\
 # adaptive time stepping\n\
+mantaMsg('Adaptive time stepping low')\n\
 dt_default= 0.1\n\
 dt_factor = $DT_FACTOR$\n\
 fps   = $FPS$\n\
@@ -61,6 +64,7 @@ s.cfl = 4.0\n\
 s.timestep= dt0\n";
 
 const std::string adaptive_time_stepping_high = "\n\
+mantaMsg('Adaptive time stepping high')\n\
 xl.frameLength = s.frameLength\n\
 xl.timestepMin = s.timestepMin / 10\n\
 xl.timestepMax = s.timestepMax\n\
diff --git a/intern/mantaflow/intern/strings/smoke_script.h 
b/intern/mantaflow/intern/strings/smoke_script.h
index f900c9c..f611c60 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -51,6 +51,7 @@ copyVec3ToReal(source=uv[1], targetX=texture_u2, 
targetY=texture_v2, targetZ=tex
 //
 
 const std::string smoke_variables_low = "\n\
+mantaMsg('Smoke variables low')\n\
 usin

[Bf-blender-cvs] [2c991e2] fluid-mantaflow: re-enabled the remaining smoke functions. smoke sim now back to normal state

2016-06-08 Thread Sebastián Barschkis
Commit: 2c991e2ff2599432705980c09be1b423ea2b72c4
Author: Sebastián Barschkis
Date:   Wed Jun 8 16:19:33 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB2c991e2ff2599432705980c09be1b423ea2b72c4

re-enabled the remaining smoke functions. smoke sim now back to normal state

===

M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenkernel/intern/smoke.c

===

diff --git a/source/blender/blenkernel/intern/pointcache.c 
b/source/blender/blenkernel/intern/pointcache.c
index fa6a929..4b0eb5b 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1597,9 +1597,8 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct 
Object *ob, struct SmokeMo
pid->read_point = NULL;
pid->interpolate_point  = NULL;
 
-// TODO Disabled while integrating liquids
-   pid->read_stream= NULL; //ptcache_smoke_read;
-   pid->write_stream   = NULL; //ptcache_smoke_write;
+   pid->read_stream= ptcache_smoke_read;
+   pid->write_stream   = ptcache_smoke_write;
 
pid->write_openvdb_stream   = ptcache_smoke_openvdb_write;
pid->read_openvdb_stream= ptcache_smoke_openvdb_read;
diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index 63e3587..15bfff5 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -3018,8 +3018,7 @@ static void smokeModifier_process(SmokeModifierData *smd, 
Scene *scene, Object *
step(scene, ob, smd, dm, scene->r.frs_sec / 
scene->r.frs_sec_base);
}
// create shadows before writing cache so they get stored
-// TODO Disabled while integrating liquids
-// smoke_calc_transparency(sds, scene);
+   smoke_calc_transparency(sds, scene);
 
 #ifndef WITH_MANTA
if (sds->wt)
@@ -3027,10 +3026,9 @@ static void smokeModifier_process(SmokeModifierData 
*smd, Scene *scene, Object *
smoke_turbulence_step(sds->wt, sds->fluid);
}
 #endif
-// TODO Disabled while integrating liquids
-// BKE_ptcache_validate(cache, framenr);
-// if (framenr != startframe)
-// BKE_ptcache_write(&pid, framenr);
+   BKE_ptcache_validate(cache, framenr);
+   if (framenr != startframe)
+   BKE_ptcache_write(&pid, framenr);
 
 #ifdef DEBUG_TIME
double end = PIL_check_seconds_timer();

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


[Bf-blender-cvs] [f0c17c7] fluid-mantaflow: added high res liquid phi grid getter

2016-06-08 Thread Sebastián Barschkis
Commit: f0c17c75995186d471f9022b066c06985f36ba72
Author: Sebastián Barschkis
Date:   Wed Jun 8 22:28:15 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBf0c17c75995186d471f9022b066c06985f36ba72

added high res liquid phi grid getter

===

M   intern/mantaflow/extern/manta_smoke_API.h
M   intern/mantaflow/intern/SMOKE.cpp
M   intern/mantaflow/intern/manta_smoke_API.cpp

===

diff --git a/intern/mantaflow/extern/manta_smoke_API.h 
b/intern/mantaflow/extern/manta_smoke_API.h
index 442e0b8..e343cb2 100644
--- a/intern/mantaflow/extern/manta_smoke_API.h
+++ b/intern/mantaflow/extern/manta_smoke_API.h
@@ -89,6 +89,7 @@ float *smoke_get_inflow_grid(struct SMOKE *smoke);
 float *smoke_get_fuel_inflow(struct SMOKE *smoke);
 
 float *liquid_get_phi(struct SMOKE *liquid);
+float *liquid_turbulence_get_phi(struct SMOKE *liquid);
 void liquid_ensure_init(struct SMOKE *smoke, struct SmokeModifierData *smd);
 
 
diff --git a/intern/mantaflow/intern/SMOKE.cpp 
b/intern/mantaflow/intern/SMOKE.cpp
index 5ac180a..53b4e75 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -197,8 +197,8 @@ void SMOKE::initSmoke(SmokeModifierData *smd)
 
 void SMOKE::initSmokeHigh(SmokeModifierData *smd)
 {
-   std::string tmpString = solver_high
-   + alloc_base_grids_high
+   std::string tmpString = alloc_base_grids_high
+   + smoke_variables_high
+ uv_setup
+ prep_domain_high
+ wavelet_turbulence_noise
@@ -584,10 +584,10 @@ void SMOKE::exportScript(SmokeModifierData *smd)

// Setup high
if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
-   manta_script +=
-   solver_high +
-   uv_setup +
-   alloc_base_grids_high;
+   manta_script += solver_high
+   + smoke_variables_high
+   + uv_setup
+   + alloc_base_grids_high;
}

// Add color grids high if needed
diff --git a/intern/mantaflow/intern/manta_smoke_API.cpp 
b/intern/mantaflow/intern/manta_smoke_API.cpp
index 9342570..fc8d61e 100644
--- a/intern/mantaflow/intern/manta_smoke_API.cpp
+++ b/intern/mantaflow/intern/manta_smoke_API.cpp
@@ -372,6 +372,11 @@ extern "C" float *smoke_turbulence_get_flame(SMOKE *smoke)
return (smoke && smoke->usingHighRes()) ? smoke->getFlameHigh() : NULL;
 }
 
+extern "C" float *liquid_turbulence_get_phi(SMOKE *liquid)
+{
+   return (liquid && liquid->usingHighRes()) ? liquid->getPhiHigh() : NULL;
+}
+
 extern "C" void smoke_turbulence_get_res(SMOKE *smoke, int *res)
 {
if (smoke && smoke->usingHighRes()) {

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


[Bf-blender-cvs] [a3c04bd] fluid-mantaflow: added phi high res grid. will be used later in liquid upres mode

2016-06-08 Thread Sebastián Barschkis
Commit: a3c04bdd56c420b1d94ccbb070e0e7598fa143d6
Author: Sebastián Barschkis
Date:   Wed Jun 8 22:53:24 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBa3c04bdd56c420b1d94ccbb070e0e7598fa143d6

added phi high res grid. will be used later in liquid upres mode

===

M   intern/mantaflow/intern/SMOKE.cpp
M   intern/mantaflow/intern/SMOKE.h

===

diff --git a/intern/mantaflow/intern/SMOKE.cpp 
b/intern/mantaflow/intern/SMOKE.cpp
index 4c41399..62f17f6 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -112,6 +112,7 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)

// Liquids
mPhi= NULL;
+   mPhiHigh= NULL;
 
// Only start Mantaflow once. No need to start whenever new SMOKE 
objected is allocated
if (!mantaInitialized)
@@ -390,7 +391,8 @@ SMOKE::~SMOKE()
}

// Liquid
-   mPhi = NULL;
+   mPhi = NULL;
+   mPhiHigh = NULL;

// Reset flags
mUsingHeat= false;
@@ -689,6 +691,7 @@ void SMOKE::updatePointers(SmokeModifierData *smd)
 {
std::cout << "Updating pointers low res" << std::endl;
 
+   // Liquid
if (mUsingLiquid) {
mPhi= (float*) getGridPointer("phiTemp",
 "s");
}
@@ -729,23 +732,31 @@ void SMOKE::updatePointersHigh(SmokeModifierData *smd)
 {
std::cout << "Updating pointers high res" << std::endl;
 
-   mDensityHigh= (float*) getGridPointer("xl_density", "xl");
-   mTextureU   = (float*) getGridPointer("texture_u",  "s");
-   mTextureV   = (float*) getGridPointer("texture_v",  "s");
-   mTextureW   = (float*) getGridPointer("texture_w",  "s");
-   mTextureU2  = (float*) getGridPointer("texture_u2", "s");
-   mTextureV2  = (float*) getGridPointer("texture_v2", "s");
-   mTextureW2  = (float*) getGridPointer("texture_w2", "s");
-   
-   if (mUsingFire) {
-   mFlameHigh  = (float*) getGridPointer("xl_flame",   "xl");
-   mFuelHigh   = (float*) getGridPointer("xl_fuel","xl");
-   mReactHigh  = (float*) getGridPointer("xl_react",   "xl");
+   // Liquid
+   if (mUsingLiquid) {
+   // TODO (sebbas) phiInitHigh does not exist yet
+   mPhiHigh= (float*) getGridPointer("phiInitHigh", "xl");
}
-   if (mUsingColors) {
-   mColorRHigh = (float*) getGridPointer("xl_color_r", "xl");
-   mColorGHigh = (float*) getGridPointer("xl_color_g", "xl");
-   mColorBHigh = (float*) getGridPointer("xl_color_b", "xl");
+   
+   if (mUsingSmoke) {
+   mDensityHigh= (float*) getGridPointer("xl_density", "xl");
+   mTextureU   = (float*) getGridPointer("texture_u",  "s");
+   mTextureV   = (float*) getGridPointer("texture_v",  "s");
+   mTextureW   = (float*) getGridPointer("texture_w",  "s");
+   mTextureU2  = (float*) getGridPointer("texture_u2", "s");
+   mTextureV2  = (float*) getGridPointer("texture_v2", "s");
+   mTextureW2  = (float*) getGridPointer("texture_w2", "s");
+   
+   if (mUsingFire) {
+   mFlameHigh  = (float*) getGridPointer("xl_flame",   
"xl");
+   mFuelHigh   = (float*) getGridPointer("xl_fuel",
"xl");
+   mReactHigh  = (float*) getGridPointer("xl_react",   
"xl");
+   }
+   if (mUsingColors) {
+   mColorRHigh = (float*) getGridPointer("xl_color_r", 
"xl");
+   mColorGHigh = (float*) getGridPointer("xl_color_g", 
"xl");
+   mColorBHigh = (float*) getGridPointer("xl_color_b", 
"xl");
+   }
}
 }
 
diff --git a/intern/mantaflow/intern/SMOKE.h b/intern/mantaflow/intern/SMOKE.h
index 8a52ff6..3671942 100644
--- a/intern/mantaflow/intern/SMOKE.h
+++ b/intern/mantaflow/intern/SMOKE.h
@@ -108,7 +108,8 @@ public:
inline float* getTextureV2() { return mTextureV2; }
inline float* getTextureW2() { return mTextureW2; }

-   inline float* getPhi() { return mPhi; }
+   inline float* getPhi() { return mPhi; }
+   inline float* getPhiHigh() { return NULL; } // Not yet implemented
 
static bool mantaInitialized;
 
@@ -177,6 +178,7 @@ private:

// Liquids
float* mPhi;
+   float* mPhiHigh;

void initDomain(struct SmokeModifierData *smd);
void initDomainHigh(struct SmokeModifierData *smd);

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


[Bf-blender-cvs] [4cb76ba] fluid-mantaflow: added high res liquid inflow grid (the one manta uses to create the mesh)

2016-06-08 Thread Sebastián Barschkis
Commit: 4cb76badeceef33cbdd20ddfdd4691295cfc47c8
Author: Sebastián Barschkis
Date:   Thu Jun 9 00:05:25 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB4cb76badeceef33cbdd20ddfdd4691295cfc47c8

added high res liquid inflow grid (the one manta uses to create the mesh)

===

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

===

diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index 95e829b..bc6aced 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1069,6 +1069,7 @@ typedef struct EmissionMap {
float *influence_high;
float *velocity;
float* inflow;
+   float* inflow_high;
int min[3], max[3], res[3];
int hmin[3], hmax[3], hres[3];
int total_cells, valid;
@@ -1145,6 +1146,7 @@ static void em_allocateData(EmissionMap *em, bool 
use_velocity, int hires_mul)
}
 
em->influence_high = MEM_callocN(sizeof(float) * 
total_cells_high, "smoke_flow_influence_high");
+   em->inflow_high = MEM_callocN(sizeof(float) * total_cells_high, 
"liquid_inflow_map_high");
}
em->valid = 1;
 }
@@ -1159,6 +1161,8 @@ static void em_freeData(EmissionMap *em)
MEM_freeN(em->velocity);
if (em->inflow)
MEM_freeN(em->inflow);
+   if (em->inflow_high)
+   MEM_freeN(em->inflow_high);
 }
 
 static void em_combineMaps(EmissionMap *output, EmissionMap *em2, int 
hires_multiplier, int additive, float sample_size)
@@ -1719,10 +1723,9 @@ static void emit_from_derivedmesh_task_cb(void 
*userdata, const int z)
  x - data->min[0], 
data->res[0], y - data->min[1], data->res[1], z - data->min[2]);
const float ray_start[3] = {lx + 0.5f * 
data->hr, ly + 0.5f * data->hr, lz + 0.5f * data->hr};
 
-   // TODO (sebbas) inflow map highres?
sample_derivedmesh(
data->sfs, data->mvert, data->mloop, 
data->mlooptri, data->mloopuv,
-   em->influence_high, NULL, NULL, index, 
data->sds->base_res, data->flow_center,
+   em->influence_high, NULL, 
em->inflow_high, index, data->sds->base_res, data->flow_center,
data->tree, ray_start, data->vert_vel, 
data->has_velocity, data->defgrp_index, data->dvert,
/* x,y,z needs to be always lowres */
lx, ly, lz);
@@ -2467,6 +2470,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, 
SmokeDomainSettings *sd
float *bigcolor_r = 
smoke_turbulence_get_color_r(sds->fluid);
float *bigcolor_g = 
smoke_turbulence_get_color_g(sds->fluid);
float *bigcolor_b = 
smoke_turbulence_get_color_b(sds->fluid);
+   float *bigphi = 
liquid_turbulence_get_phi(sds->fluid);
 #endif
float *heat = smoke_get_heat(sds->fluid);
float *velocity_x = 
smoke_get_velocity_x(sds->fluid);
@@ -2480,6 +2484,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, 
SmokeDomainSettings *sd
float *emission_map = em->influence;
float *emission_map_high = em->influence_high;
float* inflow_map = em->inflow;
+   float* inflow_map_high = em->inflow_high;
 
int ii, jj, kk, gx, gy, gz, ex, ey, ez, dx, dy, 
dz, block_size;
size_t e_index, d_index, index_big;
@@ -2600,7 +2605,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, 
SmokeDomainSettings *sd

}

else { // inflow

// TODO (sebbas) inflow map highres?
-   
apply_inflow_fields(sfs, interpolated_value, 1, index_big, 
bigdensity, NULL, bigfuel, bigreact, bigcolor_r, bigcolor_g, bigcolor_b, NULL);
+   
apply_inflow_fields(sfs, interpolated_value, 
inflow_map_high[index_big], index_big, bigdensity, NULL, bigfuel, bigreact, 
bigcolor_r, bigcolor_g, bigcolor_b, bigphi);
  

[Bf-blender-cvs] [d318324] compositor-2016: disable glsl, glew import different on mac. Check on viewer node do_output io active. First check bnode output buffer, can be null, prevent compo from crash

2016-06-08 Thread Monique Dewanchand
Commit: d318324526cae12416e24e1cb7c4bfa9e2941e90
Author: Monique Dewanchand
Date:   Thu Jun 2 23:09:53 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBd318324526cae12416e24e1cb7c4bfa9e2941e90

disable glsl, glew import different on mac. Check on viewer node do_output io 
active. First check bnode output buffer, can be null, prevent compo from 
crashing.

===

M   source/blender/compositor/cmp/cmp_compositor.cpp
M   source/blender/compositor/cmp/cmp_unroll.cpp
M   source/blender/compositor/device/device_glsl_compiler.cpp
M   source/blender/compositor/device/device_glsl_compiler.hpp

===

diff --git a/source/blender/compositor/cmp/cmp_compositor.cpp 
b/source/blender/compositor/cmp/cmp_compositor.cpp
index b4f5c7b..9333d52 100644
--- a/source/blender/compositor/cmp/cmp_compositor.cpp
+++ b/source/blender/compositor/cmp/cmp_compositor.cpp
@@ -64,7 +64,6 @@ void COM_execute(RenderData *rd, Scene *scene, bNodeTree 
*editingtree, int rende
   // UNROLL editingtree
   Compositor::Node* node = Compositor::unroll(editingtree, render_context);
   if (node != NULL) {
-
 // ALLOCATE output
 Compositor::Output output(editingtree, node, rd, viewName, viewSettings, 
displaySettings);
 if (output.buffer == NULL) {
diff --git a/source/blender/compositor/cmp/cmp_unroll.cpp 
b/source/blender/compositor/cmp/cmp_unroll.cpp
index 14ab39e..c2e0e2f 100644
--- a/source/blender/compositor/cmp/cmp_unroll.cpp
+++ b/source/blender/compositor/cmp/cmp_unroll.cpp
@@ -6,7 +6,7 @@ namespace Compositor {
 
   static bNode* find_active_viewer_node(bNodeTree* node_tree) {
 for (bNode *node = (bNode *)node_tree->nodes.first; node; node = 
node->next) {
-  if (node->type == CMP_NODE_VIEWER && node->flag & NODE_ACTIVE) {
+  if (node->type == CMP_NODE_VIEWER && node->flag & NODE_DO_OUTPUT) {
 return node;
 }
 }
diff --git a/source/blender/compositor/device/device_glsl_compiler.cpp 
b/source/blender/compositor/device/device_glsl_compiler.cpp
index 469eca8..8c53f51 100644
--- a/source/blender/compositor/device/device_glsl_compiler.cpp
+++ b/source/blender/compositor/device/device_glsl_compiler.cpp
@@ -55,18 +55,18 @@ namespace Compositor {
   return source.str();
 }
 
-GLuint compile_vertex_shader(std::string vertex_source) {
+//GLuint compile_vertex_shader(std::string vertex_source) {
   // std::cout << "version" << glGetString(GL_VERSION) << "\n";
-  return 0;
+  //return 0;
   // GLuint shader = glCreateShader(GL_VERTEX_SHADER);
   // return shader;
-}
+   // }
 
-GLuint compile_fragment_shader(std::string vertex_source) {
+//GLuint compile_fragment_shader(std::string vertex_source) {
   // std::cout << "version" << glGetString(GL_VERSION) << "\n";
-  return 0;
+ // return 0;
   // GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
   // return shader;
-}
+//}
   }
 }
diff --git a/source/blender/compositor/device/device_glsl_compiler.hpp 
b/source/blender/compositor/device/device_glsl_compiler.hpp
index d72fc21..1b1a9cc 100644
--- a/source/blender/compositor/device/device_glsl_compiler.hpp
+++ b/source/blender/compositor/device/device_glsl_compiler.hpp
@@ -1,7 +1,7 @@
 #ifndef CMP_DEVICE_DEVICE_GLSL_COMPILER_HPP
 #define CMP_DEVICE_DEVICE_GLSL_COMPILER_HPP
 
-#include "GPU_glew.h"
+//#include "GPU_glew.h"
 #include "cmp_node.hpp"
 #include 
 
@@ -10,8 +10,8 @@ namespace Compositor {
 std::string generate_glsl_vertex_source(Compositor::Node* node);
 std::string generate_glsl_fragment_source(Compositor::Node* node);
 
-GLuint compile_vertex_shader(std::string vertex_source);
-GLuint compile_fragment_shader(std::string vertex_source);
+//GLuint compile_vertex_shader(std::string vertex_source);
+//GLuint compile_fragment_shader(std::string vertex_source);
   }
 }
 #endif

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


[Bf-blender-cvs] [e7a2a0e] compositor-2016: Fix T48111: Auto-run fails w/ empty paths

2016-06-08 Thread Campbell Barton
Commit: e7a2a0efa15742951100e41422e3645a333f7857
Author: Campbell Barton
Date:   Fri Jun 3 15:28:32 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBe7a2a0efa15742951100e41422e3645a333f7857

Fix T48111: Auto-run fails w/ empty paths

Enabling auto-run, then excluding a path but leaving it set to a blank value 
would ignore all paths.

===

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

===

diff --git a/source/blender/blenkernel/intern/autoexec.c 
b/source/blender/blenkernel/intern/autoexec.c
index d9462cd..bde06b0 100644
--- a/source/blender/blenkernel/intern/autoexec.c
+++ b/source/blender/blenkernel/intern/autoexec.c
@@ -59,7 +59,10 @@ bool BKE_autoexec_match(const char *path)
BLI_assert((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0);
 
for (path_cmp = U.autoexec_paths.first; path_cmp; path_cmp = 
path_cmp->next) {
-   if ((path_cmp->flag & USER_PATHCMP_GLOB)) {
+   if (path_cmp->path[0] == '\0') {
+   /* pass */
+   }
+   else if ((path_cmp->flag & USER_PATHCMP_GLOB)) {
if (fnmatch(path_cmp->path, path, fnmatch_flags) == 0) {
return true;
}

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


[Bf-blender-cvs] [eef148d] compositor-2016: Cleanup: remove unused Library.idblock

2016-06-08 Thread Campbell Barton
Commit: eef148d6c889cb531cecd8a49fb9121b1a5aac99
Author: Campbell Barton
Date:   Tue Jun 7 00:34:54 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBeef148d6c889cb531cecd8a49fb9121b1a5aac99

Cleanup: remove unused Library.idblock

===

M   source/blender/makesdna/DNA_ID.h

===

diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 0bf3c35..d3d7d07 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -142,7 +142,6 @@ typedef struct ID {
  */
 typedef struct Library {
ID id;
-   ID *idblock;
struct FileData *filedata;
char name[1024];  /* path name used for reading, can be relative and 
edited in the outliner */

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


[Bf-blender-cvs] [9f3facb] compositor-2016: Correct assert

2016-06-08 Thread Campbell Barton
Commit: 9f3facbc12f933a8cb1c93e8a7809a26d8a386dd
Author: Campbell Barton
Date:   Wed Jun 8 16:31:40 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB9f3facbc12f933a8cb1c93e8a7809a26d8a386dd

Correct assert

===

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

===

diff --git a/source/blender/blenkernel/intern/font.c 
b/source/blender/blenkernel/intern/font.c
index aed33d2..9875740 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -541,7 +541,7 @@ int BKE_vfont_select_get(Object *ob, int *r_start, int 
*r_end)
 
BLI_assert(ef->len >= 0);
BLI_assert(ef->selstart >= 0 && ef->selstart <= ef->len + 1);
-   BLI_assert(ef->selend   >= 0 && ef->selend   <= ef->len);
+   BLI_assert(ef->selend   >= 0 && ef->selend   <= ef->len + 1);
BLI_assert(ef->pos  >= 0 && ef->pos  <= ef->len);
 
if (ef->selstart == 0) {

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


[Bf-blender-cvs] [0d98e58] compositor-2016: Add BLI_array_store copy-on-write API

2016-06-08 Thread Campbell Barton
Commit: 0d98e58b25ab24652613abd47f61d38f2a4e6132
Author: Campbell Barton
Date:   Mon May 30 15:25:36 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB0d98e58b25ab24652613abd47f61d38f2a4e6132

Add BLI_array_store copy-on-write API

This supported in-memory de-duplication,
useful to avoid in-efficient memory use when storing multiple, similar arrays.

===

A   source/blender/blenlib/BLI_array_store.h
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/array_store.c

===

diff --git a/source/blender/blenlib/BLI_array_store.h 
b/source/blender/blenlib/BLI_array_store.h
new file mode 100644
index 000..f4cbc07
--- /dev/null
+++ b/source/blender/blenlib/BLI_array_store.h
@@ -0,0 +1,66 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+#ifndef __BLI_ARRAY_STORE_H__
+#define __BLI_ARRAY_STORE_H__
+
+/** \file BLI_array_store.h
+ *  \ingroup bli
+ *  \brief Efficient in-memory storage of multiple similar arrays.
+ */
+
+typedef struct BArrayStore BArrayStore;
+typedef struct BArrayState BArrayState;
+
+BArrayStore *BLI_array_store_create(
+unsigned int stride, unsigned int chunk_count);
+void BLI_array_store_destroy(
+BArrayStore *bs);
+void BLI_array_store_clear(
+BArrayStore *bs);
+
+/* find the memory used by all states (expanded & real) */
+size_t BLI_array_store_calc_size_expanded_get(
+const BArrayStore *bs);
+size_t BLI_array_store_calc_size_compacted_get(
+const BArrayStore *bs);
+
+BArrayState *BLI_array_store_state_add(
+BArrayStore *bs,
+const void *data, const size_t data_len,
+const BArrayState *state_reference);
+void BLI_array_store_state_remove(
+BArrayStore *bs,
+BArrayState *state);
+
+size_t BLI_array_store_state_size_get(
+BArrayState *state);
+void BLI_array_store_state_data_get(
+BArrayState *state,
+void *data);
+void *BLI_array_store_state_data_get_alloc(
+BArrayState *state,
+size_t *r_data_len);
+
+/* only for tests */
+bool BLI_array_store_is_valid(
+BArrayStore *bs);
+
+#endif  /* __BLI_ARRAY_STORE_H__ */
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index 944ba60..42d9587 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -52,6 +52,7 @@ set(SRC
intern/BLI_memarena.c
intern/BLI_mempool.c
intern/DLRB_tree.c
+   intern/array_store.c
intern/array_utils.c
intern/astar.c
intern/boxpack2d.c
@@ -120,6 +121,7 @@ set(SRC
BLI_alloca.h
BLI_args.h
BLI_array.h
+   BLI_array_store.h
BLI_array_utils.h
BLI_astar.h
BLI_bitmap.h
diff --git a/source/blender/blenlib/intern/array_store.c 
b/source/blender/blenlib/intern/array_store.c
new file mode 100644
index 000..8cbabdd
--- /dev/null
+++ b/source/blender/blenlib/intern/array_store.c
@@ -0,0 +1,1731 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+/** \file blender/blenlib/intern/array_store.c
+ *  \ingroup bli
+ *  \brief Array storage to minimize duplication.
+ *
+ * This is done by splitting arrays into chunks and using copy-on-write (COW),
+ * to de-duplicate chunks,
+ * from the users perspective this is an impl

[Bf-blender-cvs] [80efb18] compositor-2016: World space switch for BI nodes.

2016-06-08 Thread Alexander Romanov
Commit: 80efb183cce9b41667738f5c09cc93a2710cadcb
Author: Alexander Romanov
Date:   Tue Jun 7 10:33:32 2016 +0300
Branches: compositor-2016
https://developer.blender.org/rB80efb183cce9b41667738f5c09cc93a2710cadcb

World space switch for BI nodes.

At the moment light shading in Blender is produced in viewspace. Apparently, 
that's why
shader nodes work with normals in camera space. But it is not convenient for 
artists.
The more convenient approach is implemented in Cycles where normals are 
represented in world space.
Blend4Web Team designed the engine keeping in mind shader parameters 
readability,
so normals are interpreted in world space as well. And now our users have to 
use some tweaks, like
empty node group with the name "Replace", which is replacing one input by 
another on the engine side
(replacing working configuration in Blender Viewport by the configuration that 
has the same behavior in the engine).

This patch adds the ability to switch to world space for normals and lamp 
vector in BI and Viewport.
This patch is very important to us and we crave to see this patch in Blender 
2.7 because
it will significantly simplify Blend4Web material creation workflow.

{F315547}

{F315548}

Reviewers: campbellbarton, brecht

Reviewed By: brecht

Subscribers: homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov

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

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/gpu/GPU_material.h
M   source/blender/gpu/intern/gpu_material.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/nodes/shader/nodes/node_shader_geom.c
M   source/blender/nodes/shader/nodes/node_shader_lamp.c
M   source/blender/nodes/shader/nodes/node_shader_material.c
M   source/blender/nodes/shader/nodes/node_shader_normal_map.c
M   source/blender/render/extern/include/RE_shader_ext.h
M   source/blender/render/intern/source/shadeinput.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 13e7265..4ea1c3a 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -248,6 +248,7 @@ class RENDER_PT_shading(RenderButtonsPanel, Panel):
 col = split.column()
 col.prop(rd, "use_raytrace", text="Ray Tracing")
 col.prop(rd, "alpha_mode", text="Alpha")
+col.prop(rd, "use_world_space_shading", text="World Space Shading")
 
 
 class RENDER_PT_performance(RenderButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/BKE_scene.h 
b/source/blender/blenkernel/BKE_scene.h
index a4c44b9..12bfc07 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -135,6 +135,7 @@ float get_render_aosss_error(const struct RenderData *r, 
float error);
 
 bool BKE_scene_use_new_shading_nodes(const struct Scene *scene);
 bool BKE_scene_use_shading_nodes_custom(struct Scene *scene);
+bool BKE_scene_use_world_space_shading(struct Scene *scene);
 bool BKE_scene_use_spherical_stereo(struct Scene *scene);
 
 bool BKE_scene_uses_blender_internal(const struct Scene *scene);
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index d307ba1..d16e6d5 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2193,6 +2193,12 @@ bool BKE_scene_use_shading_nodes_custom(Scene *scene)
return (type && type->flag & RE_USE_SHADING_NODES_CUSTOM);
 }
 
+bool BKE_scene_use_world_space_shading(Scene *scene)
+{
+   const RenderEngineType *type = RE_engines_find(scene->r.engine);
+   return (type && (type->flag & RE_USE_SHADING_NODES) || (scene->r.mode & 
R_USE_WS_SHADING));
+}
+
 bool BKE_scene_use_spherical_stereo(Scene *scene)
 {
RenderEngineType *type = RE_engines_find(scene->r.engine);
diff --git a/source/blender/gpu/GPU_material.h 
b/source/blender/gpu/GPU_material.h
index fc2ca16..a79334d 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -241,6 +241,7 @@ void GPU_material_vertex_attributes(GPUMaterial *material,
 
 bool GPU_material_do_color_management(GPUMaterial *mat);
 bool GPU_material_use_new_shading_nodes(GPUMaterial *mat);
+bool GPU_material_use_world_space_shading(GPUMaterial *mat);
 
 /* Exported shading */
 
diff --git a/source/blender/gpu/intern/gpu_material.c 
b/source/blender/gpu/intern/gpu_material.c
index 99ecf68..02f58ea 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -517,6 +517,11 @@ bool GPU_material_use_new_shading_nodes(GPUMaterial *mat)
 

[Bf-blender-cvs] [e66d515] compositor-2016: Cleanup: rename flag -> tag

2016-06-08 Thread Campbell Barton
Commit: e66d515d49edc2f4747db2d4fe059bc4655b0418
Author: Campbell Barton
Date:   Mon Jun 6 17:55:22 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBe66d515d49edc2f4747db2d4fe059bc4655b0418

Cleanup: rename flag -> tag

ID's have a flag member too, best avoid confusion here.

===

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

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 464fc0a..6a2f80d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7880,7 +7880,7 @@ static BHead *read_data_into_oldnewmap(FileData *fd, 
BHead *bhead, const char *a
return bhead;
 }
 
-static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, 
ID **r_id)
+static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const 
short tag, ID **r_id)
 {
/* this routine reads a libblock and its direct data. Use link 
functions to connect it all
 */
@@ -7966,7 +7966,7 @@ static BHead *read_libblock(FileData *fd, Main *main, 
BHead *bhead, int flag, ID
if (!id)
return blo_nextbhead(fd, bhead);

-   id->tag = flag | LIB_TAG_NEED_LINK;
+   id->tag = tag | LIB_TAG_NEED_LINK;
id->lib = main->curlib;
id->us = ID_FAKE_USERS(id);
id->icon_id = 0;
@@ -9644,7 +9644,7 @@ static void give_base_to_groups(
}
 }
 
-static ID *create_placeholder(Main *mainvar, const char *idname, const short 
flag)
+static ID *create_placeholder(Main *mainvar, const char *idname, const short 
tag)
 {
const short idcode = GS(idname);
ListBase *lb = which_libbase(mainvar, idcode);
@@ -9653,7 +9653,7 @@ static ID *create_placeholder(Main *mainvar, const char 
*idname, const short fla
memcpy(ph_id->name, idname, sizeof(ph_id->name));
BKE_libblock_init_empty(ph_id);
ph_id->lib = mainvar->curlib;
-   ph_id->tag = flag | LIB_TAG_MISSING;
+   ph_id->tag = tag | LIB_TAG_MISSING;
ph_id->us = ID_FAKE_USERS(ph_id);
ph_id->icon_id = 0;

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


[Bf-blender-cvs] [f5221bb] compositor-2016: Fix T48507: Symmetrize doesn't work properly on Bendy Bones

2016-06-08 Thread Joshua Leung
Commit: f5221bbe7eb546b61221d1d0711ef09bc75bb072
Author: Joshua Leung
Date:   Sun May 29 19:37:40 2016 +1200
Branches: compositor-2016
https://developer.blender.org/rBf5221bbe7eb546b61221d1d0711ef09bc75bb072

Fix T48507: Symmetrize doesn't work properly on Bendy Bones

===

M   source/blender/editors/armature/armature_utils.c

===

diff --git a/source/blender/editors/armature/armature_utils.c 
b/source/blender/editors/armature/armature_utils.c
index d73536e..6306926 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -367,6 +367,8 @@ void transform_armature_mirror_update(Object *obedit)
eboflip->tail[2] = ebo->tail[2];
eboflip->rad_tail = ebo->rad_tail;
eboflip->roll = -ebo->roll;
+   eboflip->curveOutX = -ebo->curveOutX;
+   eboflip->roll2 = -ebo->roll2;

/* Also move connected children, in 
case children's name aren't mirrored properly */
for (children = arm->edbo->first; 
children; children = children->next) {
@@ -382,6 +384,8 @@ void transform_armature_mirror_update(Object *obedit)
eboflip->head[2] = ebo->head[2];
eboflip->rad_head = ebo->rad_head;
eboflip->roll = -ebo->roll;
+   eboflip->curveInX = -ebo->curveInX;
+   eboflip->roll1 = -ebo->roll1;

/* Also move connected parent, in case 
parent's name isn't mirrored properly */
if (eboflip->parent && eboflip->flag & 
BONE_CONNECTED) {
@@ -395,6 +399,11 @@ void transform_armature_mirror_update(Object *obedit)
eboflip->roll = -ebo->roll;
eboflip->xwidth = ebo->xwidth;
eboflip->zwidth = ebo->zwidth;
+   
+   eboflip->curveInX = -ebo->curveInX;
+   eboflip->curveOutX = -ebo->curveOutX;
+   eboflip->roll1 = -ebo->roll1;
+   eboflip->roll2 = -ebo->roll2;
}
}
}

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


[Bf-blender-cvs] [ed0d586] compositor-2016: Fix T48554: Absolute grid snap fails w/ cursor pivot

2016-06-08 Thread Campbell Barton
Commit: ed0d58618aaf20aa3d7f6229b4f7d602f1b74135
Author: Campbell Barton
Date:   Tue May 31 23:56:59 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBed0d58618aaf20aa3d7f6229b4f7d602f1b74135

Fix T48554: Absolute grid snap fails w/ cursor pivot

Use center of selection when using absolute grid snapping and cursor pivot.

===

M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_generics.c
M   source/blender/editors/transform/transform_snap.c

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 5c0c0bc..5b1a584 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2863,7 +2863,7 @@ static void initBend(TransInfo *t)
 
//copy_v3_v3(t->center, ED_view3d_cursor3d_get(t->scene, t->view));
calculateCenterCursor(t, t->center);
-   calculateCenterGlobal(t);
+   calculateCenterGlobal(t, t->center, t->center_global);
 
t->val = 0.0f;
 
diff --git a/source/blender/editors/transform/transform.h 
b/source/blender/editors/transform/transform.h
index 11151a9..0e0d085 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -369,6 +369,11 @@ typedef struct TransCustomData {
unsigned int use_free : 1;
 } TransCustomData;
 
+typedef struct TransCenterData {
+   float local[3], global[3];
+   unsigned int is_set : 1;
+} TransCenterData;
+
 typedef struct TransInfo {
int mode;   /* current mode */
int flag;   /* generic flags for special behaviors  
*/
@@ -396,6 +401,9 @@ typedef struct TransInfo {
float   center[3];  /* center of transformation (in 
local-space) */
float   center_global[3];  /* center of transformation (in 
global-space) */
float   center2d[2];/* center in screen coordinates */
+   /* Lazy initialize center data for when we need other center values.
+* V3D_AROUND_ACTIVE + 1 (static assert checks this) */
+   TransCenterData center_cache[5];
short   idx_max;/* maximum index on the input vector
*/
float   snap[3];/* Snapping Gears   
*/
float   snap_spatial[3]; /* Spatial snapping gears(even when 
rotating, scaling... etc) */
@@ -742,8 +750,11 @@ void restoreTransObjects(TransInfo *t);
 void recalcData(TransInfo *t);
 
 void calculateCenter2D(TransInfo *t);
-void calculateCenterGlobal(TransInfo *t);
+void calculateCenterGlobal(
+TransInfo *t, const float center_local[3],
+float r_center_global[3]);
 
+const TransCenterData *transformCenter_from_type(TransInfo *t, int around);
 void calculateCenter(TransInfo *t);
 
 /* API functions for getting center points */
diff --git a/source/blender/editors/transform/transform_generics.c 
b/source/blender/editors/transform/transform_generics.c
index ed64773..6774064 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1610,16 +1610,18 @@ void calculateCenter2D(TransInfo *t)
}
 }
 
-void calculateCenterGlobal(TransInfo *t)
+void calculateCenterGlobal(
+TransInfo *t, const float center_local[3],
+float r_center_global[3])
 {
/* setting constraint center */
/* note, init functions may over-ride t->center */
if (t->flag & (T_EDIT | T_POSE)) {
Object *ob = t->obedit ? t->obedit : t->poseobj;
-   mul_v3_m4v3(t->center_global, ob->obmat, t->center);
+   mul_v3_m4v3(r_center_global, ob->obmat, center_local);
}
else {
-   copy_v3_v3(t->center_global, t->center);
+   copy_v3_v3(r_center_global, center_local);
}
 }
 
@@ -1794,43 +1796,55 @@ bool calculateCenterActive(TransInfo *t, bool 
select_only, float r_center[3])
return ok;
 }
 
-
-void calculateCenter(TransInfo *t)
+static void calculateCenter_FromAround(TransInfo *t, int around, float 
r_center[3])
 {
-   switch (t->around) {
+   switch (around) {
case V3D_AROUND_CENTER_BOUNDS:
-   calculateCenterBound(t, t->center);
+   calculateCenterBound(t, r_center);
break;
case V3D_AROUND_CENTER_MEAN:
-   calculateCenterMedian(t, t->center);
+   calculateCenterMedian(t, r_center);
break;
case V3D_AROUND_CURSOR:
if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP))
-  

[Bf-blender-cvs] [574894f] compositor-2016: BKE's DerivedMesh: get rid of last OMP usage.

2016-06-08 Thread Bastien Montagne
Commit: 574894ffb85122c8f6a03eccaf3d8387b40c0405
Author: Bastien Montagne
Date:   Sun May 29 20:14:42 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB574894ffb85122c8f6a03eccaf3d8387b40c0405

BKE's DerivedMesh: get rid of last OMP usage.

Not replacing with some BLI_task_stuff here, tests show this is pointless
(in absolute best case - i.e. single huge mesh in scene - parallelizing here 
switches
from 0.8ms to 0.5ms for that piece of code - with something like 750ms per 
frame update...).

===

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

===

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index a3e7e5f..bb5cc9c 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2003,15 +2003,10 @@ static void mesh_calc_modifiers(
DM_add_edge_layer(dm, CD_ORIGINDEX, 
CD_CALLOC, NULL);
DM_add_poly_layer(dm, CD_ORIGINDEX, 
CD_CALLOC, NULL);
 
-#pragma omp parallel sections if (dm->numVertData + dm->numEdgeData + 
dm->numPolyData >= BKE_MESH_OMP_LIMIT)
-   {
-#pragma omp section
-   { 
range_vn_i(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0); }
-#pragma omp section
-   { 
range_vn_i(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0); }
-#pragma omp section
-   { 
range_vn_i(DM_get_poly_data_layer(dm, CD_ORIGINDEX), dm->numPolyData, 0); }
-   }
+   /* Not worth parallelizing this, gives 
less than 0.1% overall speedup in best of best cases... */
+   range_vn_i(DM_get_vert_data_layer(dm, 
CD_ORIGINDEX), dm->numVertData, 0);
+   range_vn_i(DM_get_edge_data_layer(dm, 
CD_ORIGINDEX), dm->numEdgeData, 0);
+   range_vn_i(DM_get_poly_data_layer(dm, 
CD_ORIGINDEX), dm->numPolyData, 0);
}
}

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


[Bf-blender-cvs] [836fc68] compositor-2016: GLSL: Fix voronoi texture giving different results form rendered

2016-06-08 Thread Sergey Sharybin
Commit: 836fc68c526bc5a15d628ba282fc401cbe824902
Author: Sergey Sharybin
Date:   Mon May 30 13:07:11 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB836fc68c526bc5a15d628ba282fc401cbe824902

GLSL: Fix voronoi texture giving different results form rendered

===

M   source/blender/gpu/shaders/gpu_shader_material.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index a3b0580..91ca6a5 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2403,6 +2403,12 @@ int floor_to_int(float x)
 {
return int(floor(x));
 }
+
+int quick_floor(float x)
+{
+   return int(x) - ((x < 0) ? 1 : 0);
+}
+
 #ifdef BIT_OPERATIONS
 float integer_noise(int n)
 {
@@ -2453,9 +2459,9 @@ float bits_to_01(uint bits)
 
 float cellnoise(vec3 p)
 {
-   int ix = floor_to_int(p.x);
-   int iy = floor_to_int(p.y);
-   int iz = floor_to_int(p.z);
+   int ix = quick_floor(p.x);
+   int iy = quick_floor(p.y);
+   int iz = quick_floor(p.z);
 
return bits_to_01(hash(uint(ix), uint(iy), uint(iz)));
 }

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


[Bf-blender-cvs] [a14b96e] compositor-2016: Add upstream information to wcwidth library

2016-06-08 Thread Campbell Barton
Commit: a14b96e60cd53af052a42896a1dc8d68bc9fc945
Author: Campbell Barton
Date:   Fri Jun 3 02:43:04 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBa14b96e60cd53af052a42896a1dc8d68bc9fc945

Add upstream information to wcwidth library

===

A   extern/wcwidth/README.blender

===

diff --git a/extern/wcwidth/README.blender b/extern/wcwidth/README.blender
new file mode 100644
index 000..27c8574
--- /dev/null
+++ b/extern/wcwidth/README.blender
@@ -0,0 +1,5 @@
+Project: WC Width
+URL: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
+License: ICS
+Upstream version: 2007-05-26
+Local modifications: None

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


[Bf-blender-cvs] [8047aec] compositor-2016: Fix T48571: Cycles/GPU - A lot of fireflies on SSS+Volume

2016-06-08 Thread Sergey Sharybin
Commit: 8047aecf4bd713070646c521859fd13d3f6919db
Author: Sergey Sharybin
Date:   Mon Jun 6 15:56:22 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB8047aecf4bd713070646c521859fd13d3f6919db

Fix T48571: Cycles/GPU - A lot of fireflies on SSS+Volume

Was some accumulated precision error happening.

===

M   intern/cycles/kernel/kernel_volume.h

===

diff --git a/intern/cycles/kernel/kernel_volume.h 
b/intern/cycles/kernel/kernel_volume.h
index e1ea60f..0e313b8 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -1216,6 +1216,7 @@ ccl_device void 
kernel_volume_stack_update_for_subsurface(KernelGlobals *kg,
 #  else
Intersection isect;
int step = 0;
+   float3 Pend = ray->P + ray->D*ray->t;
while(step < 2 * VOLUME_STACK_SIZE &&
  scene_intersect_volume(kg,
 &volume_ray,
@@ -1227,7 +1228,9 @@ ccl_device void 
kernel_volume_stack_update_for_subsurface(KernelGlobals *kg,
 
/* Move ray forward. */
volume_ray.P = ray_offset(stack_sd->P, -stack_sd->Ng);
-   volume_ray.t -= stack_sd->ray_length;
+   if(volume_ray.t != FLT_MAX) {
+   volume_ray.D = normalize_len(Pend - volume_ray.P, 
&volume_ray.t);
+   }
++step;
}
 #  endif

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


[Bf-blender-cvs] [35ed533] compositor-2016: changed use_connect from bool to a 3 state value (-1, 0, 1)

2016-06-08 Thread Gaia Clary
Commit: 35ed5332695bb70c8e73a633577653ba18910d1c
Author: Gaia Clary
Date:   Fri Jun 3 18:26:12 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB35ed5332695bb70c8e73a633577653ba18910d1c

changed use_connect from bool to a 3 state value (-1,0,1)

===

M   source/blender/collada/ArmatureImporter.cpp
M   source/blender/collada/ArmatureImporter.h
M   source/blender/collada/DocumentImporter.cpp
M   source/blender/collada/ImportSettings.h
M   source/blender/collada/SkinInfo.cpp
M   source/blender/collada/collada.cpp
M   source/blender/collada/collada.h
M   source/blender/collada/collada_utils.h
M   source/blender/editors/io/io_collada.c

===

diff --git a/source/blender/collada/ArmatureImporter.cpp 
b/source/blender/collada/ArmatureImporter.cpp
index fca9b9f..1bc2bff 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -107,27 +107,39 @@ int ArmatureImporter::create_bone(SkinInfo *skin, 
COLLADAFW::Node *node, EditBon
std::vector::iterator it;
it = std::find(finished_joints.begin(), finished_joints.end(), node);
if (it != finished_joints.end()) return chain_length;
-
-   // JointData* jd = get_joint_data(node);

-   // TODO rename from Node "name" attrs later
EditBone *bone = ED_armature_edit_bone_add(arm, (char 
*)bc_get_joint_name(node));
totbone++;
 
-   if (skin && skin->get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) {
-   // get original world-space matrix
-   invert_m4_m4(mat, joint_inv_bind_mat);
+   /*
+* We use the inv_bind_shape matrix to apply the armature bind pose as 
its rest pose.
+   */
+
+   std::map::iterator skin_it;
+   bool bone_is_not_skinned = true;
+   for (skin_it = skin_by_data_uid.begin(); skin_it != 
skin_by_data_uid.end(); skin_it++) {
+
+   SkinInfo *b = &skin_it->second;
+   if (b->get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) {
 
-   // And make local to armature
-   Object *ob_arm = skin->BKE_armature_from_object();
-   if (ob_arm) {
-   float invmat[4][4];
-   invert_m4_m4(invmat, ob_arm->obmat);
-   mul_m4_m4m4(mat, invmat, mat);
+   // get original world-space matrix
+   invert_m4_m4(mat, joint_inv_bind_mat);
+
+   // And make local to armature
+   Object *ob_arm = skin->BKE_armature_from_object();
+   if (ob_arm) {
+   float invmat[4][4];
+   invert_m4_m4(invmat, ob_arm->obmat);
+   mul_m4_m4m4(mat, invmat, mat);
+   }
+
+   bone_is_not_skinned = false;
+   break;
}
}
+
// create a bone even if there's no joint data for it (i.e. it has no 
influence)
-   else {
+   if (bone_is_not_skinned) {
float obmat[4][4];
// bone-space
get_node_mat(obmat, node, NULL, NULL);
@@ -145,7 +157,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, 
COLLADAFW::Node *node, EditBon
 
float loc[3], size[3], rot[3][3]; 
 
-   BoneExtended &be = add_bone_extended(bone, node, layer_labels);
+   BoneExtended &be = add_bone_extended(bone, node, totchild, 
layer_labels);
int layer = be.get_bone_layers();
if (layer) bone->layer = layer;
arm->layer |= layer; // ensure that all populated bone layers are 
visible after import
@@ -168,7 +180,6 @@ int ArmatureImporter::create_bone(SkinInfo *skin, 
COLLADAFW::Node *node, EditBon
mat4_to_loc_rot_size(loc, rot, size, mat);
mat3_to_vec_roll(rot, NULL, &angle);
}
-
copy_v3_v3(bone->head, mat[3]);
add_v3_v3v3(bone->tail, bone->head, tail); //tail must be non zero
 
@@ -434,12 +445,12 @@ ArmatureJoints& 
ArmatureImporter::get_armature_joints(Object *ob_arm)
return armature_joints.back();
 }
 #endif
-void ArmatureImporter::create_armature_bones( )
+Object *ArmatureImporter::create_armature_bones(std::vector &ob_arms)
 {
std::vector::iterator ri;
std::vector layer_labels;
+   Object *ob_arm = NULL;
 
-   leaf_bone_length = FLT_MAX;
//if there is an armature created for root_joint next root_joint
for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
if (get_armature_for_joint(*ri) != NULL) continue;
@@ -467,34 +478,21 @@ void ArmatureImporter::create_armature_bones( )
create_bone(NULL, *ri , NULL, 
(*ri)->getChildNodes().getCount(), NULL, armature, layer_labels);
 
/* 

[Bf-blender-cvs] [95c6637] compositor-2016: Cycles: Add support of processor groups

2016-06-08 Thread Sergey Sharybin
Commit: 95c663791ce154fbd9b81005f2c397344c46ab70
Author: Sergey Sharybin
Date:   Sat Jun 4 01:29:13 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB95c663791ce154fbd9b81005f2c397344c46ab70

Cycles: Add support of processor groups

Currently for windows only, this is an initial commit towards native
support of NUMA.

Current commit makes it so Cycles will use all logical processors on
Windows running on system with more than 64 threads.

Reviewers: juicyfruit, dingto, lukasstockner97, maiself, brecht

Subscribers: LazyDodo

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

===

M   intern/cycles/util/CMakeLists.txt
M   intern/cycles/util/util_system.cpp
M   intern/cycles/util/util_system.h
M   intern/cycles/util/util_task.cpp
A   intern/cycles/util/util_thread.cpp
M   intern/cycles/util/util_thread.h
A   intern/cycles/util/util_windows.cpp
M   intern/cycles/util/util_windows.h

===

diff --git a/intern/cycles/util/CMakeLists.txt 
b/intern/cycles/util/CMakeLists.txt
index cceec8d..e6140b3 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -19,8 +19,10 @@ set(SRC
util_simd.cpp
util_system.cpp
util_task.cpp
+   util_thread.cpp
util_time.cpp
util_transform.cpp
+   util_windows.cpp
 )
 
 if(NOT CYCLES_STANDALONE_REPOSITORY)
diff --git a/intern/cycles/util/util_system.cpp 
b/intern/cycles/util/util_system.cpp
index 4ff0ee9..16f713e 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -15,7 +15,9 @@
  */
 
 #include "util_system.h"
+
 #include "util_debug.h"
+#include "util_logging.h"
 #include "util_types.h"
 #include "util_string.h"
 
@@ -33,28 +35,57 @@
 
 CCL_NAMESPACE_BEGIN
 
-int system_cpu_thread_count()
+int system_cpu_group_count()
 {
-   static uint count = 0;
-
-   if(count > 0)
-   return count;
+#ifdef _WIN32
+   util_windows_init_numa_groups();
+   return GetActiveProcessorGroupCount();
+#else
+   /* TODO(sergey): Need to adopt for other platforms. */
+   return 1;
+#endif
+}
 
+int system_cpu_group_thread_count(int group)
+{
+   /* TODO(sergey): Need make other platforms aware of groups. */
 #ifdef _WIN32
-   SYSTEM_INFO info;
-   GetSystemInfo(&info);
-   count = (uint)info.dwNumberOfProcessors;
+   util_windows_init_numa_groups();
+   return GetActiveProcessorCount(group);
 #elif defined(__APPLE__)
+   (void)group;
size_t len = sizeof(count);
int mib[2] = { CTL_HW, HW_NCPU };
-   
+
+   int count;
sysctl(mib, 2, &count, &len, NULL, 0);
+   return count;
 #else
-   count = (uint)sysconf(_SC_NPROCESSORS_ONLN);
+   (void)group;
+   return sysconf(_SC_NPROCESSORS_ONLN);
 #endif
+}
+
+int system_cpu_thread_count()
+{
+   static uint count = 0;
 
-   if(count < 1)
+   if(count > 0) {
+   return count;
+   }
+
+   int max_group = system_cpu_group_count();
+   VLOG(1) << "Detected " << max_group << " CPU groups.";
+   for(int group = 0; group < max_group; ++group) {
+   int num_threads = system_cpu_group_thread_count(group);
+   VLOG(1) << "Group " << group
+   << " has " << num_threads << " threads.";
+   count += num_threads;
+   }
+
+   if(count < 1) {
count = 1;
+   }
 
return count;
 }
diff --git a/intern/cycles/util/util_system.h b/intern/cycles/util/util_system.h
index 4e7e00f..557aab6 100644
--- a/intern/cycles/util/util_system.h
+++ b/intern/cycles/util/util_system.h
@@ -21,7 +21,15 @@
 
 CCL_NAMESPACE_BEGIN
 
+/* Get number of available CPU groups. */
+int system_cpu_group_count();
+
+/* Get number of threads/processors in the specified group. */
+int system_cpu_group_thread_count(int group);
+
+/* Get total number of threads in all groups. */
 int system_cpu_thread_count();
+
 string system_cpu_brand_string();
 int system_cpu_bits();
 bool system_cpu_support_sse2();
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index d86aa8a..352ba81 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -16,6 +16,7 @@
 
 #include "util_debug.h"
 #include "util_foreach.h"
+#include "util_logging.h"
 #include "util_system.h"
 #include "util_task.h"
 #include "util_time.h"
@@ -198,12 +199,30 @@ void TaskScheduler::init(int num_threads)
/* automatic number of threads */
num_threads = system_cpu_thread_count();
}
+   VLOG(1) << "Creating pool of " << num_threads << " threads.";
 
/* launch threads that will be waiting for work */
threads.resize(num_threads);
 
-   for(size_t i = 0

[Bf-blender-cvs] [6ddba9d] compositor-2016: Support Vertex Color in GLSL viewport for Cycles

2016-06-08 Thread Sergey Sharybin
Commit: 6ddba9d8df619c43a1b4b0f3a08443077f078656
Author: Sergey Sharybin
Date:   Sun May 22 18:24:53 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB6ddba9d8df619c43a1b4b0f3a08443077f078656

Support Vertex Color in GLSL viewport for Cycles

The title says it all actually.

Added special custom data type, because we don't know in advance
whether we're referencing UV or Color layer. Also made it so vertex
attributes are normalized.

TODO: Border render in viewport ignores the normalization of the
attribute array for some reason, will be looked into still.

Reviewers: mont29, brecht, campbellbarton

Reviewed By: brecht, campbellbarton

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

===

M   source/blender/blenkernel/intern/DerivedMesh.c
M   source/blender/gpu/intern/gpu_buffers.c
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/makesdna/DNA_customdata_types.h
M   source/blender/nodes/shader/nodes/node_shader_attribute.c

===

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 1bfc3d9..9c500fa 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3629,12 +3629,41 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, 
GPUVertexAttribs *gattribs,
dm->calcLoopTangents(dm, false, (const char 
(*)[MAX_NAME])tangent_names, tangent_names_count);
 
for (b = 0; b < gattribs->totlayer; b++) {
-   if (gattribs->layer[b].type == CD_MTFACE) {
+   int type = gattribs->layer[b].type;
+   layer = -1;
+   if (type == CD_AUTO_FROM_NAME) {
+   /* We need to deduct what exact layer is used.
+*
+* We do it based on the specified name.
+*/
+   if (gattribs->layer[b].name[0]) {
+   layer = 
CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, 
gattribs->layer[b].name);
+   type = CD_TANGENT;
+   if (layer == -1) {
+   layer = 
CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, gattribs->layer[b].name);
+   type = CD_MCOL;
+   }
+   if (layer == -1) {
+   layer = 
CustomData_get_named_layer_index(ldata, CD_MLOOPUV, gattribs->layer[b].name);
+   type = CD_MTFACE;
+   }
+   if (layer == -1) {
+   continue;
+   }
+   }
+   else {
+   /* Fall back to the UV layer, which matches old 
behavior. */
+   type = CD_MTFACE;
+   }
+   }
+   if (type == CD_MTFACE) {
/* uv coordinates */
-   if (gattribs->layer[b].name[0])
-   layer = CustomData_get_named_layer_index(ldata, 
CD_MLOOPUV, gattribs->layer[b].name);
-   else
-   layer = 
CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
+   if (layer == -1) {
+   if (gattribs->layer[b].name[0])
+   layer = 
CustomData_get_named_layer_index(ldata, CD_MLOOPUV, gattribs->layer[b].name);
+   else
+   layer = 
CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
+   }
 
a = attribs->tottface++;
 
@@ -3650,11 +3679,13 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, 
GPUVertexAttribs *gattribs,
attribs->tface[a].gl_index = gattribs->layer[b].glindex;
attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
}
-   else if (gattribs->layer[b].type == CD_MCOL) {
-   if (gattribs->layer[b].name[0])
-   layer = CustomData_get_named_layer_index(ldata, 
CD_MLOOPCOL, gattribs->layer[b].name);
-   else
-   layer = 
CustomData_get_active_layer_index(ldata, CD_MLOOPCOL);
+   else if (type == CD_MCOL) {
+   if (layer == -1) {
+   if (gattribs->layer[b].name[0])
+   layer = 
CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, gattribs->layer[b].name);
+   else

[Bf-blender-cvs] [3b30b3c] compositor-2016: Fix T48527: Maya keymap fails w/ knife snap

2016-06-08 Thread Campbell Barton
Commit: 3b30b3c04d243494bed559d5f3a979f4a9d26ca7
Author: Campbell Barton
Date:   Mon May 30 22:39:40 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB3b30b3c04d243494bed559d5f3a979f4a9d26ca7

Fix T48527: Maya keymap fails w/ knife snap

===

M   release/scripts/presets/keyconfig/maya.py

===

diff --git a/release/scripts/presets/keyconfig/maya.py 
b/release/scripts/presets/keyconfig/maya.py
index cdd16f2..67fd1fd 100644
--- a/release/scripts/presets/keyconfig/maya.py
+++ b/release/scripts/presets/keyconfig/maya.py
@@ -698,7 +698,7 @@ kmi.properties.level = 5
 km = kc.keymaps.new('Knife Tool Modal Map', space_type='EMPTY', 
region_type='WINDOW', modal=True)
 
 kmi = km.keymap_items.new_modal('CANCEL', 'ESC', 'ANY', any=True)
-kmi = km.keymap_items.new_modal('ADD_CUT', 'LEFTMOUSE', 'ANY')
+kmi = km.keymap_items.new_modal('ADD_CUT', 'LEFTMOUSE', 'ANY', any=True)
 kmi = km.keymap_items.new_modal('PANNING', 'LEFTMOUSE', 'ANY', alt=True)
 kmi = km.keymap_items.new_modal('PANNING', 'MIDDLEMOUSE', 'ANY', alt=True)
 kmi = km.keymap_items.new_modal('PANNING', 'RIGHTMOUSE', 'ANY', alt=True)

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


[Bf-blender-cvs] [2ce8dd9] compositor-2016: Fix Cycles warning in release builds.

2016-06-08 Thread Brecht Van Lommel
Commit: 2ce8dd91e9e13f6f7988aef1418d0934617f15f3
Author: Brecht Van Lommel
Date:   Sun May 22 19:42:45 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB2ce8dd91e9e13f6f7988aef1418d0934617f15f3

Fix Cycles warning in release builds.

===

M   intern/cycles/graph/node.cpp

===

diff --git a/intern/cycles/graph/node.cpp b/intern/cycles/graph/node.cpp
index d9a6bde..d482577 100644
--- a/intern/cycles/graph/node.cpp
+++ b/intern/cycles/graph/node.cpp
@@ -55,6 +55,7 @@ static T& get_socket_value(const Node *node, const 
SocketType& socket)
return (T&)*(((char*)node) + socket.struct_offset);
 }
 
+#ifndef NDEBUG
 static bool is_socket_float3(const SocketType& socket)
 {
return socket.type == SocketType::COLOR ||
@@ -70,6 +71,7 @@ static bool is_socket_array_float3(const SocketType& socket)
   socket.type == SocketType::VECTOR_ARRAY ||
   socket.type == SocketType::NORMAL_ARRAY;
 }
+#endif
 
 /* set values */
 void Node::set(const SocketType& input, bool value)

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


[Bf-blender-cvs] [b522e4b] compositor-2016: Fix T48514: Cycles toon glossy BSDF not respecting reflective caustics option.

2016-06-08 Thread Brecht Van Lommel
Commit: b522e4b7cfb7762f86a29e891336a923ce25535a
Author: Brecht Van Lommel
Date:   Wed May 25 21:10:36 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBb522e4b7cfb7762f86a29e891336a923ce25535a

Fix T48514: Cycles toon glossy BSDF not respecting reflective caustics option.

===

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

===

diff --git a/intern/cycles/kernel/svm/svm_closure.h 
b/intern/cycles/kernel/svm/svm_closure.h
index 8839700..65512a0 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -365,8 +365,12 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
}
break;
}
-   case CLOSURE_BSDF_DIFFUSE_TOON_ID:
-   case CLOSURE_BSDF_GLOSSY_TOON_ID: {
+   case CLOSURE_BSDF_GLOSSY_TOON_ID:
+#ifdef __CAUSTICS_TRICKS__
+   if(!kernel_data.integrator.caustics_reflective && 
(path_flag & PATH_RAY_DIFFUSE))
+   break;
+#endif
+   case CLOSURE_BSDF_DIFFUSE_TOON_ID: {
ShaderClosure *sc = svm_node_closure_get_bsdf(sd, 
mix_weight);
 
if(sc) {

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


[Bf-blender-cvs] [343ccb7] compositor-2016: BLI_ghash: Fix initial over-allocation of mempool chunks.

2016-06-08 Thread Bastien Montagne
Commit: 343ccb7417c22d54a4a357f1f6f073fc60ae1cd7
Author: Bastien Montagne
Date:   Wed Jun 1 12:58:59 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB343ccb7417c22d54a4a357f1f6f073fc60ae1cd7

BLI_ghash: Fix initial over-allocation of mempool chunks.

Code intended to create only one pool by default here, but code in 
`mempool_maxchunks()` would make it two.

===

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

===

diff --git a/source/blender/blenlib/intern/BLI_ghash.c 
b/source/blender/blenlib/intern/BLI_ghash.c
index 05f2d92..0b5adab 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -441,7 +441,7 @@ static GHash *ghash_new(GHashHashFP hashfp, GHashCmpFP 
cmpfp, const char *info,
gh->flag = flag;
 
ghash_buckets_reset(gh, nentries_reserve);
-   gh->entrypool = BLI_mempool_create(GHASH_ENTRY_SIZE(flag & 
GHASH_FLAG_IS_GSET), 64, 64, BLI_MEMPOOL_NOP);
+   gh->entrypool = BLI_mempool_create(GHASH_ENTRY_SIZE(flag & 
GHASH_FLAG_IS_GSET), 0, 64, BLI_MEMPOOL_NOP);
 
return gh;
 }

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


[Bf-blender-cvs] [17f716b] compositor-2016: Fix own mistake in D1120: wrong indexing of UV maps during tangent calculation

2016-06-08 Thread Alexander Romanov
Commit: 17f716be679a5b6079ca84d98e4321d10af17087
Author: Alexander Romanov
Date:   Tue May 24 17:43:57 2016 +0300
Branches: compositor-2016
https://developer.blender.org/rB17f716be679a5b6079ca84d98e4321d10af17087

Fix own mistake in D1120: wrong indexing of UV maps during tangent calculation

===

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

===

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 423b8fa..a3e7e5f 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3269,17 +3269,18 @@ void DM_calc_loop_tangents_step_0(
 bool *rcalc_act, bool *rcalc_ren, int *ract_uv_n, int *rren_uv_n,
 char *ract_uv_name, char *rren_uv_name, char *rtangent_mask) {
/* Active uv in viewport */
+   int layer_index = CustomData_get_layer_index(loopData, CD_MLOOPUV);
*ract_uv_n = CustomData_get_active_layer(loopData, CD_MLOOPUV);
ract_uv_name[0] = 0;
if (*ract_uv_n != -1) {
-   strcpy(ract_uv_name, loopData->layers[*ract_uv_n].name);
+   strcpy(ract_uv_name, loopData->layers[*ract_uv_n + 
layer_index].name);
}
 
/* Active tangent in render */
*rren_uv_n = CustomData_get_render_layer(loopData, CD_MLOOPUV);
rren_uv_name[0] = 0;
if (*rren_uv_n != -1) {
-   strcpy(rren_uv_name, loopData->layers[*rren_uv_n].name);
+   strcpy(rren_uv_name, loopData->layers[*rren_uv_n + 
layer_index].name);
}
 
/* If active tangent not in tangent_names we take it into account */

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


[Bf-blender-cvs] [3d918dc] compositor-2016: Depsgraph: Fix compilation with new depsgraph disabled

2016-06-08 Thread Sergey Sharybin
Commit: 3d918dce7ad92b426695ff9ca33d6e383528fb4a
Author: Sergey Sharybin
Date:   Mon May 30 14:44:56 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB3d918dce7ad92b426695ff9ca33d6e383528fb4a

Depsgraph: Fix compilation with new depsgraph disabled

===

M   source/blender/depsgraph/util/deg_util_function.h

===

diff --git a/source/blender/depsgraph/util/deg_util_function.h 
b/source/blender/depsgraph/util/deg_util_function.h
index be7d1e1..1e34ae0 100644
--- a/source/blender/depsgraph/util/deg_util_function.h
+++ b/source/blender/depsgraph/util/deg_util_function.h
@@ -56,6 +56,7 @@ using boost::function;
 
 #define DISABLE_NEW_DEPSGRAPH
 
+#include "BLI_utildefines.h"
 #include 
 
 template

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


[Bf-blender-cvs] [fa3b815] compositor-2016: Fix T48395: Grease Pencil, pressing Ekey to sculpt don't work for left click configurations

2016-06-08 Thread Joshua Leung
Commit: fa3b815a7705acb638c89a756b64191d3e752b93
Author: Joshua Leung
Date:   Wed May 18 17:23:16 2016 +1200
Branches: compositor-2016
https://developer.blender.org/rBfa3b815a7705acb638c89a756b64191d3e752b93

Fix T48395: Grease Pencil, pressing Ekey to sculpt don't work for left click 
configurations

When using Left Click select, it wasn't possible to sculpt using E+LMB.

I've changed the order of things in the keymap so that the select operator won't
end up catching and blocking all these events.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_ops.c 
b/source/blender/editors/gpencil/gpencil_ops.c
index 7241d4b..cf9828f 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -140,6 +140,36 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, 
KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path_primary", 
"user_preferences.edit.grease_pencil_eraser_radius");

+   
+   /* Sculpting - */
+   
+   /* Brush-Based Editing:
+*   EKEY + LMB  = Single stroke, draw 
immediately 
+*+ Other Modifiers (Ctrl/Shift) = Invert, Smooth, etc.
+*
+* For the modal version, use D+E -> Sculpt
+*/
+   kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, 
KM_PRESS, 0, EKEY);
+   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
+   
+   kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, 
KM_PRESS, KM_CTRL, EKEY);
+   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
+   /*RNA_boolean_set(kmi->ptr, "use_invert", true);*/
+   
+   kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, 
KM_PRESS, KM_SHIFT, EKEY);
+   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
+   /*RNA_boolean_set(kmi->ptr, "use_smooth", true);*/
+   
+   
+   /* Shift-FKEY = Sculpt Strength */
+   kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, 
KM_PRESS, KM_SHIFT, 0);
+   RNA_string_set(kmi->ptr, "data_path_primary", 
"tool_settings.gpencil_sculpt.brush.strength");
+   
+   /* Ctrl-FKEY = Sculpt Brush Size */
+   kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, 
KM_PRESS, KM_CTRL, 0);
+   RNA_string_set(kmi->ptr, "data_path_primary", 
"tool_settings.gpencil_sculpt.brush.size");
+   
+   
/* Selection - */
/* select all */
kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", AKEY, 
KM_PRESS, 0, 0);
@@ -238,36 +268,6 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "GPENCIL_OT_move_to_layer", MKEY, KM_PRESS, 
0, 0);


-   
-   /* Brush-Based Editing:
-*   EKEY + LMB  = Single stroke, draw 
immediately 
-*+ Other Modifiers (Ctrl/Shift) = Invert, Smooth, etc.
-*
-* For the modal version, use D+E -> Sculpt
-*/
-   kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, 
KM_PRESS, 0, EKEY);
-   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
-   
-   kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, 
KM_PRESS, KM_CTRL, EKEY);
-   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
-   /*RNA_boolean_set(kmi->ptr, "use_invert", true);*/
-   
-   kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_brush_paint", LEFTMOUSE, 
KM_PRESS, KM_SHIFT, EKEY);
-   RNA_boolean_set(kmi->ptr, "wait_for_input", false);
-   /*RNA_boolean_set(kmi->ptr, "use_smooth", true);*/
-   
-   
-   /* Shift-FKEY = Sculpt Strength */
-   kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, 
KM_PRESS, KM_SHIFT, 0);
-   RNA_string_set(kmi->ptr, "data_path_primary", 
"tool_settings.gpencil_sculpt.brush.strength");
-   
-   /* Ctrl-FKEY = Sculpt Brush Size */
-   kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, 
KM_PRESS, KM_CTRL, 0);
-   RNA_string_set(kmi->ptr, "data_path_primary", 
"tool_settings.gpencil_sculpt.brush.size");
-   
-   
-   
-   
/* Transform Tools */
kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, 
KM_PRESS, 0, 0);

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


[Bf-blender-cvs] [2f0d5eb] compositor-2016: Cycles GLSL: Make it work with software opengl mode

2016-06-08 Thread Sergey Sharybin
Commit: 2f0d5eb93e199f0a93b98e0342149e8a5de53114
Author: Sergey Sharybin
Date:   Tue May 31 12:30:56 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB2f0d5eb93e199f0a93b98e0342149e8a5de53114

Cycles GLSL: Make it work with software opengl mode

===

M   source/blender/gpu/shaders/gpu_shader_material.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 666857c..dae66ce 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2804,11 +2804,11 @@ void node_tex_checker(vec3 co, vec4 color1, vec4 
color2, float scale, out vec4 c
p.y = (p.y + 0.01) * 0.99;
p.z = (p.z + 0.01) * 0.99;
 
-   int xi = abs(int(floor(p.x)));
-   int yi = abs(int(floor(p.y)));
-   int zi = abs(int(floor(p.z)));
+   int xi = int(abs(floor(p.x)));
+   int yi = int(abs(floor(p.y)));
+   int zi = int(abs(floor(p.z)));
 
-   bool check = ((xi % 2 == yi % 2) == bool(zi % 2));
+   bool check = ((mod(xi, 2) == mod(yi, 2)) == bool(mod(zi, 2)));
 
color = check ? color1 : color2;
fac = check ? 1.0 : 0.0;

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


[Bf-blender-cvs] [d565b86] compositor-2016: Cleanup: Use short condition style.

2016-06-08 Thread Thomas Dinges
Commit: d565b861e6f31f09d8a371b7ebf22ad0c78fdcbc
Author: Thomas Dinges
Date:   Sun May 22 22:47:37 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBd565b861e6f31f09d8a371b7ebf22ad0c78fdcbc

Cleanup: Use short condition style.

===

M   intern/cycles/render/image.cpp

===

diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 9f40e56..150c742 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -141,19 +141,11 @@ ImageManager::ImageDataType 
ImageManager::get_image_metadata(const string& filen
 
if(is_float) {
is_linear = true;
-
-   if(channels > 1)
-   return IMAGE_DATA_TYPE_FLOAT4;
-   else
-   return IMAGE_DATA_TYPE_FLOAT;
+   return (channels > 1) ? IMAGE_DATA_TYPE_FLOAT4 : 
IMAGE_DATA_TYPE_FLOAT;
}
else {
-   if(channels > 1)
-   return IMAGE_DATA_TYPE_BYTE4;
-   else
-   return IMAGE_DATA_TYPE_BYTE;
+   return (channels > 1) ? IMAGE_DATA_TYPE_BYTE4 : 
IMAGE_DATA_TYPE_BYTE;
}
-
}
 
ImageInput *in = ImageInput::create(filename);
@@ -202,16 +194,10 @@ ImageManager::ImageDataType 
ImageManager::get_image_metadata(const string& filen
}
 
if(is_float) {
-   if(channels > 1)
-   return IMAGE_DATA_TYPE_FLOAT4;
-   else
-   return IMAGE_DATA_TYPE_FLOAT;
+   return (channels > 1) ? IMAGE_DATA_TYPE_FLOAT4 : 
IMAGE_DATA_TYPE_FLOAT;
}
else {
-   if(channels > 1)
-   return IMAGE_DATA_TYPE_BYTE4;
-   else
-   return IMAGE_DATA_TYPE_BYTE;
+   return (channels > 1) ? IMAGE_DATA_TYPE_BYTE4 : 
IMAGE_DATA_TYPE_BYTE;
}
 }

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


[Bf-blender-cvs] [cd62b50] compositor-2016: Dynamicpaint: fix (unreported) missing progress bar in early baking stage.

2016-06-08 Thread Bastien Montagne
Commit: cd62b50b6c3234b966faa65389f01a880b658835
Author: Bastien Montagne
Date:   Sat May 21 16:09:35 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBcd62b50b6c3234b966faa65389f01a880b658835

Dynamicpaint: fix (unreported) missing progress bar in early baking stage.

Nothing was shown in UI during pre-bake step, while it can take several minutes
to complete with heavy geometry.

===

M   source/blender/blenkernel/BKE_dynamicpaint.h
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/editors/physics/dynamicpaint_ops.c

===

diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h 
b/source/blender/blenkernel/BKE_dynamicpaint.h
index 0025617..5abb53d 100644
--- a/source/blender/blenkernel/BKE_dynamicpaint.h
+++ b/source/blender/blenkernel/BKE_dynamicpaint.h
@@ -82,7 +82,7 @@ void dynamicPaint_resetPreview(struct 
DynamicPaintCanvasSettings *canvas);
 struct DynamicPaintSurface *get_activeSurface(struct 
DynamicPaintCanvasSettings *canvas);
 
 /* image sequence baking */
-int dynamicPaint_createUVSurface(struct Scene *scene, struct 
DynamicPaintSurface *surface);
+int dynamicPaint_createUVSurface(struct Scene *scene, struct 
DynamicPaintSurface *surface, float *progress, short *do_update);
 int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct 
Scene *scene, struct Object *cObject, int frame);
 void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char 
*filename, short output_layer);
 
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 2dc0388..d593ec7 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2496,7 +2496,7 @@ static int dynamic_paint_find_neighbour_pixel(
}
 }
 
-int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface)
+int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, 
float *progress, short *do_update)
 {
/* Antialias jitter point relative coords   */
const int aa_samples = (surface->flags & MOD_DPAINT_ANTIALIAS) ? 5 : 1;
@@ -2517,6 +2517,9 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface)
Bounds2D *faceBB = NULL;
int *final_index;
 
+   *progress = 0.0f;
+   *do_update = true;
+
if (!dm)
return setError(canvas, N_("Canvas mesh not updated"));
if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ)
@@ -2575,6 +2578,9 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface)
error = true;
}
 
+   *progress = 0.01f;
+   *do_update = true;
+
if (!error) {
for (int i = 0; i < tottri; i++) {
copy_v2_v2(faceBB[i].min, 
mloopuv[mlooptri[i].tri[0]].uv);
@@ -2585,6 +2591,9 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface)
}
}
 
+   *progress = 0.02f;
+   *do_update = true;
+
/* Loop through every pixel and check if pixel is uv-mapped on 
a canvas face. */
DynamicPaintCreateUVSurfaceData data = {
.surface = surface, .tempPoints = tempPoints, .tempWeights 
= tempWeights,
@@ -2593,6 +2602,9 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface)
};
BLI_task_parallel_range(0, h, &data, 
dynamic_paint_create_uv_surface_direct_cb, h > 64 || tottri > 1000);
 
+   *progress = 0.04f;
+   *do_update = true;
+
/*
 *  Now loop through every pixel that was left without index
 *  and find if they have neighboring pixels that have an 
index.
@@ -2602,6 +2614,9 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface)
data.active_points = &active_points;
BLI_task_parallel_range(0, h, &data, 
dynamic_paint_create_uv_surface_neighbor_cb, h > 64);
 
+   *progress = 0.06f;
+   *do_update = true;
+
/*  Generate surface adjacency data. */
{
int cursor = 0;
@@ -2660,6 +2675,9 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface)
}
}
 
+   *progress = 0.08f;
+   *do_update = true;
+
/* Create final surface data without inactive points */
ImgSeqFormatData *f_data = MEM_callocN(sizeof(*f_data), 
"ImgSeqFormatData");
if (f_data) {
@@ -2740,6 +2758,9 @@ int dynamicPaint_createUVSurface(Scene *scene, 
DynamicPaintSurface *surface)
dynamicPaint_setIn

[Bf-blender-cvs] [3c90304] compositor-2016: Shrinkwrap: OMP->BLI_task.

2016-06-08 Thread Bastien Montagne
Commit: 3c90304b4e1443e9285a0b4ba80690e8f66c031f
Author: Bastien Montagne
Date:   Mon May 30 17:30:06 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB3c90304b4e1443e9285a0b4ba80690e8f66c031f

Shrinkwrap: OMP->BLI_task.

Gives little to no speedup (a few percents at best).

===

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

===

diff --git a/source/blender/blenkernel/intern/shrinkwrap.c 
b/source/blender/blenkernel/intern/shrinkwrap.c
index e855f6f..b9f7afb 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -44,6 +44,7 @@
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
+#include "BLI_task.h"
 
 #include "BKE_shrinkwrap.h"
 #include "BKE_DerivedMesh.h"
@@ -58,7 +59,7 @@
 
 /* for timing... */
 #if 0
-#  include "PIL_time.h"
+#  include "PIL_time_utildefines.h"
 #else
 #  define TIMEIT_BENCH(expr, id) (expr)
 #endif
@@ -66,16 +67,88 @@
 /* Util macros */
 #define OUT_OF_MEMORY() ((void)printf("Shrinkwrap: Out of memory\n"))
 
+typedef struct ShrinkwrapCalcCBData {
+   ShrinkwrapCalcData *calc;
+
+   void *treeData;
+   void *auxData;
+   BVHTree *targ_tree;
+   BVHTree *aux_tree;
+   void *targ_callback;
+   void *aux_callback;
+
+   float *proj_axis;
+   SpaceTransform *local2aux;
+} ShrinkwrapCalcCBData;
+
 /*
  * Shrinkwrap to the nearest vertex
  *
  * it builds a kdtree of vertexs we can attach to and then
  * for each vertex performs a nearest vertex search on the tree
  */
-static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
+static void shrinkwrap_calc_nearest_vertex_cb_ex(
+void *userdata, void *userdata_chunk, const int i, const int 
UNUSED(threadid))
 {
-   int i;
+   ShrinkwrapCalcCBData *data = userdata;
+
+   ShrinkwrapCalcData *calc = data->calc;
+   BVHTreeFromMesh *treeData = data->treeData;
+   BVHTreeNearest *nearest = userdata_chunk;
+
+   float *co = calc->vertexCos[i];
+   float tmp_co[3];
+   float weight = defvert_array_find_weight_safe(calc->dvert, i, 
calc->vgroup);
+
+   if (calc->invert_vgroup) {
+   weight = 1.0f - weight;
+   }
+
+   if (weight == 0.0f) {
+   return;
+   }
+
+   /* Convert the vertex to tree coordinates */
+   if (calc->vert) {
+   copy_v3_v3(tmp_co, calc->vert[i].co);
+   }
+   else {
+   copy_v3_v3(tmp_co, co);
+   }
+   BLI_space_transform_apply(&calc->local2target, tmp_co);
+
+   /* Use local proximity heuristics (to reduce the nearest search)
+*
+* If we already had an hit before.. we assume this vertex is going to 
have a close hit to that other vertex
+* so we can initiate the "nearest.dist" with the expected value to 
that last hit.
+* This will lead in pruning of the search tree. */
+   if (nearest->index != -1)
+   nearest->dist_sq = len_squared_v3v3(tmp_co, nearest->co);
+   else
+   nearest->dist_sq = FLT_MAX;
+
+   BLI_bvhtree_find_nearest(treeData->tree, tmp_co, nearest, 
treeData->nearest_callback, treeData);
+
+
+   /* Found the nearest vertex */
+   if (nearest->index != -1) {
+   /* Adjusting the vertex weight,
+* so that after interpolating it keeps a certain distance from 
the nearest position */
+   if (nearest->dist_sq > FLT_EPSILON) {
+   const float dist = sqrtf(nearest->dist_sq);
+   weight *= (dist - calc->keepDist) / dist;
+   }
+
+   /* Convert the coordinates back to mesh coordinates */
+   copy_v3_v3(tmp_co, nearest->co);
+   BLI_space_transform_invert(&calc->local2target, tmp_co);
+
+   interp_v3_v3v3(co, co, tmp_co, weight);  /* linear 
interpolation */
+   }
+}
 
+static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
+{
BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
BVHTreeNearest nearest  = NULL_BVHTreeNearest;
 
@@ -89,61 +162,11 @@ static void 
shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
/* Setup nearest */
nearest.index = -1;
nearest.dist_sq = FLT_MAX;
-#ifndef __APPLE__
-#pragma omp parallel for default(none) private(i) firstprivate(nearest) 
shared(treeData, calc) schedule(static) if (calc->numVerts > BKE_MESH_OMP_LIMIT)
-#endif
-   for (i = 0; i < calc->numVerts; ++i) {
-   float *co = calc->vertexCos[i];
-   float tmp_co[3];
-   float weight = defvert_array_find_weight_safe(calc->dvert, i, 
calc->vgroup);
-
-   if (calc->invert_vgroup) {
-   weight = 1.0f - weight;
-   }
-
-   if (weight == 0.0f) {
-   continue;
-  

[Bf-blender-cvs] [d22c061] compositor-2016: Cycles: Reduce amount of malloc() calls from the kernel

2016-06-08 Thread Sergey Sharybin
Commit: d22c061d15f6bb64ef8ce5138467869227bb4dc5
Author: Sergey Sharybin
Date:   Tue May 17 12:30:46 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBd22c061d15f6bb64ef8ce5138467869227bb4dc5

Cycles: Reduce amount of malloc() calls from the kernel

This commit makes it so malloc() is only happening once per volume and
once per transparent shadow query (per thread), improving scalability of
the code to multiple CPU cores.

Hard to measure this with a low-bottom i7 here currently, but from quick
tests seems volume sampling gave about 3-5% speedup.

The idea is to store allocated memory in kernel globals, which are per
thread on CPU already.

Reviewers: dingto, juicyfruit, lukasstockner97, maiself, brecht

Reviewed By: brecht

Subscribers: Blendify, nutel

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

===

M   intern/cycles/device/device_cpu.cpp
M   intern/cycles/kernel/kernel_globals.h
M   intern/cycles/kernel/kernel_shadow.h
M   intern/cycles/kernel/kernel_volume.h

===

diff --git a/intern/cycles/device/device_cpu.cpp 
b/intern/cycles/device/device_cpu.cpp
index 676b1279..275ee02 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -213,12 +213,7 @@ public:
return;
}
 
-   KernelGlobals kg = kernel_globals;
-
-#ifdef WITH_OSL
-   OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
-#endif
-
+   KernelGlobals kg = thread_kernel_globals_init();
RenderTile tile;
 
void(*path_trace_kernel)(KernelGlobals*, float*, unsigned int*, 
int, int, int, int, int);
@@ -289,9 +284,7 @@ public:
}
}
 
-#ifdef WITH_OSL
-   OSLShader::thread_free(&kg);
-#endif
+   thread_kernel_globals_free(&kg);
}
 
void thread_film_convert(DeviceTask& task)
@@ -481,6 +474,40 @@ public:
{
task_pool.cancel();
}
+
+protected:
+   inline KernelGlobals thread_kernel_globals_init()
+   {
+   KernelGlobals kg = kernel_globals;
+   kg.transparent_shadow_intersections = NULL;
+   const int decoupled_count = sizeof(kg.decoupled_volume_steps) /
+   sizeof(*kg.decoupled_volume_steps);
+   for(int i = 0; i < decoupled_count; ++i) {
+   kg.decoupled_volume_steps[i] = NULL;
+   }
+   kg.decoupled_volume_steps_index = 0;
+#ifdef WITH_OSL
+   OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
+#endif
+   return kg;
+   }
+
+   inline void thread_kernel_globals_free(KernelGlobals *kg)
+   {
+   if(kg->transparent_shadow_intersections != NULL) {
+   free(kg->transparent_shadow_intersections);
+   }
+   const int decoupled_count = sizeof(kg->decoupled_volume_steps) /
+   sizeof(*kg->decoupled_volume_steps);
+   for(int i = 0; i < decoupled_count; ++i) {
+   if(kg->decoupled_volume_steps[i] != NULL) {
+   free(kg->decoupled_volume_steps[i]);
+   }
+   }
+#ifdef WITH_OSL
+   OSLShader::thread_free(kg);
+#endif
+   }
 };
 
 Device *device_cpu_create(DeviceInfo& info, Stats &stats, bool background)
diff --git a/intern/cycles/kernel/kernel_globals.h 
b/intern/cycles/kernel/kernel_globals.h
index c44ea1b..7e6cdf9 100644
--- a/intern/cycles/kernel/kernel_globals.h
+++ b/intern/cycles/kernel/kernel_globals.h
@@ -31,6 +31,9 @@ struct OSLThreadData;
 struct OSLShadingSystem;
 #  endif
 
+struct Intersection;
+struct VolumeStep;
+
 typedef struct KernelGlobals {
texture_image_uchar4 texture_byte4_images[TEX_NUM_BYTE4_IMAGES_CPU];
texture_image_float4 texture_float4_images[TEX_NUM_FLOAT4_IMAGES_CPU];
@@ -51,6 +54,14 @@ typedef struct KernelGlobals {
OSLThreadData *osl_tdata;
 #  endif
 
+   /*  Run-time data   */
+
+   /* Heap-allocated storage for transparent shadows intersections. */
+   Intersection *transparent_shadow_intersections;
+
+   /* Storage for decoupled volume steps. */
+   VolumeStep *decoupled_volume_steps[2];
+   int decoupled_volume_steps_index;
 } KernelGlobals;
 
 #endif  /* __KERNEL_CPU__ */
diff --git a/intern/cycles/kernel/kernel_shadow.h 
b/intern/cycles/kernel/kernel_shadow.h
index 3be..504ac2e 100644
--- a/intern/cycles/kernel/kernel_shadow.h
+++ b/intern/cycles/kernel/kernel_shadow.h
@@ -59,14 +59,20 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, 
PathState *state, Ray *
/* intersect to find an opaque surface, or record all 
trans

[Bf-blender-cvs] [c14b0f3] compositor-2016: Fix issue in with multiple importance sampling in recent code refactor.

2016-06-08 Thread Brecht Van Lommel
Commit: c14b0f3f7a623d2d437e478a1a4e5413a939bebe
Author: Brecht Van Lommel
Date:   Wed May 18 01:50:35 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBc14b0f3f7a623d2d437e478a1a4e5413a939bebe

Fix issue in with multiple importance sampling in recent code refactor.

===

M   intern/cycles/render/light.cpp
M   intern/cycles/render/mesh_displace.cpp

===

diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 4564b93..91a9f22 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -233,7 +233,9 @@ void LightManager::device_update_distribution(Device 
*device, DeviceScene *dscen
/* count triangles */
if(have_emission) {
for(size_t i = 0; i < mesh->triangles.size(); i++) {
-   Shader *shader = 
scene->shaders[mesh->shader[i]];
+   int shader_index = mesh->shader[i];
+   Shader *shader = (shader_index < 
mesh->used_shaders.size()) ?
+   mesh->used_shaders[shader_index] : 
scene->default_surface;
 
if(shader->use_mis && 
shader->has_surface_emission)
num_triangles++;
@@ -303,7 +305,9 @@ void LightManager::device_update_distribution(Device 
*device, DeviceScene *dscen
}
 
for(size_t i = 0; i < mesh->triangles.size(); i++) {
-   Shader *shader = 
scene->shaders[mesh->shader[i]];
+   int shader_index = mesh->shader[i];
+   Shader *shader = (shader_index < 
mesh->used_shaders.size()) ?
+   mesh->used_shaders[shader_index] : 
scene->default_surface;
 
if(shader->use_mis && 
shader->has_surface_emission) {
distribution[offset].x = totarea;
diff --git a/intern/cycles/render/mesh_displace.cpp 
b/intern/cycles/render/mesh_displace.cpp
index df8be4c..d19bf20 100644
--- a/intern/cycles/render/mesh_displace.cpp
+++ b/intern/cycles/render/mesh_displace.cpp
@@ -62,7 +62,9 @@ bool MeshManager::displace(Device *device, DeviceScene 
*dscene, Scene *scene, Me
 
for(size_t i = 0; i < mesh->triangles.size(); i++) {
Mesh::Triangle t = mesh->triangles[i];
-   Shader *shader = scene->shaders[mesh->shader[i]];
+   int shader_index = mesh->shader[i];
+   Shader *shader = (shader_index < mesh->used_shaders.size()) ?
+   mesh->used_shaders[shader_index] : 
scene->default_surface;
 
if(!shader->has_displacement)
continue;
@@ -146,7 +148,9 @@ bool MeshManager::displace(Device *device, DeviceScene 
*dscene, Scene *scene, Me
Attribute *attr_mP = 
mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
for(size_t i = 0; i < mesh->triangles.size(); i++) {
Mesh::Triangle t = mesh->triangles[i];
-   Shader *shader = scene->shaders[mesh->shader[i]];
+   int shader_index = mesh->shader[i];
+   Shader *shader = (shader_index < mesh->used_shaders.size()) ?
+   mesh->used_shaders[shader_index] : 
scene->default_surface;
 
if(!shader->has_displacement)
continue;

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


[Bf-blender-cvs] [82251e8] compositor-2016: Add TODO about vertex color linearization to GLSL code

2016-06-08 Thread Sergey Sharybin
Commit: 82251e87c5e780231f608730a27399bff7b9b535
Author: Sergey Sharybin
Date:   Mon May 23 14:43:03 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB82251e87c5e780231f608730a27399bff7b9b535

Add TODO about vertex color linearization to GLSL code

It's not really clear at this moment how we can detect cases
when attribute needs linearization. For now added a comment
so we don't forget about this, hopefully.

===

M   source/blender/gpu/shaders/gpu_shader_material.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 4d7f6d5..9ac9bf0 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2614,6 +2614,9 @@ void node_gamma(vec4 col, float gamma, out vec4 outcol)
 
 void node_attribute(vec3 attr, out vec4 outcol, out vec3 outvec, out float 
outf)
 {
+   /* TODO(sergey): This needs linearization for vertex color.
+* But how to detect cases when input is linear and when it's srgb?
+*/
outcol = vec4(attr, 1.0);
outvec = attr;
outf = (attr.x + attr.y + attr.z)/3.0;

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


[Bf-blender-cvs] [c9b7d56] compositor-2016: Cycles: Fix compilation error of CUDA kernels after recent volume commit

2016-06-08 Thread Sergey Sharybin
Commit: c9b7d56d0e5335f89fa4710112ec172263ea
Author: Sergey Sharybin
Date:   Wed May 18 11:15:28 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBc9b7d56d0e5335f89fa4710112ec172263ea

Cycles: Fix compilation error of CUDA kernels after recent volume commit

Apparently the code path with malloc() was enabled for CUDA.

===

M   intern/cycles/kernel/kernel_volume.h

===

diff --git a/intern/cycles/kernel/kernel_volume.h 
b/intern/cycles/kernel/kernel_volume.h
index 224c275..0af5ff5 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -627,6 +627,11 @@ ccl_device void 
kernel_volume_decoupled_record(KernelGlobals *kg, PathState *sta
step_size = kernel_data.integrator.volume_step_size;
/* compute exact steps in advance for malloc */
max_steps = max((int)ceilf(ray->t/step_size), 1);
+   if(max_steps > global_max_steps) {
+   max_steps = global_max_steps;
+   step_size = ray->t / (float)max_steps;
+   }
+#ifdef __KERNEL_CPU__
/* NOTE: For the branched path tracing it's possible to have 
direct
 * and indirect light integration both having volume segments 
allocated.
 * We detect this using index in the pre-allocated memory. 
Currently we
@@ -640,17 +645,16 @@ ccl_device void 
kernel_volume_decoupled_record(KernelGlobals *kg, PathState *sta
const int index = kg->decoupled_volume_steps_index;
assert(index < sizeof(kg->decoupled_volume_steps) /
   sizeof(*kg->decoupled_volume_steps));
-   if(max_steps > global_max_steps) {
-   max_steps = global_max_steps;
-   step_size = ray->t / (float)max_steps;
-   }
if(kg->decoupled_volume_steps[index] == NULL) {
kg->decoupled_volume_steps[index] =

(VolumeStep*)malloc(sizeof(VolumeStep)*global_max_steps);
}
segment->steps = kg->decoupled_volume_steps[index];
-   random_jitter_offset = lcg_step_float(&state->rng_congruential) 
* step_size;
++kg->decoupled_volume_steps_index;
+#else
+   segment->steps = 
(VolumeStep*)malloc(sizeof(VolumeStep)*max_steps);
+#endif
+   random_jitter_offset = lcg_step_float(&state->rng_congruential) 
* step_size;
}
else {
max_steps = 1;
@@ -764,12 +768,16 @@ ccl_device void 
kernel_volume_decoupled_record(KernelGlobals *kg, PathState *sta
 ccl_device void kernel_volume_decoupled_free(KernelGlobals *kg, VolumeSegment 
*segment)
 {
if(segment->steps != &segment->stack_step) {
+#ifdef __KERNEL_CPU__
/* NOTE: We only allow free last allocated segment.
 * No random order of alloc/free is supported.
 */
assert(kg->decoupled_volume_steps_index > 0);
assert(segment->steps == 
kg->decoupled_volume_steps[kg->decoupled_volume_steps_index - 1]);
--kg->decoupled_volume_steps_index;
+#else
+   free(segment->steps);
+#endif
}
 }

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


[Bf-blender-cvs] [5037652] compositor-2016: Enable correct GLSL output for cycles normalmap node

2016-06-08 Thread Ralf Hölzemer
Commit: 50376529ee1141f1aa2d354278ad315e0a174257
Author: Ralf Hölzemer
Date:   Mon May 23 16:12:52 2016 +0300
Branches: compositor-2016
https://developer.blender.org/rB50376529ee1141f1aa2d354278ad315e0a174257

Enable correct GLSL output for cycles normalmap node

See T48453 for details and test scenes

Reviewers: a.romanov, sergey

Reviewed By: a.romanov, sergey

Projects: #opengl_gfx, #nodes

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

===

M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/nodes/shader/nodes/node_shader_normal_map.c

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 9ac9bf0..a63e7b8 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -142,6 +142,20 @@ void color_to_normal(vec3 color, out vec3 normal)
normal.z =  2.0 * ((color.b) - 0.5);
 }
 
+void color_to_normal_new_shading(vec3 color, out vec3 normal)
+{
+   normal.x =  2.0 * ((color.r) - 0.5);
+   normal.y =  2.0 * ((color.g) - 0.5);
+   normal.z =  2.0 * ((color.b) - 0.5);
+}
+
+void color_to_blender_normal_new_shading(vec3 color, out vec3 normal)
+{
+   normal.x =  2.0 * ((color.r) - 0.5);
+   normal.y = -2.0 * ((color.g) - 0.5);
+   normal.z = -2.0 * ((color.b) - 0.5);
+}
+
 #define M_PI 3.14159265358979323846
 #define M_1_PI 0.31830988618379069
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.c 
b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
index 642e5b2..d269560 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal_map.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
@@ -121,35 +121,69 @@ static int gpu_shader_normal_map(GPUMaterial *mat, bNode 
*node, bNodeExecData *U
else
strength = GPU_uniform(in[0].vec);
 
-   if (in[1].link) {
-   GPU_link(mat, "color_to_normal", in[1].link, &realnorm);
-   GPU_link(mat, "mtex_negate_texnormal", realnorm,  &realnorm);
-   }
+   if (in[1].link)
+   realnorm = in[1].link;
+   else
+   realnorm = GPU_uniform(in[1].vec);
 
+   negnorm = GPU_builtin(GPU_VIEW_NORMAL);
GPU_link(mat, "math_max", strength, GPU_uniform(d), &strength);
-   GPU_link(mat, "vec_math_negate", GPU_builtin(GPU_VIEW_NORMAL), 
&negnorm);
 
-   if (in[1].link) {
+   if (GPU_material_use_new_shading_nodes(mat)) {
+
+   /*  CYCLES  */
+
+   GPU_link(mat, "direction_transform_m4v3", negnorm, 
GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &negnorm);
+
switch (nm->space) {
case SHD_NORMAL_MAP_TANGENT:
-   GPU_link(mat, "node_normal_map", 
GPU_attribute(CD_TANGENT, nm->uv_map), negnorm, realnorm, &out[0].link);
+   GPU_link(mat, "color_to_normal_new_shading", 
realnorm, &realnorm);
+   GPU_link(mat, "node_normal_map", 
GPU_attribute(CD_TANGENT, nm->uv_map), negnorm, realnorm, &realnorm);
break;
case SHD_NORMAL_MAP_OBJECT:
+   GPU_link(mat, "color_to_normal_new_shading", 
realnorm, &realnorm);
+   GPU_link(mat, "direction_transform_m4v3", 
realnorm, GPU_builtin(GPU_OBJECT_MATRIX),  &realnorm);
+   break;
case SHD_NORMAL_MAP_BLENDER_OBJECT:
-   GPU_link(mat, "direction_transform_m4v3", 
realnorm, GPU_builtin(GPU_LOC_TO_VIEW_MATRIX),  &out[0].link);
+   GPU_link(mat, 
"color_to_blender_normal_new_shading", realnorm, &realnorm);
+   GPU_link(mat, "direction_transform_m4v3", 
realnorm, GPU_builtin(GPU_OBJECT_MATRIX),  &realnorm);
break;
case SHD_NORMAL_MAP_WORLD:
+   GPU_link(mat, "color_to_normal_new_shading", 
realnorm, &realnorm);
+   break;
case SHD_NORMAL_MAP_BLENDER_WORLD:
-   GPU_link(mat, "direction_transform_m4v3", 
realnorm, GPU_builtin(GPU_VIEW_MATRIX),  &out[0].link);
+   GPU_link(mat, 
"color_to_blender_normal_new_shading", realnorm, &realnorm);
break;
+
+   GPU_link(mat, "vect_normalize", realnorm, &realnorm);
}
-   }
 
-   if (out[0].link) {
-   GPU_link(mat, "vec_math_mix", strength, out[0].link, negnorm,  
&out[0].link);
-   GPU_link(mat, "vect_normalize", out[0].link, &out[0].link);
+   } e

[Bf-blender-cvs] [82b5984] compositor-2016: ndof: enable Linux support by default, unless libs missing

2016-06-08 Thread Mike Erwin
Commit: 82b59843f045880eccabf2631655d70501c0b7ce
Author: Mike Erwin
Date:   Tue May 24 00:35:17 2016 -0400
Branches: compositor-2016
https://developer.blender.org/rB82b59843f045880eccabf2631655d70501c0b7ce

ndof: enable Linux support by default, unless libs missing

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1539a55..2b40b92 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,7 +172,6 @@ if(UNIX AND NOT APPLE)
set(_init_CODEC_FFMPEG   OFF)
set(_init_CYCLES_OSL OFF)
set(_init_IMAGE_OPENEXR  OFF)
-   set(_init_INPUT_NDOF OFF)
set(_init_JACK   OFF)
set(_init_OPENCOLLADAOFF)
set(_init_OPENCOLORIOOFF)
@@ -1034,14 +1033,12 @@ if(UNIX AND NOT APPLE)
 
if(WITH_INPUT_NDOF)
find_package_wrapper(Spacenav)
-   if(NOT SPACENAV_FOUND)
-   set(WITH_INPUT_NDOF OFF)
-   endif()
-
-   # use generic names within blenders buildsystem.
if(SPACENAV_FOUND)
+   # use generic names within blenders buildsystem.
set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
+   else()
+   set(WITH_INPUT_NDOF OFF)
endif()
endif()

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


[Bf-blender-cvs] [86f8455] compositor-2016: Fixed a rare case of NaN in Cycles

2016-06-08 Thread Stefan Werner
Commit: 86f84558272b1213507ecfcfcc0be9be9925746f
Author: Stefan Werner
Date:   Mon May 23 13:27:46 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB86f84558272b1213507ecfcfcc0be9be9925746f

Fixed a rare case of NaN in Cycles

This fixes a rare case where NaNs could exist inside Cycles.

When certain invalid meshes were passed in, Cycles would try too normalize
a zero length normal during its setup stage. While it does check against
division by zero, it still returns a zero length normal and passes it on to
the path tracing kernel. The kernel then operates under the assumption that
normals are valid, and in the case of such a zero length normal, would
eventually create NaNs that propagate through and result in black pixels.

Reviewers: #cycles

Subscribers: brecht, sergey

Projects: #cycles

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

===

M   intern/cycles/render/mesh.cpp

===

diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index de1533c..d264040 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -285,7 +285,7 @@ static float3 compute_face_normal(const Mesh::Triangle& t, 
float3 *verts)
float normlen = len(norm);
 
if(normlen == 0.0f)
-   return make_float3(0.0f, 0.0f, 0.0f);
+   return make_float3(1.0f, 0.0f, 0.0f);
 
return norm / normlen;
 }

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


[Bf-blender-cvs] [8574b01] compositor-2016: Fix T47257: bevel crash when there are internal faces.

2016-06-08 Thread Howard Trickey
Commit: 8574b01929bc6238af34c9a7edafa1616333a394
Author: Howard Trickey
Date:   Wed May 25 08:48:46 2016 -0400
Branches: compositor-2016
https://developer.blender.org/rB8574b01929bc6238af34c9a7edafa1616333a394

Fix T47257: bevel crash when there are internal faces.

Bevel had assumed that when rebuilding a face that touches
a vertex with beveled edges, the edges of the face at that vertex
would be adjacent in internal order. That is not necessarily true
if there are edges with more than two faces attached.
We could just prohibit beveling any edges that touch a vertex
where this happens (we already don't bevel non-manifold edges)
but the use case in the model of T47257 seems reasonable.
Also had to fix the edge-ordering code, and the face reconstruction
code to take care of cases where the face normal may not be as expected.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index 5a7788c..f7e3622 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -345,6 +345,36 @@ static EdgeHalf *next_bev(BevVert *bv, EdgeHalf *from_e)
return NULL;
 }
 
+/* return count of edges between e1 and e2 when going around bv CCW */
+static int count_ccw_edges_between(EdgeHalf *e1, EdgeHalf *e2)
+{
+   int cnt = 0;
+   EdgeHalf *e = e1;
+
+   do {
+   if (e == e2)
+   break;
+   e = e->next;
+   cnt++;
+   } while (e != e1);
+   return cnt;
+}
+
+/* Assume bme1 and bme2 both share some vert. Do they share a face?
+ * If they share a face then there is some loop around bme1 that is in a face
+ * where the next or previous edge in the face must be bme2. */
+static bool edges_face_connected_at_vert(BMEdge *bme1, BMEdge *bme2)
+{
+   BMLoop *l;
+   BMIter iter;
+
+   BM_ITER_ELEM(l, &iter, bme1, BM_LOOPS_OF_EDGE) {
+   if (l->prev->e == bme2 || l->next->e == bme2)
+   return true;
+   }
+   return false;
+}
+
 /* Return a good representative face (for materials, etc.) for faces
  * created around/near BoundVert v.
  * Sometimes care about a second choice, if there is one.
@@ -1557,7 +1587,7 @@ static void build_boundary_vertex_only(BevelParams *bp, 
BevVert *bv, bool constr
if (construct) {
v = add_new_bound_vert(bp->mem_arena, vm, co);
v->efirst = v->elast = e;
-   e->leftv = v;
+   e->leftv = e->rightv = v;
}
else {
adjust_bound_vert(e->leftv, co);
@@ -1637,7 +1667,7 @@ static void build_boundary_terminal_edge(BevelParams *bp, 
BevVert *bv, EdgeHalf
v->efirst = e->prev;
v->elast = v->ebev = e;
e->leftv = v;
-   e->prev->leftv = v;
+   e->prev->leftv = e->prev->rightv = v;
}
else {
adjust_bound_vert(e->leftv, co);
@@ -1648,7 +1678,7 @@ static void build_boundary_terminal_edge(BevelParams *bp, 
BevVert *bv, EdgeHalf
v = add_new_bound_vert(mem_arena, vm, co);
v->efirst = e->prev;
v->elast = e;
-   e->leftv = v;
+   e->leftv = e->rightv = v;
e->prev->rightv = v;
}
else {
@@ -1661,7 +1691,7 @@ static void build_boundary_terminal_edge(BevelParams *bp, 
BevVert *bv, EdgeHalf
if (construct) {
v = add_new_bound_vert(mem_arena, vm, co);
v->efirst = v->elast = e;
-   e->leftv = v;
+   e->leftv = e->rightv = v;
}
else {
adjust_bound_vert(e->leftv, co);
@@ -3237,6 +3267,11 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, 
BevVert *bv)
if (!weld)
create_mesh_bmvert(bm, vm, i, 0, k, 
bv->v);
}
+   else if (n == 2 && !v->ebev && vm->mesh_kind != M_ADJ) {
+   /* case of one edge beveled and this is the v 
without ebev */
+   /* want to copy the verts from other v, in 
reverse order */
+   copy_mesh_vert(vm, i, 0, k, 1 - i, 0, ns - k);
+   }
}
} while ((v = v->next) != vm->boundstart);
 
@@ -3305,6 +3340,219 @@ static float edge_face_angle(EdgeHalf *e)
 #define BM_BEVEL_EDGE_TAG_DIS

[Bf-blender-cvs] [0d063271] compositor-2016: Collada: Adding support for bone roll and bone layers

2016-06-08 Thread Gaia Clary
Commit: 0d063271a07fc1435c587ac7ea0f048f6ab843bc
Author: Gaia Clary
Date:   Sat May 28 18:41:54 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB0d063271a07fc1435c587ac7ea0f048f6ab843bc

Collada: Adding support for bone roll and bone layers

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

===

M   source/blender/collada/ArmatureExporter.cpp
M   source/blender/collada/ArmatureImporter.cpp
M   source/blender/collada/ArmatureImporter.h
M   source/blender/collada/ExtraTags.cpp
M   source/blender/collada/ExtraTags.h
M   source/blender/collada/collada_utils.cpp
M   source/blender/collada/collada_utils.h

===

diff --git a/source/blender/collada/ArmatureExporter.cpp 
b/source/blender/collada/ArmatureExporter.cpp
index 47a0ffd..c8d92f4 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -67,12 +67,19 @@ void ArmatureExporter::add_armature_bones(Object *ob_arm, 
Scene *sce,
   std::list& child_objects)
 {
// write bone nodes
+
+   bArmature * armature = (bArmature *)ob_arm->data;
+   ED_armature_to_edit(armature);
+
bArmature *arm = (bArmature *)ob_arm->data;
for (Bone *bone = (Bone *)arm->bonebase.first; bone; bone = bone->next) 
{
// start from root bones
if (!bone->parent)
add_bone_node(bone, ob_arm, sce, se, child_objects);
}
+
+   ED_armature_from_edit(armature);
+   ED_armature_edit_free(armature);
 }
 
 void ArmatureExporter::write_bone_URLs(COLLADASW::InstanceController &ins, 
Object *ob_arm, Bone *bone)
@@ -174,7 +181,15 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object 
*ob_arm, Scene *sce,

node.addExtraTechniqueParameter("blender", "connect", true);
}
}
+   std::string layers = 
BoneExtended::get_bone_layers(bone->layer);
+   node.addExtraTechniqueParameter("blender", "layer", 
layers);
 
+   bArmature *armature = (bArmature *)ob_arm->data;
+   EditBone *ebone = bc_get_edit_bone(armature, 
bone->name);
+   if (ebone && ebone->roll > 0)
+   {
+   node.addExtraTechniqueParameter("blender", 
"roll", ebone->roll);
+   }
if (bc_is_leaf_bone(bone))
{
node.addExtraTechniqueParameter("blender", 
"tip_x", bone->arm_tail[0] - bone->arm_head[0]);
diff --git a/source/blender/collada/ArmatureImporter.cpp 
b/source/blender/collada/ArmatureImporter.cpp
index 4c318cd..496ca4e 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -50,19 +50,6 @@ static const char *bc_get_joint_name(T *node)
return id.size() ? id.c_str() : node->getOriginalId().c_str();
 }
 
-static EditBone *get_edit_bone(bArmature * armature, char *name) {
-   EditBone  *eBone;
-
-   for (eBone = (EditBone *)armature->edbo->first; eBone; eBone = 
eBone->next) {
-   if (STREQ(name, eBone->name))
-   return eBone;
-   }
-
-   return NULL;
-
-}
-
-
 
 ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase 
*mesh, Scene *sce, const ImportSettings *import_settings) :
import_settings(import_settings),
@@ -157,9 +144,11 @@ int ArmatureImporter::create_bone(SkinInfo *skin, 
COLLADAFW::Node *node, EditBon
if (parent) bone->parent = parent;
 
float loc[3], size[3], rot[3][3]; 
-   float angle;
 
BoneExtended &be = add_bone_extended(bone, node);
+   int layer = be.get_bone_layers();
+   if (layer) bone->layer = layer;
+   arm->layer |= layer; // ensure that all populated bone layers are 
visible after import
 
float *tail = be.get_tail();
int use_connect = be.get_use_connect();
@@ -171,10 +160,16 @@ int ArmatureImporter::create_bone(SkinInfo *skin, 
COLLADAFW::Node *node, EditBon
case -1: break; // not defined
}
 
-   mat4_to_loc_rot_size(loc, rot, size, mat);
-   mat3_to_vec_roll(rot, NULL, &angle);
+   if (be.has_roll()) {
+   bone->roll = be.get_roll();
+   } 
+   else {
+   float angle;
+   mat4_to_loc_rot_size(loc, rot, size, mat);
+   mat3_to_vec_roll(rot, NULL, &angle);
+   }
+
 
-   bone->roll = angle;
copy_v3_v3(bone->head, mat[3]);
add_v3_v3v3(bone->tail, bone->head, tail); //tail must be non zero
 
@@ -224,12 +219,12 @@ void ArmatureImporter::fix_leaf_bones(bArmature 
*armature, Bone *bone)
if (bc_is_leaf_bone(bone)) {

[Bf-blender-cvs] [b0aa42e] compositor-2016: Code refactor: nodify Cycles integrator.

2016-06-08 Thread Brecht Van Lommel
Commit: b0aa42e3970b1a68ee48748140bec9584c7c9437
Author: Brecht Van Lommel
Date:   Sat May 7 20:05:21 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBb0aa42e3970b1a68ee48748140bec9584c7c9437

Code refactor: nodify Cycles integrator.

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

===

M   intern/cycles/app/cycles_xml.cpp
M   intern/cycles/render/integrator.cpp
M   intern/cycles/render/integrator.h

===

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index ab081a7..c2636a0 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -20,6 +20,8 @@
 #include 
 #include 
 
+#include "node_xml.h"
+
 #include "background.h"
 #include "camera.h"
 #include "film.h"
@@ -48,7 +50,7 @@ CCL_NAMESPACE_BEGIN
 
 /* XML reading state */
 
-struct XMLReadState {
+struct XMLReadState : public XMLReader {
Scene *scene;   /* scene pointer */
Transform tfm;  /* current transform state */
bool smooth;/* smooth normal state */
@@ -289,58 +291,6 @@ static void xml_read_film(const XMLReadState& state, 
pugi::xml_node node)
xml_read_float(&film->filter_width, node, "filter_width");
 }
 
-/* Integrator */
-
-static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
-{
-   Integrator *integrator = state.scene->integrator;
-   
-   /* Branched Path */
-   bool branched = false;
-   xml_read_bool(&branched, node, "branched");
-
-   if(branched) {
-   integrator->method = Integrator::BRANCHED_PATH;
-
-   xml_read_int(&integrator->diffuse_samples, node, 
"diffuse_samples");
-   xml_read_int(&integrator->glossy_samples, node, 
"glossy_samples");
-   xml_read_int(&integrator->transmission_samples, node, 
"transmission_samples");
-   xml_read_int(&integrator->ao_samples, node, "ao_samples");
-   xml_read_int(&integrator->mesh_light_samples, node, 
"mesh_light_samples");
-   xml_read_int(&integrator->subsurface_samples, node, 
"subsurface_samples");
-   xml_read_int(&integrator->volume_samples, node, 
"volume_samples");
-   xml_read_bool(&integrator->sample_all_lights_direct, node, 
"sample_all_lights_direct");
-   xml_read_bool(&integrator->sample_all_lights_indirect, node, 
"sample_all_lights_indirect");
-   }
-   
-   /* Bounces */
-   xml_read_int(&integrator->min_bounce, node, "min_bounce");
-   xml_read_int(&integrator->max_bounce, node, "max_bounce");
-   
-   xml_read_int(&integrator->max_diffuse_bounce, node, 
"max_diffuse_bounce");
-   xml_read_int(&integrator->max_glossy_bounce, node, "max_glossy_bounce");
-   xml_read_int(&integrator->max_transmission_bounce, node, 
"max_transmission_bounce");
-   xml_read_int(&integrator->max_volume_bounce, node, "max_volume_bounce");
-   
-   /* Transparency */
-   xml_read_int(&integrator->transparent_min_bounce, node, 
"transparent_min_bounce");
-   xml_read_int(&integrator->transparent_max_bounce, node, 
"transparent_max_bounce");
-   xml_read_bool(&integrator->transparent_shadows, node, 
"transparent_shadows");
-   
-   /* Volume */
-   xml_read_float(&integrator->volume_step_size, node, "volume_step_size");
-   xml_read_int(&integrator->volume_max_steps, node, "volume_max_steps");
-   
-   /* Various Settings */
-   xml_read_bool(&integrator->caustics_reflective, node, 
"caustics_reflective");
-   xml_read_bool(&integrator->caustics_refractive, node, 
"caustics_refractive");
-   xml_read_float(&integrator->filter_glossy, node, "filter_glossy");
-   
-   xml_read_int(&integrator->seed, node, "seed");
-   xml_read_float(&integrator->sample_clamp_direct, node, 
"sample_clamp_direct");
-   xml_read_float(&integrator->sample_clamp_indirect, node, 
"sample_clamp_indirect");
-}
-
 /* Camera */
 
 static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
@@ -1229,16 +1179,16 @@ static void xml_read_state(XMLReadState& state, 
pugi::xml_node node)
 
 /* Scene */
 
-static void xml_read_include(const XMLReadState& state, const string& src);
+static void xml_read_include(XMLReadState& state, const string& src);
 
-static void xml_read_scene(const XMLReadState& state, pugi::xml_node 
scene_node)
+static void xml_read_scene(XMLReadState& state, pugi::xml_node scene_node)
 {
for(pugi::xml_node node = scene_node.first_child(); node; node = 
node.next_sibling()) {
if(string_iequals(node.name(), "film")) {
xml_read_film(state, node);
}
else if(string_iequals(node.name(), "integrator")) {
-   xml_read_integrator(state, node);
+ 

[Bf-blender-cvs] [ccef6d3] compositor-2016: Cycles: Support bump mapping in GLSL viewport

2016-06-08 Thread Sergey Sharybin
Commit: ccef6d37eeb3bade127ca22b7e6bbceef27e419b
Author: Sergey Sharybin
Date:   Fri May 20 14:16:54 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBccef6d37eeb3bade127ca22b7e6bbceef27e419b

Cycles: Support bump mapping in GLSL viewport

This commit implements Bump node in GLSL, making it possible to
see previews of bump mapping in viewport without need to render.
Nothing really fancy going on here, just uses internal dFdx/dFdy
functions to get derivatives of the surface and map itself.
Quite basic but seems to behave correct-ish.

This commit also makes Displacement material output to affect
viewport shading by re-linking unconnected Normal input to a
node which was used for displacement output (via Bump node).

Intention of all this is to make it really easy to do bump map
painting with Cycles as an active render engine.

Reviewers: campbellbarton, mont29, brecht, psy-fi

Reviewed By: brecht

Subscribers: Blendify, eyecandy

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

===

M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/nodes/shader/node_shader_tree.c
M   source/blender/nodes/shader/nodes/node_shader_bump.c

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index dea5b99..28bf99b 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -3160,9 +3160,27 @@ void node_normal_map(vec4 tangent, vec3 normal, vec3 
texnormal, out vec3 outnorm
outnormal = normalize(outnormal);
 }
 
-void node_bump(float strength, float dist, float height, vec3 N, out vec3 
result)
+void node_bump(float strength, float dist, float height, vec3 N, vec3 
surf_pos, out vec3 result)
 {
-   result = N;
+   vec3 dPdx = dFdx(surf_pos);
+   vec3 dPdy = dFdy(surf_pos);
+
+   /* Get surface tangents from normal. */
+   vec3 Rx = cross(dPdy, N);
+   vec3 Ry = cross(N, dPdx);
+
+   /* Compute surface gradient and determinant. */
+   float det = dot(dPdx, Rx);
+   float absdet = abs(det);
+
+   float dHdx = dFdx(height);
+   float dHdy = dFdy(height);
+   vec3 surfgrad = dHdx*Rx + dHdy*Ry;
+
+   strength = max(strength, 0.0);
+
+   result = normalize(absdet*N - dist*sign(det)*surfgrad);
+   result = normalize(strength*result + (1.0 - strength)*N);
 }
 
 /* output */
diff --git a/source/blender/nodes/shader/node_shader_tree.c 
b/source/blender/nodes/shader/node_shader_tree.c
index c4ec55c..29b1e5b 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -199,12 +199,172 @@ void register_node_tree_type_sh(void)
 
 /* GPU material from shader nodes */
 
+/* Find an output node of the shader tree.
+ *
+ * NOTE: it will only return output which is NOT in the group, which isn't how
+ * render engines works but it's how the GPU shader compilation works. This we
+ * can change in the future and make it a generic function, but for now it 
stays
+ * private here.
+ */
+static bNode *ntree_shader_output_node(bNodeTree *ntree)
+{
+   /* Make sure we only have single node tagged as output. */
+   ntreeSetOutput(ntree);
+   for (bNode *node = ntree->nodes.first; node != NULL; node = node->next) 
{
+   if (node->flag & NODE_DO_OUTPUT) {
+   return node;
+   }
+   }
+   return NULL;
+}
+
+/* Find socket with a specified identifier. */
+static bNodeSocket *ntree_shader_node_find_socket(ListBase *sockets,
+  const char *identifier)
+{
+   for (bNodeSocket *sock = sockets->first; sock != NULL; sock = 
sock->next) {
+   if (STREQ(sock->identifier, identifier)) {
+   return sock;
+   }
+   }
+   return NULL;
+}
+
+/* Find input socket with a specified identifier. */
+static bNodeSocket *ntree_shader_node_find_input(bNode *node,
+ const char *identifier)
+{
+   return ntree_shader_node_find_socket(&node->inputs, identifier);
+}
+
+/* Find output socket with a specified identifier. */
+static bNodeSocket *ntree_shader_node_find_output(bNode *node,
+  const char *identifier)
+{
+   return ntree_shader_node_find_socket(&node->outputs, identifier);
+}
+
+/* Check whether shader has a displacement.
+ *
+ * Will also return a node and it's socket which is connected to a displacement
+ * output. Additionally, link which is attached to the displacement output is
+ * also returned.
+ */
+static bool ntree_shader_has_displacement(bNodeTree *ntree,
+  bNode **r_node,
+   

[Bf-blender-cvs] [8fb974d] compositor-2016: Cleanup code style inconsistency in last commits.

2016-06-08 Thread Brecht Van Lommel
Commit: 8fb974d7ce6f2cafda224590588e14df3fd2dd65
Author: Brecht Van Lommel
Date:   Tue May 17 22:08:34 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB8fb974d7ce6f2cafda224590588e14df3fd2dd65

Cleanup code style inconsistency in last commits.

===

M   intern/cycles/bvh/bvh_build.cpp
M   intern/cycles/bvh/bvh_sort.cpp
M   intern/cycles/render/graph.cpp
M   intern/cycles/render/nodes.cpp
M   intern/cycles/util/util_vector.h

===

diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 6af4d25..76a1bfa 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -631,7 +631,7 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
 
bounds[type_index].grow(ref.bounds());
visibility[type_index] |= 
objects[ref.prim_object()]->visibility;
-   if (ref.prim_type() & PRIMITIVE_ALL_CURVE) {
+   if(ref.prim_type() & PRIMITIVE_ALL_CURVE) {
visibility[type_index] |= PATH_RAY_CURVE;
}
++num_new_prims;
diff --git a/intern/cycles/bvh/bvh_sort.cpp b/intern/cycles/bvh/bvh_sort.cpp
index f6bbdb2..e9032c6 100644
--- a/intern/cycles/bvh/bvh_sort.cpp
+++ b/intern/cycles/bvh/bvh_sort.cpp
@@ -125,7 +125,7 @@ static void bvh_reference_sort_threaded(TaskPool *task_pool,
if(compare.compare(data[left], data[right]) > 0) {
swap(data[left], data[right]);
}
-   if (compare.compare(data[center], data[right]) > 0) {
+   if(compare.compare(data[center], data[right]) > 0) {
swap(data[center], data[right]);
}
swap(data[center], data[right - 1]);
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 920f5c7..15c89cc 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -507,7 +507,7 @@ void ShaderGraph::constant_fold()
traverse_queue.pop();
done.insert(node);
foreach(ShaderOutput *output, node->outputs) {
-   if (output->links.size() == 0) {
+   if(output->links.size() == 0) {
continue;
}
/* Schedule node which was depending on the value,
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 1eb0365..194723e 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1379,7 +1379,7 @@ void PointDensityTextureNode::compile(SVMCompiler& 
compiler)
  
__float_as_int(0.0f),
  
compiler.stack_assign(density_out));
}
-   if (use_color) {
+   if(use_color) {
compiler.add_node(NODE_VALUE_V, 
compiler.stack_assign(color_out));
compiler.add_node(NODE_VALUE_V, 
make_float3(TEX_IMAGE_MISSING_R,

TEX_IMAGE_MISSING_G,
@@ -3351,7 +3351,7 @@ bool MixNode::constant_fold(ShaderGraph *graph, 
ShaderOutput * /*socket*/, float
if(!fac_in->link) {
/* factor 0.0 */
if(fac_in->value.x == 0.0f) {
-   if (color1_in->link)
+   if(color1_in->link)
graph->relink(this, color_out, color1_in->link);
else
*optimized_value = color1_in->value;
@@ -3359,7 +3359,7 @@ bool MixNode::constant_fold(ShaderGraph *graph, 
ShaderOutput * /*socket*/, float
}
/* factor 1.0 */
else if(fac_in->value.x == 1.0f) {
-   if (color2_in->link)
+   if(color2_in->link)
graph->relink(this, color_out, color2_in->link);
else
*optimized_value = color2_in->value;
@@ -4322,7 +4322,7 @@ RGBCurvesNode::RGBCurvesNode()
 
 void RGBCurvesNode::compile(SVMCompiler& compiler)
 {
-   if (curves.size() == 0)
+   if(curves.size() == 0)
return;
 
ShaderInput *fac_in = input("Fac");
@@ -4343,7 +4343,7 @@ void RGBCurvesNode::compile(SVMCompiler& compiler)
 
 void RGBCurvesNode::compile(OSLCompiler& compiler)
 {
-   if (curves.size() == 0)
+   if(curves.size() == 0)
return;
 
compiler.parameter_color_array("ramp", curves);
@@ -4367,7 +4367,7 @@ Vecto

[Bf-blender-cvs] [160aaa3] compositor-2016: Cycles: Fix wrong closure counter in feature adaptive kernel

2016-06-08 Thread Sergey Sharybin
Commit: 160aaa3c252b411ba0b464b4db23a2c70c4d5545
Author: Sergey Sharybin
Date:   Mon May 23 14:09:27 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB160aaa3c252b411ba0b464b4db23a2c70c4d5545

Cycles: Fix wrong closure counter in feature adaptive kernel

Some closures were missing from calculation, leading to an array
under-allocation, presumable causing memory corruption issues with
emission shaders on OpenCL and was causing issues with Volume 3D
textures with CUDA.

The issue was identified by Thomas Dinges, the patch is different
from the original D2006. See the brief discussion there. Current
approach is similar (or the same) as Brecht suggested.

===

M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/graph.cpp
M   intern/cycles/render/graph.h
M   intern/cycles/render/nodes.h

===

diff --git a/intern/cycles/kernel/svm/svm_types.h 
b/intern/cycles/kernel/svm/svm_types.h
index 8c69c58..be87e35 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -370,6 +370,9 @@ typedef enum ShaderType {
 /* Closure */
 
 typedef enum ClosureType {
+   /* Special type, flags generic node as a non-BSDF. */
+   CLOSURE_NONE_ID,
+
CLOSURE_BSDF_ID,
 
/* Diffuse */
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 15c89cc..24e4c9f 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -984,17 +984,18 @@ int ShaderGraph::get_num_closures()
 {
int num_closures = 0;
foreach(ShaderNode *node, nodes) {
-   if(node->special_type == SHADER_SPECIAL_TYPE_CLOSURE) {
-   BsdfNode *bsdf_node = static_cast(node);
-   /* TODO(sergey): Make it more generic approach, maybe 
some utility
-* macros like CLOSURE_IS_FOO()?
-*/
-   if(CLOSURE_IS_BSSRDF(bsdf_node->closure))
-   num_closures = num_closures + 3;
-   else if(CLOSURE_IS_GLASS(bsdf_node->closure))
-   num_closures = num_closures + 2;
-   else
-   num_closures = num_closures + 1;
+   ClosureType closure_type = node->get_closure_type();
+   if(closure_type == CLOSURE_NONE_ID) {
+   continue;
+   }
+   else if(CLOSURE_IS_BSSRDF(closure_type)) {
+   num_closures += 3;
+   }
+   else if(CLOSURE_IS_GLASS(closure_type)) {
+   num_closures += 2;
+   }
+   else {
+   ++num_closures;
}
}
return num_closures;
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index b1ebdbf..bd3f5ca 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -237,6 +237,9 @@ public:
 */
virtual int get_feature() { return bump == SHADER_BUMP_NONE ? 0 : 
NODE_FEATURE_BUMP; }
 
+   /* Get closure ID to which the node compiles into. */
+   virtual ClosureType get_closure_type() { return CLOSURE_NONE_ID; }
+
/* Check whether settings of the node equals to another one.
 *
 * This is mainly used to check whether two nodes can be merged
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 54a5220..5df34a8 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -387,6 +387,7 @@ public:
 
bool has_spatial_varying() { return true; }
void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput 
*param2, ShaderInput *param3 = NULL, ShaderInput *param4 = NULL);
+   virtual ClosureType get_closure_type() { return closure; }
 
ClosureType closure;
bool scattering;
@@ -484,6 +485,7 @@ class EmissionNode : public ShaderNode {
 public:
SHADER_NODE_CLASS(EmissionNode)
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, float3 
*optimized_value);
+   virtual ClosureType get_closure_type() { return CLOSURE_EMISSION_ID; }
 
bool has_surface_emission() { return true; }
 };
@@ -492,12 +494,14 @@ class BackgroundNode : public ShaderNode {
 public:
SHADER_NODE_CLASS(BackgroundNode)
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, float3 
*optimized_value);
+   virtual ClosureType get_closure_type() { return CLOSURE_BACKGROUND_ID; }
 };
 
 class HoldoutNode : public ShaderNode {
 public:
SHADER_NODE_CLASS(HoldoutNode)
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
+   virtual ClosureType get_closure_type() { return CLOSURE_HOLDOUT_ID; }
 };
 
 class AmbientOcclusionNode : public ShaderNode {
@@ -506,6 +5

[Bf-blender-cvs] [0e2c39e] compositor-2016: Cleanup: remove unused doxy config

2016-06-08 Thread Campbell Barton
Commit: 0e2c39eb2ed0cc0d1c9e5ad6eba42859581b948b
Author: Campbell Barton
Date:   Sun May 22 17:14:08 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB0e2c39eb2ed0cc0d1c9e5ad6eba42859581b948b

Cleanup: remove unused doxy config

===

D   intern/ghost/doc/ghost_interface.cfg

===

diff --git a/intern/ghost/doc/ghost_interface.cfg 
b/intern/ghost/doc/ghost_interface.cfg
deleted file mode 100644
index ebe4153..000
--- a/intern/ghost/doc/ghost_interface.cfg
+++ /dev/null
@@ -1,626 +0,0 @@
-#---
-# General configuration options
-#---
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
-# by quotes) that should identify the project. 
-PROJECT_NAME = "GHOST (Generic Handy Operating System Toolkit)"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
-# This could be handy for archiving the generated documentation or 
-# if some version control system is used.
-PROJECT_NUMBER = 1.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
-# base path where the generated documentation will be put. 
-# If a relative path is entered, it will be relative to the location 
-# where doxygen was started. If left blank the current directory will be used.
-OUTPUT_DIRECTORY = ./interface
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
-# documentation generated by doxygen is written. Doxygen will use this 
-# information to generate all constant output in the proper language. 
-# The default language is English, other supported languages are: 
-# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, 
-# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian, 
-# Polish, Portuguese and Slovene.
-OUTPUT_LANGUAGE = English
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
-# documentation are documented, even if no documentation was available. 
-# Private class members and static file members will be hidden unless 
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES 
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
-# will be included in the documentation. 
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
-# will be included in the documentation. 
-EXTRACT_STATIC = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
-# This option has no effect if EXTRACT_ALL is enabled. 
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
-# undocumented classes that are normally visible in the class hierarchy. 
-# If set to NO (the default) these class will be included in the various 
-# overviews. This option has no effect if EXTRACT_ALL is enabled. 
-HIDE_UNDOC_CLASSES = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
-# include brief member descriptions after the members that are listed in 
-# the file and class documentation (similar to JavaDoc). 
-# Set to NO to disable this. 
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
-# the brief description of a member or function before the detailed 
description. 
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
-# brief descriptions will be completely suppressed. 
-REPEAT_BRIEF = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
-# Doxygen will generate a detailed section even if there is only a brief 
-# description. 
-ALWAYS_DETAILED_SEC = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
-# path before files name in the file list and in the header files. If set 
-# to NO the shortest path that makes the file name unique will be used. 
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
-# can be used to strip a user defined part of the path. Stripping is 
-# only done if one of the specified strings matches the left-hand part of 
-# the path. It is allowed to use relative paths in the argument list.
-STRIP_FROM_PATH = 
-
-# The INTERNAL_DOCS tag determines if documentation 
-# that is typed after a \internal command is included. If the tag is set 
-# to NO (the default) then the documentation will be excluded. 
-# Set it to YES to include the internal documentation. 
-INTERNAL_DOCS = NO
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default)

[Bf-blender-cvs] [5065343] master: Cleanup: GPU headers

2016-06-08 Thread Campbell Barton
Commit: 50653430745fa0b27d03082bce3b2888be2a5b6a
Author: Campbell Barton
Date:   Thu Jun 9 05:37:46 2016 +1000
Branches: master
https://developer.blender.org/rB50653430745fa0b27d03082bce3b2888be2a5b6a

Cleanup: GPU headers

===

M   source/blender/gpu/intern/gpu_buffers.c
M   source/blender/gpu/intern/gpu_compositing.c
M   source/blender/gpu/intern/gpu_draw.c
M   source/blender/gpu/intern/gpu_extensions.c
M   source/blender/gpu/intern/gpu_framebuffer.c
M   source/blender/gpu/intern/gpu_init_exit.c
M   source/blender/gpu/intern/gpu_material.c
M   source/blender/gpu/intern/gpu_shader.c
M   source/blender/gpu/intern/gpu_texture.c

===

diff --git a/source/blender/gpu/intern/gpu_buffers.c 
b/source/blender/gpu/intern/gpu_buffers.c
index 2c6f204..e8605e2 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -53,8 +53,6 @@
 #include "BKE_mesh.h"
 #include "BKE_pbvh.h"
 
-#include "DNA_userdef_types.h"
-
 #include "GPU_buffers.h"
 #include "GPU_draw.h"
 #include "GPU_basic_shader.h"
diff --git a/source/blender/gpu/intern/gpu_compositing.c 
b/source/blender/gpu/intern/gpu_compositing.c
index c2a2b18..964c2b5 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -34,16 +34,11 @@
 #include "BLI_sys_types.h"
 #include "BLI_rect.h"
 #include "BLI_math.h"
-#include "BLI_listbase.h"
-#include "BLI_linklist.h"
 
 #include "BLI_rand.h"
 
 #include "DNA_vec_types.h"
-#include "DNA_view3d_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_camera_types.h"
 #include "DNA_gpu_types.h"
 
 #include "GPU_compositing.h"
diff --git a/source/blender/gpu/intern/gpu_draw.c 
b/source/blender/gpu/intern/gpu_draw.c
index e5d5177..bb45c3e 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -39,7 +39,6 @@
 #include 
 
 #include "GPU_glew.h"
-#include "GPU_debug.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_linklist.h"
@@ -70,9 +69,7 @@
 #include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_node.h"
-#include "BKE_object.h"
 #include "BKE_scene.h"
-#include "BKE_subsurf.h"
 #include "BKE_DerivedMesh.h"
 
 #include "GPU_basic_shader.h"
@@ -85,9 +82,13 @@
 
 #include "PIL_time.h"
 
-#include "smoke_API.h"
+#ifdef WITH_SMOKE
+#  include "smoke_API.h"
+#endif
 
 #ifdef WITH_OPENSUBDIV
+#  include "BKE_subsurf.h"
+#  include "BKE_DerivedMesh.h"
 #  include "BKE_editmesh.h"
 
 #  include "gpu_codegen.h"
diff --git a/source/blender/gpu/intern/gpu_extensions.c 
b/source/blender/gpu/intern/gpu_extensions.c
index 3c96b62..b8a39c8 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -32,9 +32,6 @@
  * with checks for drivers and GPU support.
  */
 
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 #include "BLI_math_base.h"
 #include "BLI_math_vector.h"
@@ -42,7 +39,6 @@
 #include "BKE_global.h"
 
 #include "GPU_basic_shader.h"
-#include "GPU_draw.h"
 #include "GPU_extensions.h"
 #include "GPU_glew.h"
 #include "GPU_texture.h"
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c 
b/source/blender/gpu/intern/gpu_framebuffer.c
index a6d120b..c0400cd 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -29,8 +29,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_math_base.h"
-#include "BLI_math_vector.h"
 
 #include "BKE_global.h"
 
diff --git a/source/blender/gpu/intern/gpu_init_exit.c 
b/source/blender/gpu/intern/gpu_init_exit.c
index 8fed6a9..c72c83b 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -29,11 +29,8 @@
  *  \ingroup gpu
  */
 
-#include "BKE_DerivedMesh.h"
-
 #include "BLI_sys_types.h"
 #include "GPU_init_exit.h"  /* interface */
-#include "GPU_buffers.h"
 
 #include "BKE_global.h"
 
diff --git a/source/blender/gpu/intern/gpu_material.c 
b/source/blender/gpu/intern/gpu_material.c
index 02f58ea..f14b2e6 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -31,7 +31,6 @@
  * Manages materials, lights and textures.
  */
 
-
 #include 
 #include 
 
@@ -49,7 +48,6 @@
 
 #include "BKE_anim.h"
 #include "BKE_colortools.h"
-#include "BKE_DerivedMesh.h"
 #include "BKE_global.h"
 #include "BKE_image.h"
 #include "BKE_main.h"
@@ -68,7 +66,9 @@
 
 #include "gpu_codegen.h"
 
-#include 
+#ifdef WITH_OPENSUBDIV
+#  include "BKE_DerivedMesh.h"
+#endif
 
 /* Structs */
 
diff --git a/source/blender/gpu/intern/gpu_shader.c 
b/source/blender/gpu/intern/gpu_shader.c
index 2535200..5a1b38e 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -27,7 +27,6 @@
 
 #include "MEM_guarded

[Bf-blender-cvs] [b41cfb5] master: glutil: add glaGetOneInt helper

2016-06-08 Thread Campbell Barton
Commit: b41cfb590c798de39d569b462820c8eed70faff2
Author: Campbell Barton
Date:   Thu Jun 9 05:12:42 2016 +1000
Branches: master
https://developer.blender.org/rBb41cfb590c798de39d569b462820c8eed70faff2

glutil: add glaGetOneInt helper

===

M   source/blender/editors/include/BIF_glutil.h
M   source/blender/editors/screen/glutil.c

===

diff --git a/source/blender/editors/include/BIF_glutil.h 
b/source/blender/editors/include/BIF_glutil.h
index 0ac5c17..d3d2c46 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -94,6 +94,7 @@ void glutil_draw_filled_arc(float start, float angle, float 
radius, int nsegment
  * The param must cause only one value to be gotten from GL.
  */
 float glaGetOneFloat(int param);
+int glaGetOneInt(int param);
 
 /**
  * Functions like glRasterPos2i, except ensures that the resulting
diff --git a/source/blender/editors/screen/glutil.c 
b/source/blender/editors/screen/glutil.c
index 0142682..93bac3f 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -327,6 +327,13 @@ float glaGetOneFloat(int param)
return v;
 }
 
+int glaGetOneInt(int param)
+{
+   GLint v;
+   glGetIntegerv(param, &v);
+   return v;
+}
+
 void glaRasterPosSafe2f(float x, float y, float known_good_x, float 
known_good_y)
 {
GLubyte dummy = 0;

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


[Bf-blender-cvs] [d01499a] master: GPU: avoid disabling basic-shader for lasso

2016-06-08 Thread Campbell Barton
Commit: d01499a45c104c1286451e6623446eab1b21fc0c
Author: Campbell Barton
Date:   Thu Jun 9 05:02:52 2016 +1000
Branches: master
https://developer.blender.org/rBd01499a45c104c1286451e6623446eab1b21fc0c

GPU: avoid disabling basic-shader for lasso

Replace glDrawPixels w/ glaDrawPixelsTex

===

M   source/blender/windowmanager/intern/wm_gesture.c

===

diff --git a/source/blender/windowmanager/intern/wm_gesture.c 
b/source/blender/windowmanager/intern/wm_gesture.c
index db933ad..1357729 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -233,19 +233,15 @@ static void wm_gesture_draw_circle(wmGesture *gt)
 }
 
 struct LassoFillData {
-   unsigned int *px;
+   unsigned char *px;
int width;
 };
 
 static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
 {
struct LassoFillData *data = user_data;
-   unsigned char *col = (unsigned char *)&(data->px[(y * data->width) + 
x]);
-   do {
-   col[0] = col[1] = col[2] = 0xff;
-   col[3] = 0x10;
-   col += 4;
-   } while (++x != x_end);
+   unsigned char *col = &(data->px[(y * data->width) + x]);
+   memset(col, 0x10, x_end - x);
 }
 
 static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
@@ -273,7 +269,7 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
if (BLI_rcti_is_empty(&rect) == false) {
const int w = BLI_rcti_size_x(&rect);
const int h = BLI_rcti_size_y(&rect);
-   unsigned int *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * 
h, __func__);
+   unsigned char *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * 
h, __func__);
struct LassoFillData lasso_fill_data = {pixel_buf, w};
 
fill_poly_v2i_n(
@@ -281,19 +277,27 @@ static void draw_filled_lasso(wmWindow *win, wmGesture 
*gt)
   (const int (*)[2])moves, tot,
   draw_filled_lasso_px_cb, &lasso_fill_data);
 
-   int bound_options;
-   GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+   glColor4f(1, 1, 1, 1);
+   glPixelTransferf(GL_RED_BIAS, 1);
+   glPixelTransferf(GL_GREEN_BIAS, 1);
+   glPixelTransferf(GL_BLUE_BIAS, 1);
+
+   GPU_basic_shader_bind(GPU_SHADER_TEXTURE_2D | 
GPU_SHADER_USE_COLOR);
 
glEnable(GL_BLEND);
-   // glColor4f(1.0, 1.0, 1.0, 0.05);
+   glaDrawPixelsTex(rect.xmin, rect.ymin, w, h, GL_ALPHA, 
GL_UNSIGNED_BYTE, GL_NEAREST, pixel_buf);
+   glDisable(GL_BLEND);
 
-   glRasterPos2f(rect.xmin, rect.ymin);
+   GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
 
-   glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buf);
+   glPixelTransferf(GL_RED_BIAS, 0);
+   glPixelTransferf(GL_GREEN_BIAS, 0);
+   glPixelTransferf(GL_BLUE_BIAS, 0);
 
-   GPU_BASIC_SHADER_ENABLE_AND_RESTORE(bound_options);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
-   glDisable(GL_BLEND);
MEM_freeN(pixel_buf);
}

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


[Bf-blender-cvs] [88ac2d3] master: Cleanup: GPU arg wrapping

2016-06-08 Thread Campbell Barton
Commit: 88ac2d390b98d749f7c330b849b60ba229558ecd
Author: Campbell Barton
Date:   Thu Jun 9 05:44:25 2016 +1000
Branches: master
https://developer.blender.org/rB88ac2d390b98d749f7c330b849b60ba229558ecd

Cleanup: GPU arg wrapping

===

M   source/blender/gpu/GPU_basic_shader.h
M   source/blender/gpu/GPU_draw.h
M   source/blender/gpu/intern/gpu_basic_shader.c
M   source/blender/gpu/intern/gpu_codegen.c
M   source/blender/gpu/intern/gpu_draw.c

===

diff --git a/source/blender/gpu/GPU_basic_shader.h 
b/source/blender/gpu/GPU_basic_shader.h
index 1e2db6a..8e38ac8 100644
--- a/source/blender/gpu/GPU_basic_shader.h
+++ b/source/blender/gpu/GPU_basic_shader.h
@@ -93,8 +93,9 @@ if (GPU_basic_shader_use_glsl_get()) { \
 } ((void)0)
 
 
-void GPU_basic_shader_colors(const float diffuse[3], const float specular[3],
-   int shininess, float alpha);
+void GPU_basic_shader_colors(
+const float diffuse[3], const float specular[3],
+int shininess, float alpha);
 
 /* Fixed Function Lighting */
 
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 75d6362..bc73238 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -97,8 +97,9 @@ void GPU_clear_tpage(bool force);
  * - this affects fixed functions materials and texface, not glsl */
 
 int GPU_default_lights(void);
-int GPU_scene_object_lights(struct Scene *scene, struct Object *ob,
-   int lay, float viewmat[4][4], int ortho);
+int GPU_scene_object_lights(
+struct Scene *scene, struct Object *ob,
+int lay, float viewmat[4][4], int ortho);
 
 /* Text render
  * - based on moving uv coordinates */
@@ -132,13 +133,15 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap);
 void GPU_paint_update_image(struct Image *ima, struct ImageUser *iuser, int x, 
int y, int w, int h);
 void GPU_update_images_framechange(void);
 int GPU_update_image_time(struct Image *ima, double time);
-int GPU_verify_image(struct Image *ima,
-   struct ImageUser *iuser, int textarget, int tftile, bool compare, bool 
mipmap, bool is_data);
-void GPU_create_gl_tex(unsigned int *bind, unsigned int *rect, float *frect, 
int rectw, int recth,
-   int textarget, bool mipmap, bool use_hight_bit_depth, struct Image 
*ima);
+int GPU_verify_image(
+struct Image *ima, struct ImageUser *iuser,
+int textarget, int tftile, bool compare, bool mipmap, bool is_data);
+void GPU_create_gl_tex(
+unsigned int *bind, unsigned int *rect, float *frect, int rectw, int 
recth,
+int textarget, bool mipmap, bool use_hight_bit_depth, struct Image 
*ima);
 void GPU_create_gl_tex_compressed(
-   unsigned int *bind, unsigned int *pix, int x, int y, int mipmap,
-   int textarget, struct Image *ima, struct ImBuf *ibuf);
+unsigned int *bind, unsigned int *pix, int x, int y, int mipmap,
+int textarget, struct Image *ima, struct ImBuf *ibuf);
 bool GPU_upload_dxt_texture(struct ImBuf *ibuf);
 void GPU_free_image(struct Image *ima);
 void GPU_free_images(void);
diff --git a/source/blender/gpu/intern/gpu_basic_shader.c 
b/source/blender/gpu/intern/gpu_basic_shader.c
index b066922..4be50a0 100644
--- a/source/blender/gpu/intern/gpu_basic_shader.c
+++ b/source/blender/gpu/intern/gpu_basic_shader.c
@@ -521,8 +521,9 @@ int GPU_basic_shader_bound_options(void)
 
 /* Material Colors */
 
-void GPU_basic_shader_colors(const float diffuse[3], const float specular[3],
-   int shininess, float alpha)
+void GPU_basic_shader_colors(
+const float diffuse[3], const float specular[3],
+int shininess, float alpha)
 {
float gl_diffuse[4], gl_specular[4];
 
diff --git a/source/blender/gpu/intern/gpu_codegen.c 
b/source/blender/gpu/intern/gpu_codegen.c
index 58ef406..3c028ff 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -86,8 +86,10 @@ typedef struct GPUFunction {
 } GPUFunction;
 
 /* Indices match the GPUType enum */
-static const char *GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4",
-   NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, 
"mat4"};
+static const char *GPU_DATATYPE_STR[17] = {
+   "", "float", "vec2", "vec3", "vec4",
+   NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, 
"mat4",
+};
 
 /* GLSL code parsing for finding function definitions.
  * These are stored in a hash for lookup when creating a material. */
diff --git a/source/blender/gpu/intern/gpu_draw.c 
b/source/blender/gpu/intern/gpu_draw.c
index bb45c3e..c1247db 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -562,7 +562,9 @@ static void gpu_verify_high_bit_srgb_buffer(float 
*srgb_frect,
}
 }
 
-int GPU_verify_image(Image *ima, ImageUser *iuser, int textarget, int tftile, 
bool compare, bool 

[Bf-blender-cvs] [69bf7a4] master: Fix armature stick draw, unpack-alignment was set but never restored

2016-06-08 Thread Campbell Barton
Commit: 69bf7a44aac3e9a66b69fa1a93f7a5a04f360e5c
Author: Campbell Barton
Date:   Thu Jun 9 04:53:04 2016 +1000
Branches: master
https://developer.blender.org/rB69bf7a44aac3e9a66b69fa1a93f7a5a04f360e5c

Fix armature stick draw, unpack-alignment was set but never restored

Drawing a single stick bone set the alignment to 1, applying this setting to 
the rest of Blender.

===

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

===

diff --git a/source/blender/editors/space_view3d/drawarmature.c 
b/source/blender/editors/space_view3d/drawarmature.c
index f7c1e2e..1306e83 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -986,10 +986,11 @@ static GLubyte bm_dot7[] = {0x0, 0x38, 0x7C, 0xFE, 0xFE, 
0xFE, 0x7C, 0x38};
 static void draw_line_bone(int armflag, int boneflag, short constflag, 
unsigned int id,
bPoseChannel *pchan, EditBone *ebone)
 {
+   /* call this once, avoid constant changing */
+   BLI_assert(glaGetOneInt(GL_UNPACK_ALIGNMENT) == 1);
+
float length;

-   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-   
if (pchan) 
length = pchan->bone->length;
else 
@@ -2699,6 +2700,11 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion 
*ar, Base *base,
if (v3d->flag2 & V3D_RENDER_OVERRIDE)
return true;
 
+   /* needed for 'draw_line_bone' which draws pixel. */
+   if (arm->drawtype == ARM_LINE) {
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   }
+
if (dt > OB_WIRE) {
/* we use color for solid lighting */
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
@@ -2774,5 +2780,9 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion 
*ar, Base *base,
/* restore */
glFrontFace(GL_CCW);
 
+   if (arm->drawtype == ARM_LINE) {
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+   }
+
return retval;
 }

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


[Bf-blender-cvs] [3160495] compositor-2016: Buildbot: Give 2015 builds different name

2016-06-08 Thread Sergey Sharybin
Commit: 316049560794a3d07e9bbe979749d01715f2cc09
Author: Sergey Sharybin
Date:   Wed Jun 8 11:59:39 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB316049560794a3d07e9bbe979749d01715f2cc09

Buildbot: Give 2015 builds different name

===

M   build_files/buildbot/slave_pack.py

===

diff --git a/build_files/buildbot/slave_pack.py 
b/build_files/buildbot/slave_pack.py
index b270175..490f045 100644
--- a/build_files/buildbot/slave_pack.py
+++ b/build_files/buildbot/slave_pack.py
@@ -108,6 +108,8 @@ if builder.find('cmake') != -1:
 platform += 'i386'
 elif builder.endswith('ppc_10_6_cmake'):
 platform += 'ppc'
+if builder.endswith('vc2015'):
+platform += "-vc14"
 builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, 
git_hash, platform)
 if branch != '':
 builderified_name = branch + "-" + builderified_name

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


[Bf-blender-cvs] [99c8165] compositor-2016: 3D Text: Store separate arrays for undo data

2016-06-08 Thread Campbell Barton
Commit: 99c816561fcd58b2a4ec7501fe4150cff46dd16c
Author: Campbell Barton
Date:   Wed Jun 8 16:57:34 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB99c816561fcd58b2a4ec7501fe4150cff46dd16c

3D Text: Store separate arrays for undo data

Don't store maximum length of text per undo step,
or attempt to pack all data in a single array.

Was storing 32766 characters per undo step, irrespective of actual text length.

===

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

===

diff --git a/source/blender/editors/curve/editfont_undo.c 
b/source/blender/editors/curve/editfont_undo.c
index cee1069..b2a265a 100644
--- a/source/blender/editors/curve/editfont_undo.c
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -40,47 +40,62 @@
 #include "ED_curve.h"
 #include "ED_util.h"
 
-/* TODO, remove */
-#define MAXTEXT 32766
+typedef struct UndoFont {
+   wchar_t *textbuf;
+   struct CharInfo *textbufinfo;
 
-static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata))
+   int len, pos;
+} UndoFont;
+
+static void undoFont_to_editFont(void *uf_v, void *ecu, void *UNUSED(obdata))
 {
Curve *cu = (Curve *)ecu;
EditFont *ef = cu->editfont;
-   const char *str = strv;
+   const UndoFont *uf = uf_v;
 
-   ef->pos = *((const short *)str);
-   ef->len = *((const short *)(str + 2));
+   size_t final_size;
 
-   memcpy(ef->textbuf, str + 4, (ef->len + 1) * sizeof(wchar_t));
-   memcpy(ef->textbufinfo, str + 4 + (ef->len + 1) * sizeof(wchar_t), 
ef->len * sizeof(CharInfo));
+   final_size = sizeof(wchar_t) * (uf->len + 1);
+   memcpy(ef->textbuf, uf->textbuf, final_size);
 
-   ef->selstart = ef->selend = 0;
+   final_size = sizeof(CharInfo) * (uf->len + 1);
+   memcpy(ef->textbufinfo, uf->textbufinfo, final_size);
+
+   ef->pos = uf->pos;
+   ef->len = uf->len;
 
+   ef->selstart = ef->selend = 0;
 }
 
 static void *editFont_to_undoFont(void *ecu, void *UNUSED(obdata))
 {
Curve *cu = (Curve *)ecu;
EditFont *ef = cu->editfont;
-   char *str;
 
-   /* The undo buffer includes [MAXTEXT+6]=actual string and 
[MAXTEXT+4]*sizeof(CharInfo)=charinfo */
-   str = MEM_callocN((MAXTEXT + 6) * sizeof(wchar_t) + (MAXTEXT + 4) * 
sizeof(CharInfo), "string undo");
+   UndoFont *uf = MEM_callocN(sizeof(*uf), __func__);
+
+   size_t final_size;
+
+   final_size = sizeof(wchar_t) * (ef->len + 1);
+   uf->textbuf = MEM_mallocN(final_size, __func__);
+   memcpy(uf->textbuf, ef->textbuf, final_size);
 
-   /* Copy the string and string information */
-   memcpy(str + 4, ef->textbuf, (ef->len + 1) * sizeof(wchar_t));
-   memcpy(str + 4 + (ef->len + 1) * sizeof(wchar_t), ef->textbufinfo, 
ef->len * sizeof(CharInfo));
+   final_size = sizeof(CharInfo) * (ef->len + 1);
+   uf->textbufinfo = MEM_mallocN(final_size, __func__);
+   memcpy(uf->textbufinfo, ef->textbufinfo, final_size);
 
-   *((short *)(str + 0)) = ef->pos;
-   *((short *)(str + 2)) = ef->len;
+   uf->pos = ef->pos;
+   uf->len = ef->len;
 
-   return str;
+   return uf;
 }
 
-static void free_undoFont(void *strv)
+static void free_undoFont(void *uf_v)
 {
-   MEM_freeN(strv);
+   UndoFont *uf = uf_v;
+   MEM_freeN(uf->textbuf);
+   MEM_freeN(uf->textbufinfo);
+   MEM_freeN(uf);
 }
 
 static void *get_undoFont(bContext *C)

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


[Bf-blender-cvs] [0e12e07] compositor-2016: 3D Text: Use BLI_array_store for undo storage

2016-06-08 Thread Campbell Barton
Commit: 0e12e070e568b1ded26510f9578cd69cb769252f
Author: Campbell Barton
Date:   Wed Jun 8 19:22:19 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB0e12e070e568b1ded26510f9578cd69cb769252f

3D Text: Use BLI_array_store for undo storage

===

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

===

diff --git a/source/blender/editors/curve/editfont_undo.c 
b/source/blender/editors/curve/editfont_undo.c
index b2a265a..a0453f9 100644
--- a/source/blender/editors/curve/editfont_undo.c
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -40,13 +40,175 @@
 #include "ED_curve.h"
 #include "ED_util.h"
 
+#define USE_ARRAY_STORE
+
+#ifdef USE_ARRAY_STORE
+// #  define DEBUG_PRINT
+#  include "BLI_array_store.h"
+#  include "BLI_array_store_utils.h"
+#  include "BLI_listbase.h"
+#  define ARRAY_CHUNK_SIZE 32
+#endif
+
 typedef struct UndoFont {
wchar_t *textbuf;
struct CharInfo *textbufinfo;
 
int len, pos;
+
+#ifdef USE_ARRAY_STORE
+   struct {
+   BArrayState *textbuf;
+   BArrayState *textbufinfo;
+   } store;
+#endif
 } UndoFont;
 
+
+#ifdef USE_ARRAY_STORE
+
+/** \name Array Store
+ * \{ */
+
+static struct {
+   struct BArrayStore_AtSize bs_stride;
+   int users;
+
+   /* We could have the undo API pass in the previous state, for now store 
a local list */
+   ListBase local_links;
+
+} uf_arraystore = {NULL};
+
+/**
+ * \param create: When false, only free the arrays.
+ * This is done since when reading from an undo state, they must be 
temporarily expanded.
+ * then discarded afterwards, having this argument avoids having 2x code paths.
+ */
+static void uf_arraystore_compact_ex(
+UndoFont *uf, const UndoFont *uf_ref,
+bool create)
+{
+#define STATE_COMPACT(uf, id, len) \
+   if ((uf)->id) { \
+   BLI_assert(create == ((uf)->store.id == NULL)); \
+   if (create) { \
+   BArrayState *state_reference = uf_ref ? 
uf_ref->store.id : NULL; \
+   const size_t stride = sizeof(*(uf)->id); \
+   BArrayStore *bs = 
BLI_array_store_at_size_ensure(&uf_arraystore.bs_stride, stride, 
ARRAY_CHUNK_SIZE); \
+   (uf)->store.id = BLI_array_store_state_add( \
+   bs, (uf)->id, (size_t)(len) * stride, 
state_reference); \
+   } \
+   /* keep uf->len for validation */ \
+   MEM_freeN((uf)->id); \
+   (uf)->id = NULL; \
+   } ((void)0)
+
+   STATE_COMPACT(uf, textbuf, uf->len + 1);
+   STATE_COMPACT(uf, textbufinfo, uf->len + 1);
+
+#undef STATE_COMPACT
+
+   if (create) {
+   uf_arraystore.users += 1;
+   }
+}
+
+/**
+ * Move data from allocated arrays to de-duplicated states and clear arrays.
+ */
+static void uf_arraystore_compact(UndoFont *um, const UndoFont *uf_ref)
+{
+   uf_arraystore_compact_ex(um, uf_ref, true);
+}
+
+static void uf_arraystore_compact_with_info(UndoFont *um, const UndoFont 
*uf_ref)
+{
+#ifdef DEBUG_PRINT
+   size_t size_expanded_prev, size_compacted_prev;
+   BLI_array_store_at_size_calc_memory_usage(&uf_arraystore.bs_stride, 
&size_expanded_prev, &size_compacted_prev);
+#endif
+
+   uf_arraystore_compact(um, uf_ref);
+
+#ifdef DEBUG_PRINT
+   {
+   size_t size_expanded, size_compacted;
+   
BLI_array_store_at_size_calc_memory_usage(&uf_arraystore.bs_stride, 
&size_expanded, &size_compacted);
+
+   const double percent_total = size_expanded ?
+   (((double)size_compacted / (double)size_expanded) * 
100.0) : -1.0;
+
+   size_t size_expanded_step = size_expanded - size_expanded_prev;
+   size_t size_compacted_step = size_compacted - 
size_compacted_prev;
+   const double percent_step = size_expanded_step ?
+   (((double)size_compacted_step / 
(double)size_expanded_step) * 100.0) : -1.0;
+
+   printf("overall memory use: %.8f%% of expanded size\n", 
percent_total);
+   printf("step memory use:%.8f%% of expanded size\n", 
percent_step);
+   }
+#endif
+}
+
+/**
+ * Remove data we only expanded for temporary use.
+ */
+static void uf_arraystore_expand_clear(UndoFont *um)
+{
+   uf_arraystore_compact_ex(um, NULL, false);
+}
+
+static void uf_arraystore_expand(UndoFont *uf)
+{
+#define STATE_EXPAND(uf, id, len) \
+   if ((uf)->store.id) { \
+   const size_t stride = sizeof(*(uf)->id); \
+   BArrayState *state = (uf)->store.id; \
+   size_t state_len; \
+   (uf)->id = BLI_array_store_state_data_get_alloc(state, 
&state_len); \
+   BLI_assert((len) == (state_len / stride)); \
+   UNUSED_VARS_NDEBUG(stride); \
+   } ((void)

[Bf-blender-cvs] [9051036] compositor-2016: Buildobt: Update master config

2016-06-08 Thread Sergey Sharybin
Commit: 9051036e8e51dfaa74467b07d19fda89fd3e055b
Author: Sergey Sharybin
Date:   Wed Jun 8 12:17:03 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB9051036e8e51dfaa74467b07d19fda89fd3e055b

Buildobt: Update master config

===

M   build_files/buildbot/master.cfg

===

diff --git a/build_files/buildbot/master.cfg b/build_files/buildbot/master.cfg
index 70dcbfb..8bd2335 100644
--- a/build_files/buildbot/master.cfg
+++ b/build_files/buildbot/master.cfg
@@ -285,7 +285,7 @@ def generic_builder(id, libdir='', branch='', rsync=False):
  maxsize=150 * 1024 * 1024,
  workdir='install'))
 f.addStep(MasterShellCommand(name='unpack',
- command=['python', unpack_script, filename],
+ command=['python2.7', unpack_script, 
filename],
  description='unpacking',
  descriptionDone='unpacked'))
 return f

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


[Bf-blender-cvs] [b3f2a5c] compositor-2016: Cycles: Fix crash after recent zero scale instance optimization

2016-06-08 Thread Sergey Sharybin
Commit: b3f2a5c19c1046356c9faaa21ce18bf0e1e88648
Author: Sergey Sharybin
Date:   Wed Jun 8 12:24:57 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBb3f2a5c19c1046356c9faaa21ce18bf0e1e88648

Cycles: Fix crash after recent zero scale instance optimization

===

M   intern/cycles/bvh/bvh_build.cpp

===

diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index d00de00..3f68722 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -230,6 +230,7 @@ void BVHBuild::add_references(BVHRange& root)
foreach(Object *ob, objects) {
if(params.top_level) {
if(!ob->is_traceable()) {
+   ++i;
continue;
}
if(!ob->mesh->is_instanced())

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


[Bf-blender-cvs] [1b0e31b] compositor-2016: Cleanup: typos

2016-06-08 Thread Campbell Barton
Commit: 1b0e31b45946df7bb8df1f72e8cd4820c6e48581
Author: Campbell Barton
Date:   Wed Jun 8 22:25:23 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB1b0e31b45946df7bb8df1f72e8cd4820c6e48581

Cleanup: typos

===

M   source/blender/blenkernel/intern/movieclip.c
M   source/blender/blenkernel/intern/tracking_util.c
M   source/blender/blenlib/intern/array_store.c
M   source/blender/editors/animation/keyframing.c
M   source/blender/editors/transform/transform_snap_object.c

===

diff --git a/source/blender/blenkernel/intern/movieclip.c 
b/source/blender/blenkernel/intern/movieclip.c
index a8d3c60..d2bfcfb 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -608,7 +608,7 @@ static MovieClip *movieclip_alloc(Main *bmain, const char 
*name)
return clip;
 }
 
-static void movieclip_load_get_szie(MovieClip *clip)
+static void movieclip_load_get_size(MovieClip *clip)
 {
int width, height;
MovieClipUser user = {0};
@@ -670,7 +670,7 @@ MovieClip *BKE_movieclip_file_add(Main *bmain, const char 
*name)
 
detect_clip_source(clip);
 
-   movieclip_load_get_szie(clip);
+   movieclip_load_get_size(clip);
if (clip->lastsize[0]) {
int width = clip->lastsize[0];
 
@@ -1276,7 +1276,7 @@ void BKE_movieclip_reload(MovieClip *clip)
detect_clip_source(clip);
 
clip->lastsize[0] = clip->lastsize[1] = 0;
-   movieclip_load_get_szie(clip);
+   movieclip_load_get_size(clip);
 
movieclip_calc_length(clip);
 
diff --git a/source/blender/blenkernel/intern/tracking_util.c 
b/source/blender/blenkernel/intern/tracking_util.c
index 3c2444b..a40e4f7 100644
--- a/source/blender/blenkernel/intern/tracking_util.c
+++ b/source/blender/blenkernel/intern/tracking_util.c
@@ -529,7 +529,7 @@ typedef struct AccessCacheKey {
 static unsigned int accesscache_hashhash(const void *key_v)
 {
const AccessCacheKey *key = (const AccessCacheKey *) key_v;
-   /* TODP(sergey): Need better hasing here for faster frame access. */
+   /* TODP(sergey): Need better hashing here for faster frame access. */
return key->clip_index << 16 | key->frame;
 }
 
diff --git a/source/blender/blenlib/intern/array_store.c 
b/source/blender/blenlib/intern/array_store.c
index 9baccf3..3356559 100644
--- a/source/blender/blenlib/intern/array_store.c
+++ b/source/blender/blenlib/intern/array_store.c
@@ -36,7 +36,7 @@
  *
  * This diagram is an overview of the structure of a single array-store.
  *
- * \note The only 2 structues here which are referenced externally are the.
+ * \note The only 2 structures here which are referenced externally are the.
  *
  * - BArrayStore: The whole array store.
  * - BArrayState: Represents a single state (array) of data.
@@ -92,7 +92,7 @@
  * First matches at either end of the array are detected.
  * For identical arrays this is all thats needed.
  *
- * De-duplication is performed on any remaining chunks, by hasing the first 
few bytes of the chunk
+ * De-duplication is performed on any remaining chunks, by hashing the first 
few bytes of the chunk
  * (see: BCHUNK_HASH_TABLE_ACCUMULATE_STEPS).
  *
  * \note This is cached for reuse since the referenced data never changes.
@@ -650,7 +650,7 @@ static void bchunk_list_append_data(
  * Use for adding arrays of arbitrary sized memory at once.
  *
  * \note This function takes care not to perform redundant chunk-merging 
checks,
- * so we can write succesive fixed size chunks quickly.
+ * so we can write successive fixed size chunks quickly.
  */
 static void bchunk_list_append_data_n(
 const BArrayInfo *info, BArrayMemory *bs_mem,
@@ -1680,7 +1680,7 @@ void *BLI_array_store_state_data_get_alloc(
 /** \} */
 
 
-/** \name Debigging API (for testing).
+/** \name Debugging API (for testing).
  * \{ */
 
 /* only for test validation */
diff --git a/source/blender/editors/animation/keyframing.c 
b/source/blender/editors/animation/keyframing.c
index 172f2b9..d0ae01d 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -2035,7 +2035,7 @@ bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
else {
/* Normal Mode (or treat as being normal mode):
 *
-* Just in case the flags are't set properly (i.e. only on/off 
is set, without a mode)
+* Just in case the flags can't set properly (i.e. only on/off 
is set, without a mode)
 * let's set the "normal" flag too, so that it will all be sane 
everywhere...
 */
scene->toolsettings->autokey_mode = AUTOKEY_MODE_NORMAL;
diff --git a/source/blender/editors/transform/transform_snap_object.c 
b/source/blender/editors/transform/transform_snap_object.c
i

[Bf-blender-cvs] [f1ec564] compositor-2016: Buildbot: Trickery for MSVC2015 and NVCC

2016-06-08 Thread Sergey Sharybin
Commit: f1ec564019cf852359172de6cdb44adc540c4281
Author: Sergey Sharybin
Date:   Wed Jun 8 10:31:04 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBf1ec564019cf852359172de6cdb44adc540c4281

Buildbot: Trickery for MSVC2015 and NVCC

===

M   build_files/buildbot/slave_compile.py

===

diff --git a/build_files/buildbot/slave_compile.py 
b/build_files/buildbot/slave_compile.py
index 0e72184..5e06c70 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -75,18 +75,20 @@ if 'cmake' in builder:
 
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc')
 
 elif builder.startswith('win'):
-  if builder.endswith('_vc2015'):
-if builder.startswith('win64'):
-cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64', 
'-DWITH_CYCLES_CUDA_BINARIES=0'])
-elif builder.startswith('win32'):
-bits = 32
-cmake_options.extend(['-G', 'Visual Studio 14 2015', 
'-DWITH_CYCLES_CUDA_BINARIES=0'])
-  else:
-if builder.startswith('win64'):
-cmake_options.extend(['-G', 'Visual Studio 12 2013 Win64'])
-elif builder.startswith('win32'):
-bits = 32
-cmake_options.extend(['-G', 'Visual Studio 12 2013'])
+if builder.endswith('_vc2015'):
+if builder.startswith('win64'):
+cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64'])
+elif builder.startswith('win32'):
+bits = 32
+cmake_options.extend(['-G', 'Visual Studio 14 2015'])
+cmake_extra_options.append('-DCUDA_NVCC_FLAGS=--cl-version;2013;' +
+'--compiler-bindir;C:\\Program Files (x86)\\Microsoft Visual 
Studio 12.0\\VC\\bin')
+else:
+if builder.startswith('win64'):
+cmake_options.extend(['-G', 'Visual Studio 12 2013 Win64'])
+elif builder.startswith('win32'):
+bits = 32
+cmake_options.extend(['-G', 'Visual Studio 12 2013'])
 
 elif builder.startswith('linux'):
 tokens = builder.split("_")

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


[Bf-blender-cvs] [d725efb] compositor-2016: Depsgraph: Optimize flush update when there's few objects and fewzillions of bones

2016-06-08 Thread Sergey Sharybin
Commit: d725efb2b0e54450a8a50e10d770f57015ff1a6f
Author: Sergey Sharybin
Date:   Wed Jun 8 16:53:39 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBd725efb2b0e54450a8a50e10d770f57015ff1a6f

Depsgraph: Optimize flush update when there's few objects and fewzillions of 
bones

Avoid annoying checks form inside operations loop, gives few percent speedup in
files like army_of_blenrigs.

===

M   source/blender/depsgraph/intern/eval/deg_eval_flush.cc

===

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 30d2438..0651210 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -80,8 +80,10 @@ static void flush_init_func(void *data_v, int i)
 */
Depsgraph *graph = (Depsgraph *)data_v;
OperationDepsNode *node = graph->operations[i];
-   IDDepsNode *id_node = node->owner->owner;
+   ComponentDepsNode *comp_node = node->owner;
+   IDDepsNode *id_node = comp_node->owner;
id_node->done = 0;
+   comp_node->done = 0;
node->scheduled = false;
node->owner->flags &= ~DEPSCOMP_FULLY_SCHEDULED;
if (node->owner->type == DEPSNODE_TYPE_PROXY) {
@@ -136,49 +138,10 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph 
*graph)
for (;;) {
node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
 
-   IDDepsNode *id_node = node->owner->owner;
-
-   if (id_node->done == 0) {
-   deg_editors_id_update(bmain, id_node->id);
-   id_node->done = 1;
-   }
-
-   lib_id_recalc_tag(bmain, id_node->id);
-   /* TODO(sergey): For until we've got proper data nodes 
in the graph. */
-   lib_id_recalc_data_tag(bmain, id_node->id);
-
-   ID *id = id_node->id;
-   /* This code is used to preserve those areas which does 
direct
-* object update,
-*
-* Plus it ensures visibility changes and relations and 
layers
-* visibility update has proper flags to work with.
-*/
-   if (GS(id->name) == ID_OB) {
-   Object *object = (Object *)id;
-   ComponentDepsNode *comp_node = node->owner;
-   if (comp_node->type == DEPSNODE_TYPE_ANIMATION) 
{
-   object->recalc |= OB_RECALC_TIME;
-   }
-   else if (comp_node->type == 
DEPSNODE_TYPE_TRANSFORM) {
-   object->recalc |= OB_RECALC_OB;
-   }
-   else {
-   object->recalc |= OB_RECALC_DATA;
-   }
-   }
-
-   /* TODO(sergey): For until incremental updates are 
possible
-* witin a component at least we tag the whole component
-* for update.
-*/
-   ComponentDepsNode *component = node->owner;
-   if ((component->flags & DEPSCOMP_FULLY_SCHEDULED) == 0) 
{
-   foreach (OperationDepsNode *op, 
component->operations) {
-   op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
-   }
-   component->flags |= DEPSCOMP_FULLY_SCHEDULED;
-   }
+   ComponentDepsNode *comp_node = node->owner;
+   IDDepsNode *id_node = comp_node->owner;
+   id_node->done = 1;
+   comp_node->done = 1;
 
/* Flush to nodes along links... */
if (node->outlinks.size() == 1) {
@@ -203,6 +166,52 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
}
}
}
+
+   GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash)
+   {
+   if (id_node->done == 1) {
+   ID *id = id_node->id;
+   Object *object = NULL;
+
+   if (GS(id->name) == ID_OB) {
+   object = (Object *)id;
+   }
+
+   deg_editors_id_update(bmain, id_node->id);
+
+   lib_id_recalc_tag(bmain, id_node->id);
+   /* TODO(sergey): For until we've got proper data nodes 
in the graph. */
+

[Bf-blender-cvs] [44bbb0f] compositor-2016: GPU: fix texface image w/ basic-shader

2016-06-08 Thread Campbell Barton
Commit: 44bbb0f4f96491516d02de2e1e45b0ae2be0bbc4
Author: Campbell Barton
Date:   Thu Jun 9 00:43:26 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB44bbb0f4f96491516d02de2e1e45b0ae2be0bbc4

GPU: fix texface image w/ basic-shader

===

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

===

diff --git a/source/blender/editors/space_view3d/drawmesh.c 
b/source/blender/editors/space_view3d/drawmesh.c
index 86f3edf..883f067 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -369,15 +369,18 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
}
 
if (c_badtex) lit = 0;
-   if (lit != c_lit || ma != c_ma) {
-   if (lit) {
-   int options = GPU_SHADER_LIGHTING | 
GPU_SHADER_USE_COLOR;
+   if (lit != c_lit || ma != c_ma || textured != c_textured) {
+   int options = GPU_SHADER_USE_COLOR;
 
-   if (gtexdraw.two_sided_lighting)
-   options |= GPU_SHADER_TWO_SIDED;
-   if (c_textured && !c_badtex)
-   options |= GPU_SHADER_TEXTURE_2D;
+   if (c_textured && !c_badtex) {
+   options |= GPU_SHADER_TEXTURE_2D;
+   }
+   if (gtexdraw.two_sided_lighting) {
+   options |= GPU_SHADER_TWO_SIDED;
+   }
 
+   if (lit) {
+   options |= GPU_SHADER_LIGHTING;
if (!ma)
ma = give_current_material_or_def(NULL, 0);  /* 
default material */
 
@@ -385,12 +388,10 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
mul_v3_v3fl(specular, &ma->specr, ma->spec);
 
GPU_basic_shader_colors(NULL, specular, ma->har, 1.0f);
-   GPU_basic_shader_bind(options);
-   }
-   else {
-   GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
}
 
+   GPU_basic_shader_bind(options);
+
c_lit = lit;
c_ma = ma;
}

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


[Bf-blender-cvs] [385b757] compositor-2016: Depsgraph: Remove unused code

2016-06-08 Thread Sergey Sharybin
Commit: 385b757fbf3912397b3442be200c866f0d641f8e
Author: Sergey Sharybin
Date:   Wed Jun 8 16:56:23 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB385b757fbf3912397b3442be200c866f0d641f8e

Depsgraph: Remove unused code

Became obsolete after recent changes.

===

M   source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M   source/blender/depsgraph/intern/nodes/deg_node_component.cc
M   source/blender/depsgraph/intern/nodes/deg_node_component.h

===

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 0651210..fda665b 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -85,8 +85,7 @@ static void flush_init_func(void *data_v, int i)
id_node->done = 0;
comp_node->done = 0;
node->scheduled = false;
-   node->owner->flags &= ~DEPSCOMP_FULLY_SCHEDULED;
-   if (node->owner->type == DEPSNODE_TYPE_PROXY) {
+   if (comp_node->type == DEPSNODE_TYPE_PROXY) {
node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
}
 }
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc 
b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index 7e49fec..8e74317 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -86,7 +86,6 @@ static void comp_node_hash_value_free(void *value_v)
 ComponentDepsNode::ComponentDepsNode() :
 entry_operation(NULL),
 exit_operation(NULL),
-flags(0),
 layers(0)
 {
operations_map = BLI_ghash_new(comp_node_hash_key,
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h 
b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index df321ea..6ff4345 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -47,13 +47,6 @@ struct Depsgraph;
 struct OperationDepsNode;
 struct BoneComponentDepsNode;
 
-typedef enum eDepsComponent_Flag {
-   /* Temporary flags, meaning all the component's operations has been
-* scheduled for update.
-*/
-   DEPSCOMP_FULLY_SCHEDULED = 1,
-} eDepsComponent_Flag;
-
 /* ID Component - Base type for all components */
 struct ComponentDepsNode : public DepsNode {
/* Key used to look up operations within a component */
@@ -165,8 +158,6 @@ struct ComponentDepsNode : public DepsNode {
 
// XXX: a poll() callback to check if component's first node can be 
started?
 
-   int flags;
-
/* Temporary bitmask, used during graph construction. */
int layers;
 };

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


[Bf-blender-cvs] [7f03ec7] compositor-2016: Depsgraph: Avoid redundant connection from IK solver to chain

2016-06-08 Thread Sergey Sharybin
Commit: 7f03ec7c3eb8b9c58af3f9cab281f05c212fccc4
Author: Sergey Sharybin
Date:   Wed Jun 8 17:32:09 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB7f03ec7c3eb8b9c58af3f9cab281f05c212fccc4

Depsgraph: Avoid redundant connection from IK solver to chain

Could give barely measurable speedup on a complex rigs.

===

M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 874837f..d333f1e 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1316,11 +1316,12 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob,
 
OperationKey done_key(&ob->id, DEPSNODE_TYPE_BONE, 
parchan->name, DEG_OPCODE_BONE_DONE);
add_relation(solver_key, done_key, 
DEPSREL_TYPE_TRANSFORM, "IK Chain Result");
+   } else {
+   OperationKey final_transforms_key(&ob->id, 
DEPSNODE_TYPE_BONE, parchan->name, DEG_OPCODE_BONE_DONE);
+   add_relation(solver_key, final_transforms_key, 
DEPSREL_TYPE_TRANSFORM, "IK Solver Result");
}
parchan->flag |= POSE_DONE;
 
-   OperationKey final_transforms_key(&ob->id, DEPSNODE_TYPE_BONE, 
parchan->name, DEG_OPCODE_BONE_DONE);
-   add_relation(solver_key, final_transforms_key, 
DEPSREL_TYPE_TRANSFORM, "IK Solver Result");
 
root_map->add_bone(parchan->name, rootchan->name);

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


[Bf-blender-cvs] [008f459] compositor-2016: Make uiLists placed in popups usable

2016-06-08 Thread Julian Eisel
Commit: 008f45976c68a88d1605a4b8a002d10a44ba9924
Author: Julian Eisel
Date:   Wed Jun 8 15:51:01 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB008f45976c68a88d1605a4b8a002d10a44ba9924

Make uiLists placed in popups usable

It's still not completely working - there are still some glitches - but far 
better than before.
To make buttons of the uiList work, you have to add a 'check' callback to the 
operator that invokes the menu. Only if it returns True, the uiList gets 
refreshed. To avoid this we have to make the region refresh tagging in the 
entire button handling a bit smarter.

Changes I had to do:
* Call uiList handling from menu/popup handling if needed.
* Make uiList handling use special popup refresh tag if placed in menu.
* Allow popups invoked from py operator to tag for refresh by using operator 
'check' callback.
* Tag popup for refresh when resizing uiList.

Mostly fixes T48612.

===

M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_templates.c
M   source/blender/windowmanager/intern/wm_operators.c

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 5b8b8ae..ff4e11a 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8436,6 +8436,7 @@ static int ui_handle_list_event(bContext *C, const 
wmEvent *event, ARegion *ar,
uiListDyn *dyn_data;
int retval = WM_UI_HANDLER_CONTINUE;
int type = event->type, val = event->val;
+   bool redraw = false;
int mx, my;
 
ui_list = listbox->custom_data;
@@ -8525,7 +8526,7 @@ static int ui_handle_list_event(bContext *C, const 
wmEvent *event, ARegion *ar,
ui_apply_but_undo(listbox);
 
ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
-   ED_region_tag_redraw(ar);
+   redraw = true;
}
retval = WM_UI_HANDLER_BREAK;
}
@@ -8537,8 +8538,8 @@ static int ui_handle_list_event(bContext *C, const 
wmEvent *event, ARegion *ar,
ui_list->list_grip += (type == WHEELUPMOUSE) ? -1 : 1;
 
ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
-   ED_region_tag_redraw(ar);
 
+   redraw = true;
retval = WM_UI_HANDLER_BREAK;
}
else if (ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
@@ -8546,13 +8547,22 @@ static int ui_handle_list_event(bContext *C, const 
wmEvent *event, ARegion *ar,
/* list template will clamp */
ui_list->list_scroll += (type == WHEELUPMOUSE) 
? -1 : 1;
 
-   ED_region_tag_redraw(ar);
-
+   redraw = true;
retval = WM_UI_HANDLER_BREAK;
}
}
}
 
+   if (redraw) {
+   if (listbox->block->flag & UI_BLOCK_POPUP) {
+   /* popups need special refreshing */
+   ED_region_tag_refresh_ui(ar);
+   }
+   else {
+   ED_region_tag_redraw(ar);
+   }
+   }
+
return retval;
 }
 
@@ -9794,11 +9804,21 @@ static int ui_handle_menus_recursive(
}
else {
uiBlock *block = menu->region->uiblocks.first;
+   uiBut *listbox = ui_list_find_mouse_over(menu->region, 
event);
 
-   if (block->flag & UI_BLOCK_RADIAL)
+   if (block->flag & UI_BLOCK_RADIAL) {
retval = ui_pie_handler(C, event, menu);
-   else if (event->type == LEFTMOUSE || event->val != 
KM_DBL_CLICK)
-   retval = ui_handle_menu_event(C, event, menu, 
level, is_parent_inside, is_parent_menu, is_floating);
+   }
+   else if (event->type == LEFTMOUSE || event->val != 
KM_DBL_CLICK) {
+   if (listbox) {
+   retval = ui_handle_list_event(C, event, 
menu->region, listbox);
+   }
+   if (retval == WM_UI_HANDLER_CONTINUE) {
+   retval = ui_handle_menu_event(
+   C, event, menu, level,
+   is_parent_inside, 
is_parent_menu, is_floating);
+   }
+   }
}
}
 
diff -

[Bf-blender-cvs] [c92c05e] compositor-2016: Fix edit-mesh draw not disabling stipple

2016-06-08 Thread Campbell Barton
Commit: c92c05ed93ed2b174811023cae9ac866d6c3a73c
Author: Campbell Barton
Date:   Wed Jun 8 21:35:02 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBc92c05ed93ed2b174811023cae9ac866d6c3a73c

Fix edit-mesh draw not disabling stipple

Caused problem w/ basic-shader

===

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

===

diff --git a/source/blender/blenkernel/intern/editderivedmesh.c 
b/source/blender/blenkernel/intern/editderivedmesh.c
index ffd000e..8df07c5 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -1181,6 +1181,10 @@ static void emDM_drawMappedFaces(
 
/* if non zero we know a face was rendered */
if (poly_prev != GL_ZERO) glEnd();
+
+   if (draw_option_prev == DM_DRAW_OPTION_STIPPLE) {
+   GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
+   }
 }
 
 static void bmdm_get_tri_uv(BMLoop *ltri[3], MLoopUV *luv[3], const int 
cd_loop_uv_offset)

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


[Bf-blender-cvs] [4f5d345] compositor-2016: Cleanup: typo

2016-06-08 Thread Campbell Barton
Commit: 4f5d3457c52151197ab968973941d455d20ef322
Author: Campbell Barton
Date:   Wed Jun 8 22:30:53 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB4f5d3457c52151197ab968973941d455d20ef322

Cleanup: typo

===

M   source/blender/blenlib/intern/BLI_ghash.c
M   source/blender/editors/animation/keyframing.c
M   source/blender/editors/include/ED_anim_api.h
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/blenlib/intern/BLI_ghash.c 
b/source/blender/blenlib/intern/BLI_ghash.c
index 06946e5..f943a81 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -69,7 +69,7 @@ const unsigned int hashsizes[] = {
 
 /**
  * \note Max load #GHASH_LIMIT_GROW used to be 3. (pre 2.74).
- * Python uses 0., tommyhaslib even goes down to 0.5.
+ * Python uses 0., tommyhashlib even goes down to 0.5.
  * Reducing our from 3 to 0.75 gives huge speedup (about twice quicker pure 
GHash insertions/lookup,
  * about 25% - 30% quicker 'dynamic-topology' stroke drawing e.g.).
  * Min load #GHASH_LIMIT_SHRINK is a quarter of max load, to avoid resizing to 
quickly.
diff --git a/source/blender/editors/animation/keyframing.c 
b/source/blender/editors/animation/keyframing.c
index d0ae01d..66b3a63 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -2035,7 +2035,7 @@ bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
else {
/* Normal Mode (or treat as being normal mode):
 *
-* Just in case the flags can't set properly (i.e. only on/off 
is set, without a mode)
+* Just in case the flags aren't set properly (i.e. only on/off 
is set, without a mode)
 * let's set the "normal" flag too, so that it will all be sane 
everywhere...
 */
scene->toolsettings->autokey_mode = AUTOKEY_MODE_NORMAL;
diff --git a/source/blender/editors/include/ED_anim_api.h 
b/source/blender/editors/include/ED_anim_api.h
index fb4897c..27e1051 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -608,7 +608,7 @@ typedef enum eAnimUnitConv_Flags {
ANIM_UNITCONV_SKIPKNOTS  = (1 << 4),
/* Scale FCurve i a way it fits to -1..1 space */
ANIM_UNITCONV_NORMALIZE  = (1 << 5),
-   /* Only whennormalization is used: use scale factor from previous run,
+   /* Only when normalization is used: use scale factor from previous run,
 * prevents curves from jumping all over the place when tweaking them.
 */
ANIM_UNITCONV_NORMALIZE_FREEZE  = (1 << 6),
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c 
b/source/blender/editors/sculpt_paint/paint_image_proj.c
index d273f83..e4c2606 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -202,7 +202,7 @@ typedef struct ProjPaintImage {
  */
 typedef struct ProjStrokeHandle {
/* Support for painting from multiple views at once,
-* currently used to impliment summetry painting,
+* currently used to impliment symmetry painting,
 * we can assume at least the first is set while painting. */
struct ProjPaintState *ps_views[8];
int ps_views_tot;
@@ -717,7 +717,7 @@ static bool project_paint_PickColor(
 }
 
 /**
- * Check if 'pt' is infront of the 3 verts on the Z axis (used for screenspace 
occlusuion test)
+ * Check if 'pt' is infront of the 3 verts on the Z axis (used for screenspace 
occlusion test)
  * \return
  * -  `0`:   no occlusion
  * - `-1`: no occlusion but 2D intersection is true
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index 15ab4ca..2a1e770 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1323,7 +1323,7 @@ static bool do_weight_paint_normalize_all_locked(
 
 /**
  * \note same as function above except it does a second pass without active 
group
- * if nomalize fails with it.
+ * if normalize fails with it.
  */
 static void do_weight_paint_normalize_all_locked_try_active(
 MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap,
@@ -1340,7 +1340,7 @@ static void 
do_weight_paint_normalize_all_locked_try_active(
 * - With 1.0 weight painted into active:
 *   nonzero locked weight; first pass zeroed out unlocked 
weight; scale 1 down to fit.
 * - With 0.0 w

[Bf-blender-cvs] [dde1cca] compositor-2016: Fix FPE exception happening when converting linear<->srgb using SIMD

2016-06-08 Thread Sergey Sharybin
Commit: dde1cca31404f72323d115b956ee14c30b1f7958
Author: Sergey Sharybin
Date:   Wed Jun 8 15:59:55 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBdde1cca31404f72323d115b956ee14c30b1f7958

Fix FPE exception happening when converting linear<->srgb using SIMD

===

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

===

diff --git a/source/blender/blenlib/intern/math_color_inline.c 
b/source/blender/blenlib/intern/math_color_inline.c
index 180d621..abb8ff3 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -65,7 +65,7 @@ MALWAYS_INLINE __m128 linearrgb_to_srgb_v4_simd(const __m128 
c)
 
 MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
 {
-   float r[4] = {srgb[0], srgb[1], srgb[2], 0.0f};
+   float r[4] = {srgb[0], srgb[1], srgb[2], 1.0f};
__m128 *rv = (__m128 *)&r;
*rv = srgb_to_linearrgb_v4_simd(*rv);
linear[0] = r[0];
@@ -75,7 +75,7 @@ MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const 
float srgb[3])
 
 MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
 {
-   float r[4] = {linear[0], linear[1], linear[2], 0.0f};
+   float r[4] = {linear[0], linear[1], linear[2], 1.0f};
__m128 *rv = (__m128 *)&r;
*rv = linearrgb_to_srgb_v4_simd(*rv);
srgb[0] = r[0];

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


[Bf-blender-cvs] [55e92bc] compositor-2016: readfile: optimization for undo

2016-06-08 Thread Campbell Barton
Commit: 55e92bca764ff87441bee86b4ea85aeda50b2d01
Author: Campbell Barton
Date:   Tue Jun 7 16:07:13 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB55e92bca764ff87441bee86b4ea85aeda50b2d01

readfile: optimization for undo

Was using O(n^2) lookup on ID's with undo.

This caused undo to hang with 1000's of data-blocks
(especially with heavy scenes & outliner-space, which doesn't even need to be 
visible to cause a slow-down).

Internally this uses a ghash per id-type, which is lazy-initialized.
Each key uses the name and library since there may be name collisions between 
libraries.

Developer Notes:

- Adds small `BKE_main_idmap_*` API.
- Needed to change linking order for this to build.

===

M   build_files/cmake/macros.cmake
A   source/blender/blenkernel/BKE_library_idmap.h
M   source/blender/blenkernel/CMakeLists.txt
A   source/blender/blenkernel/intern/library_idmap.c
M   source/blender/blenloader/intern/readfile.c

===

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index d34b55e..3aa938b 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -552,11 +552,11 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_modifiers
bf_bmesh
bf_gpu
+   bf_blenloader
bf_blenkernel
bf_physics
bf_nodes
bf_rna
-   bf_blenloader
bf_imbuf
bf_blenlib
bf_depsgraph
diff --git a/source/blender/blenkernel/BKE_library_idmap.h 
b/source/blender/blenkernel/BKE_library_idmap.h
new file mode 100644
index 000..971586e
--- /dev/null
+++ b/source/blender/blenkernel/BKE_library_idmap.h
@@ -0,0 +1,50 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+#ifndef __BKE_LIBRARY_IDMAP_H__
+#define __BKE_LIBRARY_IDMAP_H__
+
+/** \file BKE_library_idmap.h
+ *  \ingroup bke
+ */
+
+#include "BLI_compiler_attrs.h"
+
+struct ID;
+struct Main;
+struct IDNameLib_Map;
+
+struct IDNameLib_Map *BKE_main_idmap_create(
+struct Main *bmain)
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void BKE_main_idmap_destroy(
+struct IDNameLib_Map *id_typemap)
+ATTR_NONNULL();
+struct Main *BKE_main_idmap_main_get(
+struct IDNameLib_Map *id_typemap)
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+struct ID *BKE_main_idmap_lookup(
+struct IDNameLib_Map *id_typemap,
+short id_type, const char *name, const struct Library *lib)
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 3);
+struct ID *BKE_main_idmap_lookup_id(
+struct IDNameLib_Map *id_typemap, const struct ID *id)
+ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2);
+
+#endif  /* __BKE_LIBRARY_IDMAP_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index afab0cc..8626422 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -121,6 +121,7 @@ set(SRC
intern/lamp.c
intern/lattice.c
intern/library.c
+   intern/library_idmap.c
intern/library_query.c
intern/linestyle.c
intern/mask.c
@@ -244,6 +245,7 @@ set(SRC
BKE_lamp.h
BKE_lattice.h
BKE_library.h
+   BKE_library_idmap.h
BKE_library_query.h
BKE_linestyle.h
BKE_main.h
diff --git a/source/blender/blenkernel/intern/library_idmap.c 
b/source/blender/blenkernel/intern/library_idmap.c
new file mode 100644
index 000..fd78d9b
--- /dev/null
+++ b/source/blender/blenkernel/intern/library_idmap.c
@@ -0,0 +1,174 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty 

[Bf-blender-cvs] [3262fc3] compositor-2016: GPU: fix/workaround basic shader font-color

2016-06-08 Thread Campbell Barton
Commit: 3262fc31d4a2452dc13f7bdeaeb2cc18d07f432b
Author: Campbell Barton
Date:   Wed Jun 8 15:16:50 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB3262fc31d4a2452dc13f7bdeaeb2cc18d07f432b

GPU: fix/workaround basic shader font-color

All text was displaying black.

BLF uses alpha-only textures which aren't supported by the basic-shader,
Workaround this by using texture swizzle so the RGB components of the texture 
are set to 1.

===

M   source/blender/blenfont/intern/blf_glyph.c

===

diff --git a/source/blender/blenfont/intern/blf_glyph.c 
b/source/blender/blenfont/intern/blf_glyph.c
index 41726e4..aa7d539 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -55,6 +55,10 @@
 #include "BIF_gl.h"
 #include "BLF_api.h"
 
+#ifndef BLF_STANDALONE
+#include "GPU_basic_shader.h"
+#endif
+
 #include "blf_internal_types.h"
 #include "blf_internal.h"
 
@@ -179,6 +183,16 @@ static void blf_glyph_cache_texture(FontBLF *font, 
GlyphCacheBLF *gc)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 
+#ifndef BLF_STANDALONE
+   /* needed since basic shader doesn't support alpha-only textures,
+* while we could add support this is only used in a few places
+* (an alternative could be to have a simple shader for BLF). */
+   if (GLEW_ARB_texture_swizzle && GPU_basic_shader_use_glsl_get()) {
+   GLint swizzle_mask[] = {GL_ONE, GL_ONE, GL_ONE, GL_ALPHA};
+   glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, 
swizzle_mask);
+   }
+#endif
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA8, gc->p2_width, gc->p2_height, 
0, GL_ALPHA, GL_UNSIGNED_BYTE, NULL);
 }

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


[Bf-blender-cvs] [321086c] compositor-2016: BLI_array_store: move helper functions into their own API

2016-06-08 Thread Campbell Barton
Commit: 321086c0de79f3aecdfc27ac617cf5f9b520ce48
Author: Campbell Barton
Date:   Wed Jun 8 18:34:01 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB321086c0de79f3aecdfc27ac617cf5f9b520ce48

BLI_array_store: move helper functions into their own API

===

A   source/blender/blenlib/BLI_array_store_utils.h
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/array_store_utils.c
M   source/blender/editors/mesh/editmesh_undo.c

===

diff --git a/source/blender/blenlib/BLI_array_store_utils.h 
b/source/blender/blenlib/BLI_array_store_utils.h
new file mode 100644
index 000..6b2a288
--- /dev/null
+++ b/source/blender/blenlib/BLI_array_store_utils.h
@@ -0,0 +1,50 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+#ifndef __BLI_ARRAY_STORE_UTILS_H__
+#define __BLI_ARRAY_STORE_UTILS_H__
+
+/** \file BLI_array_store_utils.h
+ *  \ingroup bli
+ */
+
+struct BArrayStore;
+
+struct BArrayStore_AtSize {
+   struct BArrayStore **stride_table;
+   int  stride_table_len;
+};
+
+BArrayStore *BLI_array_store_at_size_ensure(
+struct BArrayStore_AtSize *bs_stride,
+const int stride, const int chunk_size);
+
+BArrayStore *BLI_array_store_at_size_get(
+struct BArrayStore_AtSize *bs_stride,
+const int stride);
+
+void BLI_array_store_at_size_clear(
+struct BArrayStore_AtSize *bs_stride);
+
+void BLI_array_store_at_size_calc_memory_usage(
+struct BArrayStore_AtSize *bs_stride,
+size_t *r_size_expanded, size_t *r_size_compacted);
+
+#endif  /* __BLI_ARRAY_STORE_UTILS_H__ */
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index 42d9587..9978d1d 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -53,6 +53,7 @@ set(SRC
intern/BLI_mempool.c
intern/DLRB_tree.c
intern/array_store.c
+   intern/array_store_utils.c
intern/array_utils.c
intern/astar.c
intern/boxpack2d.c
@@ -122,6 +123,7 @@ set(SRC
BLI_args.h
BLI_array.h
BLI_array_store.h
+   BLI_array_store_utils.h
BLI_array_utils.h
BLI_astar.h
BLI_bitmap.h
diff --git a/source/blender/blenlib/intern/array_store_utils.c 
b/source/blender/blenlib/intern/array_store_utils.c
new file mode 100644
index 000..83cd28d
--- /dev/null
+++ b/source/blender/blenlib/intern/array_store_utils.c
@@ -0,0 +1,103 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+/** \file blender/blenlib/intern/array_store_utils.c
+ *  \ingroup bli
+ *  \brief Helper functions for BLI_array_store API.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+
+#include "BLI_array_store.h"
+#include "BLI_array_store_utils.h"  /* own include */
+
+#include "BLI_math_base.h"
+
+BArrayStore *BLI_array_store_at_size_ensure(
+struct BArrayStore_AtSize *bs_stride,
+const int stride, const int chunk_size)
+{
+   if (bs_stride->stride_table_len < stride) {
+   bs_stride->stride_table_len = stride;
+   bs_stride->stride_table = 
MEM_recallocN(bs_stride->stride_table, sizeof(*bs_stride->stride_table) * 
stride);
+   }
+   BArrayStore **bs_p = &bs_stride->stride_table[stride - 1];
+

[Bf-blender-cvs] [3dca5e2] compositor-2016: GPU: make using the glsl basic-shader a flag

2016-06-08 Thread Campbell Barton
Commit: 3dca5e22df94547e11271eab994013527585c13d
Author: Campbell Barton
Date:   Wed Jun 8 03:46:19 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB3dca5e22df94547e11271eab994013527585c13d

GPU: make using the glsl basic-shader a flag

This allows for it to be more easily tested.

===

M   source/blender/gpu/GPU_basic_shader.h
M   source/blender/gpu/intern/gpu_basic_shader.c
M   source/creator/creator_args.c

===

diff --git a/source/blender/gpu/GPU_basic_shader.h 
b/source/blender/gpu/GPU_basic_shader.h
index df2da97..11d87ce 100644
--- a/source/blender/gpu/GPU_basic_shader.h
+++ b/source/blender/gpu/GPU_basic_shader.h
@@ -110,6 +110,9 @@ void GPU_basic_shader_stipple(GPUBasicShaderStipple 
stipple_id);
 void GPU_basic_shader_line_stipple(GLint stipple_factor, GLushort 
stipple_pattern);
 void GPU_basic_shader_line_width(float line_width);
 
+bool GPU_basic_shader_use_glsl_get(void);
+void GPU_basic_shader_use_glsl_set(bool enabled);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/gpu/intern/gpu_basic_shader.c 
b/source/blender/gpu/intern/gpu_basic_shader.c
index 088dac6..e4ec57d 100644
--- a/source/blender/gpu/intern/gpu_basic_shader.c
+++ b/source/blender/gpu/intern/gpu_basic_shader.c
@@ -51,8 +51,6 @@
 
 /* State */
 
-static const bool USE_GLSL = false;
-
 static struct {
GPUShader *cached_shaders[GPU_SHADER_OPTION_COMBINATIONS];
bool failed_shaders[GPU_SHADER_OPTION_COMBINATIONS];
@@ -269,6 +267,24 @@ const GLubyte stipple_hexagon[128] = {
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22};
 /* * */
 
+/* GLSL State */
+
+static bool USE_GLSL = false;
+
+/**
+ * \note this isn't part of the basic shader API,
+ * only set from the command line once on startup.
+ */
+void GPU_basic_shader_use_glsl_set(bool enabled)
+{
+   USE_GLSL = enabled;
+}
+
+bool GPU_basic_shader_use_glsl_get(void)
+{
+   return USE_GLSL;
+}
+
 /* Init / exit */
 
 void GPU_basic_shaders_init(void)
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 3b27ad6..c89cdea 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -72,6 +72,7 @@
 
 #include "WM_api.h"
 
+#include "GPU_basic_shader.h"
 #include "GPU_draw.h"
 #include "GPU_extensions.h"
 
@@ -591,6 +592,7 @@ static int arg_handle_print_help(int UNUSED(argc), const 
char **UNUSED(argv), vo
printf("\n");
printf("Experimental Features:\n");
BLI_argsPrintArgDoc(ba, "--enable-new-depsgraph");
+   BLI_argsPrintArgDoc(ba, "--enable-new-basic-shader-glsl");
 
printf("\n");
printf("Argument Parsing:\n");
@@ -1172,6 +1174,16 @@ static int arg_handle_depsgraph_use_new(int 
UNUSED(argc), const char **UNUSED(ar
return 0;
 }
 
+static const char arg_handle_basic_shader_glsl_use_new_doc[] =
+"\n\tUse new GLSL basic shader"
+;
+static int arg_handle_basic_shader_glsl_use_new(int UNUSED(argc), const char 
**UNUSED(argv), void *UNUSED(data))
+{
+   printf("Using new GLSL basic shader.\n");
+   GPU_basic_shader_use_glsl_set(true);
+   return 0;
+}
+
 static const char arg_handle_verbosity_set_doc[] =
 "\n"
 "\tSet logging verbosity level."
@@ -1807,6 +1819,7 @@ void main_args_setup(bContext *C, bArgs *ba, 
SYS_SystemHandle *syshandle)
CB_EX(arg_handle_debug_mode_generic_set, gpumem), (void 
*)G_DEBUG_GPU_MEM);
 
BLI_argsAdd(ba, 1, NULL, "--enable-new-depsgraph", 
CB(arg_handle_depsgraph_use_new), NULL);
+   BLI_argsAdd(ba, 1, NULL, "--enable-new-basic-shader-glsl", 
CB(arg_handle_basic_shader_glsl_use_new), NULL);
 
BLI_argsAdd(ba, 1, NULL, "--verbose", CB(arg_handle_verbosity_set), 
NULL);

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


[Bf-blender-cvs] [d5682b8] compositor-2016: Fix cloth stability when in perfect rest shape.

2016-06-08 Thread Lukas Tönne
Commit: d5682b8bf64b35ad0042d7bcabe881aa8bd26f2d
Author: Lukas Tönne
Date:   Wed Jun 8 10:32:11 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBd5682b8bf64b35ad0042d7bcabe881aa8bd26f2d

Fix cloth stability when in perfect rest shape.

The way cloth is coded, structural springs are only effective when stretched, 
while bending springs act only when shrunk. However, when cloth is exactly in 
its rest shape, neither have any effect, and effectively don't exist for the 
implicit solver.

This creates a stability problem in the initial frames of the simulation, 
especially considering that gravity seems to act so precisely that it doesn't 
disturb the strict equality of lengths, so in parts of the cloth this 
springless state can continue for quite a while.

Here is an example of things going haywire because of this and some suspicious 
logic in collision code acting together: {F314558}

Changing the condition so that structural springs are active even at exactly 
rest length fixes this test case. The use of >= is also supported by the 
original paper that the cloth implementation in blender is based on.

Reviewers: lukastoenne

Reviewed By: lukastoenne

Projects: #bf_blender

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

===

M   source/blender/physics/intern/implicit_blender.c

===

diff --git a/source/blender/physics/intern/implicit_blender.c 
b/source/blender/physics/intern/implicit_blender.c
index 832d516..2ad8ee0 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -1586,8 +1586,11 @@ bool BPH_mass_spring_force_spring_linear(Implicit_Data 
*data, int i, int j, floa

// calculate elonglation
spring_length(data, i, j, extent, dir, &length, vel);
-   
-   if (length > restlen || no_compress) {
+
+   /* This code computes not only the force, but also its derivative.
+  Zero derivative effectively disables the spring for the implicit 
solver.
+  Thus length > restlen makes cloth unconstrained at the start of 
simulation. */
+   if ((length >= restlen && length > 0) || no_compress) {
float stretch_force, f[3], dfdx[3][3], dfdv[3][3];

stretch_force = stiffness * (length - restlen);

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


[Bf-blender-cvs] [a78cd27] compositor-2016: Cuda 7.5 cannot be made to work with a supported cl.exe version in the same way as cuda 6.0 does allow, disabling cuda kernels on buildbot for now

2016-06-08 Thread Martijn Berger
Commit: a78cd27ccfdf2f818aed9c206c69b1d950e61a54
Author: Martijn Berger
Date:   Tue Jun 7 20:58:53 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBa78cd27ccfdf2f818aed9c206c69b1d950e61a54

Cuda 7.5 cannot be made to work with a supported cl.exe version in the same way 
as cuda 6.0 does allow, disabling cuda kernels on buildbot for now

===

M   build_files/buildbot/slave_compile.py

===

diff --git a/build_files/buildbot/slave_compile.py 
b/build_files/buildbot/slave_compile.py
index ff5968a..0e72184 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -77,7 +77,7 @@ if 'cmake' in builder:
 elif builder.startswith('win'):
   if builder.endswith('_vc2015'):
 if builder.startswith('win64'):
-cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64', 
'-DWITH_CYCLES_CUDA_BINARIES=0''])
+cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64', 
'-DWITH_CYCLES_CUDA_BINARIES=0'])
 elif builder.startswith('win32'):
 bits = 32
 cmake_options.extend(['-G', 'Visual Studio 14 2015', 
'-DWITH_CYCLES_CUDA_BINARIES=0'])

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


[Bf-blender-cvs] [a864e84] compositor-2016: GPU: Fix triple buffer w/ basic glsl shader

2016-06-08 Thread Campbell Barton
Commit: a864e84d96619d4505d1631e72df309f1a059296
Author: Campbell Barton
Date:   Wed Jun 8 05:39:22 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBa864e84d96619d4505d1631e72df309f1a059296

GPU: Fix triple buffer w/ basic glsl shader

Needed to add GL_TEXTURE_RECTANGLE support to basic-shader.

===

M   source/blender/gpu/GPU_basic_shader.h
M   source/blender/gpu/intern/gpu_basic_shader.c
M   source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
M   source/blender/windowmanager/intern/wm_draw.c

===

diff --git a/source/blender/gpu/GPU_basic_shader.h 
b/source/blender/gpu/GPU_basic_shader.h
index f30b40c..1e2db6a 100644
--- a/source/blender/gpu/GPU_basic_shader.h
+++ b/source/blender/gpu/GPU_basic_shader.h
@@ -46,11 +46,12 @@ typedef enum GPUBasicShaderOption {
GPU_SHADER_LIGHTING = (1 << 1),   /* use lighting */
GPU_SHADER_TWO_SIDED =(1 << 2),   /* flip normals towards 
viewer */
GPU_SHADER_TEXTURE_2D =   (1 << 3),   /* use 2D texture to replace 
diffuse color */
+   GPU_SHADER_TEXTURE_RECT = (1 << 4),   /* same as 
GPU_SHADER_TEXTURE_2D, for GL_TEXTURE_RECTANGLE */
 
-   GPU_SHADER_SOLID_LIGHTING =   (1 << 4),   /* use faster lighting (set 
automatically) */
-   GPU_SHADER_STIPPLE =  (1 << 5),   /* use stipple */
-   GPU_SHADER_LINE = (1 << 6),   /* draw lines */
-   GPU_SHADER_OPTIONS_NUM = 7,
+   GPU_SHADER_SOLID_LIGHTING =   (1 << 5),   /* use faster lighting (set 
automatically) */
+   GPU_SHADER_STIPPLE =  (1 << 6),   /* use stipple */
+   GPU_SHADER_LINE = (1 << 7),   /* draw lines */
+   GPU_SHADER_OPTIONS_NUM = 8,
GPU_SHADER_OPTION_COMBINATIONS = (1 << GPU_SHADER_OPTIONS_NUM)
 } GPUBasicShaderOption;
 
diff --git a/source/blender/gpu/intern/gpu_basic_shader.c 
b/source/blender/gpu/intern/gpu_basic_shader.c
index e4ec57d..b066922 100644
--- a/source/blender/gpu/intern/gpu_basic_shader.c
+++ b/source/blender/gpu/intern/gpu_basic_shader.c
@@ -324,6 +324,9 @@ static int detect_options()
 
if (glIsEnabled(GL_TEXTURE_2D))
options |= GPU_SHADER_TEXTURE_2D;
+   if (glIsEnabled(GL_TEXTURE_RECTANGLE))
+   options |= GPU_SHADER_TEXTURE_RECT;
+   GPU_SHADER_TEXTURE_RECT
if (glIsEnabled(GL_COLOR_MATERIAL))
options |= GPU_SHADER_USE_COLOR;
 
@@ -363,8 +366,10 @@ static GPUShader *gpu_basic_shader(int options)
strcat(defines, "#define USE_COLOR\n");
if (options & GPU_SHADER_TWO_SIDED)
strcat(defines, "#define USE_TWO_SIDED\n");
-   if (options & GPU_SHADER_TEXTURE_2D)
+   if (options & (GPU_SHADER_TEXTURE_2D | GPU_SHADER_TEXTURE_RECT))
strcat(defines, "#define USE_TEXTURE\n");
+   if (options & GPU_SHADER_TEXTURE_RECT)
+   strcat(defines, "#define USE_TEXTURE_RECTANGLE\n");
if (options & GPU_SHADER_STIPPLE)
strcat(defines, "#define USE_STIPPLE\n");
if (options & GPU_SHADER_LINE) {
@@ -385,7 +390,7 @@ static GPUShader *gpu_basic_shader(int options)

if (shader) {
/* set texture map to first texture unit */
-   if (options & GPU_SHADER_TEXTURE_2D) {
+   if (options & (GPU_SHADER_TEXTURE_2D | 
GPU_SHADER_TEXTURE_RECT)) {
GPU_shader_bind(shader);
glUniform1i(GPU_shader_get_uniform(shader, 
"texture_map"), 0);
GPU_shader_unbind();
@@ -415,6 +420,23 @@ void GPU_basic_shader_bind(int options)
 {
if (USE_GLSL) {
if (options) {
+   const int bound_options = 
GPU_MATERIAL_STATE.bound_options;
+
+   /* texture options need to be set for basic shader too 
*/
+   if (options & GPU_SHADER_TEXTURE_2D) {
+   glEnable(GL_TEXTURE_2D);
+   }
+   else if (bound_options & GPU_SHADER_TEXTURE_2D) {
+   glDisable(GL_TEXTURE_2D);
+   }
+
+   if (options & GPU_SHADER_TEXTURE_RECT) {
+   glEnable(GL_TEXTURE_RECTANGLE);
+   }
+   else if (bound_options & GPU_SHADER_TEXTURE_RECT) {
+   glDisable(GL_TEXTURE_RECTANGLE);
+   }
+
GPUShader *shader = gpu_basic_shader(options);
 
if (shader) {
@@ -427,7 +449,7 @@ void GPU_basic_shader_bind(int options)
}
}
else {
-   int bound_option

[Bf-blender-cvs] [457eadf] compositor-2016: Cycles: Use faster ray-quad-intersection test

2016-06-08 Thread Lukas Stockner
Commit: 457eadf812e609862dd4afedc6a79c5b192e6b79
Author: Lukas Stockner
Date:   Mon Jun 6 23:38:28 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB457eadf812e609862dd4afedc6a79c5b192e6b79

Cycles: Use faster ray-quad-intersection test

The original quad intersection test works by just testing against the two 
triangles that define the quad.
However, in this case it's actually faster to use the same test that's also 
used for portals: Determining
the distance to the plane in which the quad lies, calculating the hitpoint and 
checking whether it's in the
quad by projecting onto the sides.

Reviewers: brecht, sergey, dingto

Reviewed By: dingto

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

===

M   intern/cycles/kernel/kernel_light.h
M   intern/cycles/util/util_math.h

===

diff --git a/intern/cycles/kernel/kernel_light.h 
b/intern/cycles/kernel/kernel_light.h
index 675eacf..736a884 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -291,24 +291,13 @@ ccl_device float background_portal_pdf(KernelGlobals *kg,
}
num_possible++;
 
-   float t = -(dot(P, dir) - dot(lightpos, dir)) / dot(direction, 
dir);
-   if(t <= 1e-4f) {
-   /* Either behind the portal or too close. */
-   continue;
-   }
-
float4 data1 = kernel_tex_fetch(__light_data, (p + 
kernel_data.integrator.portal_offset)*LIGHT_SIZE + 1);
float4 data2 = kernel_tex_fetch(__light_data, (p + 
kernel_data.integrator.portal_offset)*LIGHT_SIZE + 2);
 
float3 axisu = make_float3(data1.y, data1.z, data1.w);
float3 axisv = make_float3(data2.y, data2.z, data2.w);
 
-   float3 hit = P + t*direction;
-   float3 inplane = hit - lightpos;
-   /* Skip if the the ray doesn't pass through portal. */
-   if(fabsf(dot(inplane, axisu) / dot(axisu, axisu)) > 0.5f)
-   continue;
-   if(fabsf(dot(inplane, axisv) / dot(axisv, axisv)) > 0.5f)
+   if(!ray_quad_intersect(P, direction, 1e-4f, FLT_MAX, lightpos, 
axisu, axisv, dir, NULL, NULL))
continue;
 
portal_pdf += area_light_sample(P, &lightpos, axisu, axisv, 
0.0f, 0.0f, false);
@@ -729,8 +718,8 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int 
lamp, float3 P, float3 D,
 
float3 light_P = make_float3(data0.y, data0.z, data0.w);
 
-   if(!ray_quad_intersect(P, D, t,
-  light_P, axisu, axisv, &ls->P, &ls->t))
+   if(!ray_quad_intersect(P, D, 0.0f, t,
+  light_P, axisu, axisv, Ng, &ls->P, 
&ls->t))
{
return false;
}
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 32924f9..53944ec 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -1479,21 +1479,25 @@ ccl_device bool ray_triangle_intersect_uv(
return true;
 }
 
-ccl_device bool ray_quad_intersect(float3 ray_P, float3 ray_D, float ray_t,
-   float3 quad_P, float3 quad_u, float3 quad_v,
+ccl_device bool ray_quad_intersect(float3 ray_P, float3 ray_D, float ray_mint, 
float ray_maxt,
+   float3 quad_P, float3 quad_u, float3 
quad_v, float3 quad_n,
float3 *isect_P, float *isect_t)
 {
-   float3 v0 = quad_P - quad_u*0.5f - quad_v*0.5f;
-   float3 v1 = quad_P + quad_u*0.5f - quad_v*0.5f;
-   float3 v2 = quad_P + quad_u*0.5f + quad_v*0.5f;
-   float3 v3 = quad_P - quad_u*0.5f + quad_v*0.5f;
+   float t = -(dot(ray_P, quad_n) - dot(quad_P, quad_n)) / dot(ray_D, 
quad_n);
+   if(t < ray_mint || t > ray_maxt)
+   return false;
 
-   if(ray_triangle_intersect(ray_P, ray_D, ray_t, v0, v1, v2, isect_P, 
isect_t))
-   return true;
-   else if(ray_triangle_intersect(ray_P, ray_D, ray_t, v0, v2, v3, 
isect_P, isect_t))
-   return true;
-   
-   return false;
+   float3 hit = ray_P + t*ray_D;
+   float3 inplane = hit - quad_P;
+   if(fabsf(dot(inplane, quad_u) / dot(quad_u, quad_u)) > 0.5f)
+   return false;
+   if(fabsf(dot(inplane, quad_v) / dot(quad_v, quad_v)) > 0.5f)
+   return false;
+
+   if(isect_P) *isect_P = hit;
+   if(isect_t) *isect_t = t;
+
+   return true;
 }
 
 /* projections */

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


[Bf-blender-cvs] [f7076cc] compositor-2016: Fix (unreported) EditNormal modifier: broken 'flip poly' feature.

2016-06-08 Thread Bastien Montagne
Commit: f7076cc8a9e570e58ee6ab50800dc4a2258a0c70
Author: Bastien Montagne
Date:   Tue Jun 7 13:04:05 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBf7076cc8a9e570e58ee6ab50800dc4a2258a0c70

Fix (unreported) EditNormal modifier: broken 'flip poly' feature.

Newly computed custom normals were forgotten during poly flipping, leading
to wrong custom normals being assigned to wrong loop...

Dead simple, but was tough to track down this one!

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/cdderivedmesh.c
M   source/blender/blenkernel/intern/mesh_evaluate.c
M   source/blender/modifiers/intern/MOD_normal_edit.c

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index c7d5857..d8d8690 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -323,7 +323,7 @@ void BKE_mesh_mdisp_flip(struct MDisps *md, const bool 
use_loop_mdisp_flip);
 
 void BKE_mesh_polygon_flip_ex(
 struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata,
-struct MDisps *mdisp, const bool use_loop_mdisp_flip);
+float (*lnors)[3], struct MDisps *mdisp, const bool 
use_loop_mdisp_flip);
 void BKE_mesh_polygon_flip(struct MPoly *mpoly, struct MLoop *mloop, struct 
CustomData *ldata);
 void BKE_mesh_polygons_flip(struct MPoly *mpoly, struct MLoop *mloop, struct 
CustomData *ldata, int totpoly);
 
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c 
b/source/blender/blenkernel/intern/cdderivedmesh.c
index e7e6118..392a387 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2660,6 +2660,9 @@ void CDDM_calc_loop_normals(DerivedMesh *dm, const bool 
use_split_normals, const
 }
 
 /* #define DEBUG_CLNORS */
+#ifdef DEBUG_CLNORS
+#  include "BLI_linklist.h"
+#endif
 
 void CDDM_calc_loop_normals_spacearr(
 DerivedMesh *dm, const bool use_split_normals, const float 
split_angle, MLoopNorSpaceArray *r_lnors_spacearr)
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c 
b/source/blender/blenkernel/intern/mesh_evaluate.c
index 577a212..1c86fbc 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -677,7 +677,7 @@ static void 
split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
 */
copy_v3_v3(*lnor, polynors[mp_index]);
 
-   /* printf("BASIC: handling loop %d / edge %d / vert %d\n", 
ml_curr_index, ml_curr->e, ml_curr->v); */
+   /* printf("BASIC: handling loop %d / edge %d / vert %d / poly %d\n", 
ml_curr_index, ml_curr->e, ml_curr->v, mp_index); */
 
/* If needed, generate this (simple!) lnor space. */
if (lnors_spacearr) {
@@ -3262,14 +3262,14 @@ void BKE_mesh_mdisp_flip(MDisps *md, const bool 
use_loop_mdisp_flip)
  */
 void BKE_mesh_polygon_flip_ex(
 MPoly *mpoly, MLoop *mloop, CustomData *ldata,
-MDisps *mdisp, const bool use_loop_mdisp_flip)
+float (*lnors)[3], MDisps *mdisp, const bool use_loop_mdisp_flip)
 {
int loopstart = mpoly->loopstart;
int loopend = loopstart + mpoly->totloop - 1;
const bool loops_in_ldata = (CustomData_get_layer(ldata, CD_MLOOP) == 
mloop);
 
if (mdisp) {
-   for (int i = mpoly->loopstart; i <= loopend; i++) {
+   for (int i = loopstart; i <= loopend; i++) {
BKE_mesh_mdisp_flip(&mdisp[i], use_loop_mdisp_flip);
}
}
@@ -3288,6 +3288,9 @@ void BKE_mesh_polygon_flip_ex(
if (!loops_in_ldata) {
SWAP(MLoop, mloop[loopstart], mloop[loopend]);
}
+   if (lnors) {
+   swap_v3_v3(lnors[loopstart], lnors[loopend]);
+   }
CustomData_swap(ldata, loopstart, loopend);
}
/* Even if we did not swap the other 'pivot' loop, we need to set its 
swapped edge. */
@@ -3299,7 +3302,7 @@ void BKE_mesh_polygon_flip_ex(
 void BKE_mesh_polygon_flip(MPoly *mpoly, MLoop *mloop, CustomData *ldata)
 {
MDisps *mdisp = CustomData_get_layer(ldata, CD_MDISPS);
-   BKE_mesh_polygon_flip_ex(mpoly, mloop, ldata, mdisp, true);
+   BKE_mesh_polygon_flip_ex(mpoly, mloop, ldata, NULL, mdisp, true);
 }
 
 /**
@@ -3315,7 +3318,7 @@ void BKE_mesh_polygons_flip(
int i;
 
for (mp = mpoly, i = 0; i < totpoly; mp++, i++) {
-   BKE_mesh_polygon_flip_ex(mp, mloop, ldata, mdisp, true);
+   BKE_mesh_polygon_flip_ex(mp, mloop, ldata, NULL, mdisp, true);
}
 }
 
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c 
b/source/blender/modifiers/intern/MOD_normal_edit.c
index d386653..2cfa746 100644
--- a/source/blender/modifiers/i

[Bf-blender-cvs] [fd7bd05] compositor-2016: BLO_idcode: Move ID_ID last

2016-06-08 Thread Campbell Barton
Commit: fd7bd0588e743de16999d98aca24d6b16b87e477
Author: Campbell Barton
Date:   Tue Jun 7 16:05:04 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBfd7bd0588e743de16999d98aca24d6b16b87e477

BLO_idcode: Move ID_ID last

This lets us use MAX_LIBARRAY to loop over id-codes in Main.

===

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

===

diff --git a/source/blender/blenkernel/intern/idcode.c 
b/source/blender/blenkernel/intern/idcode.c
index 68a741b..899ed54 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -39,6 +39,7 @@
 
 #include "BLT_translation.h"
 
+#include "BKE_library.h"
 #include "BKE_idcode.h"
 
 typedef struct {
@@ -54,6 +55,7 @@ typedef struct {
 /* plural need to match rna_main.c's MainCollectionDef */
 /* WARNING! Keep it in sync with i18n contexts in BLT_translation.h */
 static IDType idtypes[] = {
+   /** ID's directly below must all be in #Main, and be kept in sync with 
#MAX_LIBARRAY (membership, not order) */
{ ID_AC,   "Action", "actions", 
BLT_I18NCONTEXT_ID_ACTION, IDTYPE_FLAGS_ISLINKABLE },
{ ID_AR,   "Armature",   "armatures",   
BLT_I18NCONTEXT_ID_ARMATURE,   IDTYPE_FLAGS_ISLINKABLE },
{ ID_BR,   "Brush",  "brushes", 
BLT_I18NCONTEXT_ID_BRUSH,  IDTYPE_FLAGS_ISLINKABLE },
@@ -61,7 +63,6 @@ static IDType idtypes[] = {
{ ID_CU,   "Curve",  "curves",  
BLT_I18NCONTEXT_ID_CURVE,  IDTYPE_FLAGS_ISLINKABLE },
{ ID_GD,   "GPencil","grease_pencil",   
BLT_I18NCONTEXT_ID_GPENCIL,IDTYPE_FLAGS_ISLINKABLE }, /* rename 
gpencil */
{ ID_GR,   "Group",  "groups",  
BLT_I18NCONTEXT_ID_GROUP,  IDTYPE_FLAGS_ISLINKABLE },
-   { ID_ID,   "ID", "ids", 
BLT_I18NCONTEXT_ID_ID, 0   }, /* plural is 
fake */
{ ID_IM,   "Image",  "images",  
BLT_I18NCONTEXT_ID_IMAGE,  IDTYPE_FLAGS_ISLINKABLE },
{ ID_IP,   "Ipo","ipos","", 
   IDTYPE_FLAGS_ISLINKABLE }, /* deprecated */
{ ID_KE,   "Key","shape_keys",  
BLT_I18NCONTEXT_ID_SHAPEKEY,   0   },
@@ -89,8 +90,14 @@ static IDType idtypes[] = {
{ ID_VF,   "VFont",  "fonts",   
BLT_I18NCONTEXT_ID_VFONT,  IDTYPE_FLAGS_ISLINKABLE },
{ ID_WO,   "World",  "worlds",  
BLT_I18NCONTEXT_ID_WORLD,  IDTYPE_FLAGS_ISLINKABLE },
{ ID_WM,   "WindowManager",  "window_managers", 
BLT_I18NCONTEXT_ID_WINDOWMANAGER,  0   },
+
+   /** Keep last, not an ID exactly, only include for completeness */
+   { ID_ID,   "ID", "ids", 
BLT_I18NCONTEXT_ID_ID, 0   }, /* plural is 
fake */
 };
 
+/* -1 for ID_ID */
+BLI_STATIC_ASSERT((ARRAY_SIZE(idtypes) - 1 == MAX_LIBARRAY), "Missing IDType");
+
 static IDType *idtype_from_name(const char *str) 
 {
int i = ARRAY_SIZE(idtypes);

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


[Bf-blender-cvs] [74c6598] compositor-2016: Cycles: Fix two numerical issues in the volume code

2016-06-08 Thread Lukas Stockner
Commit: 74c65981ceb55ed8007be2ee8fd1dd7624c29b0c
Author: Lukas Stockner
Date:   Wed Jun 8 03:17:19 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB74c65981ceb55ed8007be2ee8fd1dd7624c29b0c

Cycles: Fix two numerical issues in the volume code

This hopefully fixes T48383 by avoiding two numerical problems that I found in 
the volume code.

Reviewers: sergey, dingto, brecht

Reviewed By: sergey, dingto, brecht

Maniphest Tasks: T48383

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

===

M   intern/cycles/kernel/kernel_volume.h

===

diff --git a/intern/cycles/kernel/kernel_volume.h 
b/intern/cycles/kernel/kernel_volume.h
index 0e313b8..bf8301f 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -276,7 +276,7 @@ ccl_device float kernel_volume_distance_sample(float max_t, 
float3 sigma_t, int
float sample_t = min(max_t, -logf(1.0f - xi*(1.0f - 
sample_transmittance))/sample_sigma_t);
 
*transmittance = volume_color_transmittance(sigma_t, sample_t);
-   *pdf = (sigma_t * *transmittance)/(make_float3(1.0f, 1.0f, 1.0f) - 
full_transmittance);
+   *pdf = safe_divide_color(sigma_t * *transmittance, make_float3(1.0f, 
1.0f, 1.0f) - full_transmittance);
 
/* todo: optimization: when taken together with hit/miss decision,
 * the full_transmittance cancels out drops out and xi does not
@@ -290,7 +290,7 @@ ccl_device float3 kernel_volume_distance_pdf(float max_t, 
float3 sigma_t, float
float3 full_transmittance = volume_color_transmittance(sigma_t, max_t);
float3 transmittance = volume_color_transmittance(sigma_t, sample_t);
 
-   return (sigma_t * transmittance)/(make_float3(1.0f, 1.0f, 1.0f) - 
full_transmittance);
+   return safe_divide_color(sigma_t * transmittance, make_float3(1.0f, 
1.0f, 1.0f) - full_transmittance);
 }
 
 /* Emission */
@@ -625,11 +625,13 @@ ccl_device void 
kernel_volume_decoupled_record(KernelGlobals *kg, PathState *sta
const int global_max_steps = 
kernel_data.integrator.volume_max_steps;
step_size = kernel_data.integrator.volume_step_size;
/* compute exact steps in advance for malloc */
-   max_steps = max((int)ceilf(ray->t/step_size), 1);
-   if(max_steps > global_max_steps) {
+   if(ray->t > global_max_steps*step_size) {
max_steps = global_max_steps;
step_size = ray->t / (float)max_steps;
}
+   else {
+   max_steps = max((int)ceilf(ray->t/step_size), 1);
+   }
 #ifdef __KERNEL_CPU__
/* NOTE: For the branched path tracing it's possible to have 
direct
 * and indirect light integration both having volume segments 
allocated.

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


[Bf-blender-cvs] [8b51486] compositor-2016: Fix T48600: VSE strip 'side selection' fails in 'Both' case.

2016-06-08 Thread Bastien Montagne
Commit: 8b51486a0b02d33f254b0cb76612f20cbe341192
Author: Bastien Montagne
Date:   Tue Jun 7 22:37:31 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB8b51486a0b02d33f254b0cb76612f20cbe341192

Fix T48600: VSE strip 'side selection' fails in 'Both' case.

Looks like a line was forgotten in the 'BOTH' case in code...

===

M   source/blender/editors/space_sequencer/sequencer_select.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_select.c 
b/source/blender/editors/space_sequencer/sequencer_select.c
index 3c2a66c..7475e8b 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -107,6 +107,7 @@ static void select_active_side(ListBase *seqbase, int 
sel_side, int channel, int
break;
case SEQ_SIDE_BOTH:
seq->flag &= ~(SEQ_RIGHTSEL | 
SEQ_LEFTSEL);
+   seq->flag |= SELECT;
break;
}
}
@@ -812,7 +813,7 @@ static int sequencer_select_handles_exec(bContext *C, 
wmOperator *op)
seq->flag |= SEQ_RIGHTSEL;
break;
case SEQ_SIDE_BOTH:
-   seq->flag |= SEQ_LEFTSEL + SEQ_RIGHTSEL;
+   seq->flag |= SEQ_LEFTSEL | SEQ_RIGHTSEL;
break;
}
}

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


[Bf-blender-cvs] [12523d9] compositor-2016: EditNormal modifier: add some 'maximum angle' limit.

2016-06-08 Thread Bastien Montagne
Commit: 12523d9192a93e4f2a11164998b77416ff0ed1bd
Author: Bastien Montagne
Date:   Mon Jun 6 21:41:17 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB12523d9192a93e4f2a11164998b77416ff0ed1bd

EditNormal modifier: add some 'maximum angle' limit.

Allows to avoid generating flipped faces when using extreme normal 
modifications.

Related to T48576.

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/intern/MOD_normal_edit.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index aa03863..7863c07 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1418,6 +1418,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 sub = row.row(align=True)
 sub.active = has_vgroup
 sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
+subcol.prop(md, "mix_limit")
 
 def CORRECTIVE_SMOOTH(self, layout, ob, md):
 is_bind = md.is_bind
diff --git a/source/blender/blenloader/intern/versioning_270.c 
b/source/blender/blenloader/intern/versioning_270.c
index 0ea4078..b7b6ace 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1189,9 +1189,7 @@ void blo_do_versions_270(FileData *fd, Library 
*UNUSED(lib), Main *main)
}
}
}
-   }
 
-   {
for (Camera *camera = main->camera.first; camera != NULL; 
camera = camera->id.next) {
if (camera->stereo.pole_merge_angle_from == 0.0f &&
camera->stereo.pole_merge_angle_to == 0.0f)
@@ -1200,5 +1198,19 @@ void blo_do_versions_270(FileData *fd, Library 
*UNUSED(lib), Main *main)
camera->stereo.pole_merge_angle_to = 
DEG2RAD(75.0f);
}
}
+
+   if (!DNA_struct_elem_find(fd->filesdna, 
"NormalEditModifierData", "float", "mix_limit")) {
+   Object *ob;
+
+   for (ob = main->object.first; ob; ob = ob->id.next) {
+   ModifierData *md;
+   for (md = ob->modifiers.first; md; md = 
md->next) {
+   if (md->type == 
eModifierType_NormalEdit) {
+   NormalEditModifierData *nemd = 
(NormalEditModifierData *)md;
+   nemd->mix_limit = 
DEG2RADF(180.0f);
+   }
+   }
+   }
+   }
}
 }
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 457db70..a58e995 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1518,7 +1518,9 @@ typedef struct NormalEditModifierData {
short mix_mode;
char pad[2];
float mix_factor;
+   float mix_limit;
float offset[3];
+   float pad_f1;
 } NormalEditModifierData;
 
 /* NormalEditModifierData.mode */
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 0c4b3ba..5a2113f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4602,6 +4602,11 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
 "How much of generated normals to mix with exiting 
ones", 0.0f, 1.0f);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
+   prop = RNA_def_float(srna, "mix_limit", 1.0f, 0.0f, DEG2RADF(180.0f), 
"Max Angle",
+"Maximum angle between old and new normals", 0.0f, 
DEG2RADF(180.0f));
+   RNA_def_property_subtype(prop, PROP_ANGLE);
+   RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for 
selecting/weighting the affected areas");
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c 
b/source/blender/modifiers/intern/MOD_normal_edit.c
index 355dd6d..d386653 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.c
+++ b/source/blender/modifiers/intern/MOD_normal_edit.c
@@ -110,7 +110,7 @@ static void

[Bf-blender-cvs] [4449bfb] compositor-2016: Cycles: Fix regression introduced in c96a4c8

2016-06-08 Thread Mai Lavelle
Commit: 4449bfbb18f1d1d4a6a3a824ac9d87a9396efd78
Author: Mai Lavelle
Date:   Thu Jun 2 20:57:04 2016 -0400
Branches: compositor-2016
https://developer.blender.org/rB4449bfbb18f1d1d4a6a3a824ac9d87a9396efd78

Cycles: Fix regression introduced in c96a4c8

A few places still needed to be updated to use the new Mesh::num_triangles()
method; wrong number from triangles.size() was causing crashes.

===

M   intern/cycles/bvh/bvh_split.cpp
M   intern/cycles/render/mesh.cpp
M   intern/cycles/subd/subd_dice.cpp

===

diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp
index 3665fb4..bf68b41 100644
--- a/intern/cycles/bvh/bvh_split.cpp
+++ b/intern/cycles/bvh/bvh_split.cpp
@@ -404,7 +404,7 @@ void BVHSpatialSplit::split_object_reference(const Object 
*object,
  BoundBox& right_bounds)
 {
Mesh *mesh = object->mesh;
-   for(int tri_idx = 0; tri_idx < mesh->triangles.size(); ++tri_idx) {
+   for(int tri_idx = 0; tri_idx < mesh->num_triangles(); ++tri_idx) {
split_triangle_primitive(mesh,
 &object->tfm,
 tri_idx,
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 755b16a..e251556 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -1485,7 +1485,7 @@ bool Mesh::need_attribute(Scene * /*scene*/, ustring name)
 
 void Mesh::tessellate(DiagSplit *split)
 {
-   int num_faces = triangles.size();
+   int num_faces = num_triangles();
 
add_face_normals();
add_vertex_normals();
diff --git a/intern/cycles/subd/subd_dice.cpp b/intern/cycles/subd/subd_dice.cpp
index 8dba137..7c74f21 100644
--- a/intern/cycles/subd/subd_dice.cpp
+++ b/intern/cycles/subd/subd_dice.cpp
@@ -46,7 +46,7 @@ void EdgeDice::reserve(int num_verts)
Mesh *mesh = params.mesh;
 
vert_offset = mesh->verts.size();
-   tri_offset = mesh->triangles.size();
+   tri_offset = mesh->num_triangles();
 
mesh->resize_mesh(vert_offset + num_verts, tri_offset);
 
@@ -84,7 +84,7 @@ void EdgeDice::add_triangle(Patch *patch, int v0, int v1, int 
v2)
 
/* todo: optimize so we can reserve in advance, this is like 
push_back_slow() */
if(mesh->triangles.size() == mesh->triangles.capacity())
-   mesh->reserve_mesh(mesh->verts.size(), 
size_t(max(mesh->triangles.size() + 1, 1) * 1.2));
+   mesh->reserve_mesh(mesh->verts.size(), 
size_t(max(mesh->num_triangles() + 1, 1) * 1.2));
 
mesh->add_triangle(v0, v1, v2, params.shader, params.smooth, false);

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


[Bf-blender-cvs] [20344cc] compositor-2016: Cuda 7.5 cannot be made to work with a supported cl.exe version in the same way as cuda 6.0 does allow, disabling cuda kernels on buildbot for now

2016-06-08 Thread Martijn Berger
Commit: 20344cc1528b515344e6533c7403a0b72171026e
Author: Martijn Berger
Date:   Tue Jun 7 20:56:44 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB20344cc1528b515344e6533c7403a0b72171026e

Cuda 7.5 cannot be made to work with a supported cl.exe version in the same way 
as cuda 6.0 does allow, disabling cuda kernels on buildbot for now

===

M   build_files/buildbot/slave_compile.py

===

diff --git a/build_files/buildbot/slave_compile.py 
b/build_files/buildbot/slave_compile.py
index 4fb879a..ff5968a 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -77,10 +77,10 @@ if 'cmake' in builder:
 elif builder.startswith('win'):
   if builder.endswith('_vc2015'):
 if builder.startswith('win64'):
-cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64', 
b'-DCUDA_NVCC_FLAGS="-ccbin C:\\Program Files (x86)\\Microsoft Visual Studio 
12.0\\VC\\bin\\amd64\\"'])
+cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64', 
'-DWITH_CYCLES_CUDA_BINARIES=0''])
 elif builder.startswith('win32'):
 bits = 32
-cmake_options.extend(['-G', 'Visual Studio 14 2015', 
b'-DCUDA_NVCC_FLAGS="-ccbin C:\\Program Files (x86)\\Microsoft Visual Studio 
12.0\\VC\\bin\\"'])
+cmake_options.extend(['-G', 'Visual Studio 14 2015', 
'-DWITH_CYCLES_CUDA_BINARIES=0'])
   else:
 if builder.startswith('win64'):
 cmake_options.extend(['-G', 'Visual Studio 12 2013 Win64'])

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


[Bf-blender-cvs] [5c3724d] compositor-2016: GPU: Fix for glDrawPixels drawing w/ glsl shader

2016-06-08 Thread Campbell Barton
Commit: 5c3724d6f748e6827a554e7e463128065c5bdab2
Author: Campbell Barton
Date:   Wed Jun 8 04:03:25 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB5c3724d6f748e6827a554e7e463128065c5bdab2

GPU: Fix for glDrawPixels drawing w/ glsl shader

The basic shader needs to be temporarily disabled in this case.
Add macros for temp store/restoring the state.

===

M   source/blender/editors/interface/interface_icons.c
M   source/blender/editors/screen/glutil.c
M   source/blender/gpu/GPU_basic_shader.h
M   source/blender/windowmanager/intern/wm_gesture.c

===

diff --git a/source/blender/editors/interface/interface_icons.c 
b/source/blender/editors/interface/interface_icons.c
index 0a25a8f..222b036 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1220,8 +1220,13 @@ static void icon_draw_rect(float x, float y, int w, int 
h, float UNUSED(aspect),
glaDrawPixelsSafe(draw_x, draw_y, draw_w, draw_h, draw_w, 
GL_RGBA, GL_UNSIGNED_BYTE, rect);
}
else {
+   int bound_options;
+   GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options);
+
glRasterPos2f(draw_x, draw_y);
glDrawPixels(draw_w, draw_h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+
+   GPU_BASIC_SHADER_ENABLE_AND_RESTORE(bound_options);
}
 
if (ima)
diff --git a/source/blender/editors/screen/glutil.c 
b/source/blender/editors/screen/glutil.c
index cbf8706..0142682 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -579,6 +579,10 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int 
img_h, int row_w, int fo
draw_h = min_ii(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom));
 
if (draw_w > 0 && draw_h > 0) {
+
+   int bound_options;
+   GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options);
+
/* Don't use safe RasterPos (slower) if we can avoid it. */
if (rast_x >= 0 && rast_y >= 0) {
glRasterPos2f(rast_x, rast_y);
@@ -610,6 +614,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int 
img_h, int row_w, int fo
}

glPixelStorei(GL_UNPACK_ROW_LENGTH,  0);
+
+   GPU_BASIC_SHADER_ENABLE_AND_RESTORE(bound_options);
}
 }
 
diff --git a/source/blender/gpu/GPU_basic_shader.h 
b/source/blender/gpu/GPU_basic_shader.h
index 11d87ce..f30b40c 100644
--- a/source/blender/gpu/GPU_basic_shader.h
+++ b/source/blender/gpu/GPU_basic_shader.h
@@ -76,6 +76,22 @@ void GPU_basic_shaders_exit(void);
 void GPU_basic_shader_bind(int options);
 int GPU_basic_shader_bound_options(void);
 
+/* Only use for small blocks of code that don't support glsl shader. */
+#define GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options) \
+if (GPU_basic_shader_use_glsl_get()) { \
+   if ((bound_options = GPU_basic_shader_bound_options())) { \
+   GPU_basic_shader_bind(0); \
+   } \
+} \
+else { bound_options = 0; } ((void)0)
+#define GPU_BASIC_SHADER_ENABLE_AND_RESTORE(bound_options) \
+if (GPU_basic_shader_use_glsl_get()) { \
+   if (bound_options) { \
+   GPU_basic_shader_bind(bound_options); \
+   } \
+} ((void)0)
+
+
 void GPU_basic_shader_colors(const float diffuse[3], const float specular[3],
int shininess, float alpha);
 
diff --git a/source/blender/windowmanager/intern/wm_gesture.c 
b/source/blender/windowmanager/intern/wm_gesture.c
index 26d1d4c..db933ad 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -281,6 +281,9 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
   (const int (*)[2])moves, tot,
   draw_filled_lasso_px_cb, &lasso_fill_data);
 
+   int bound_options;
+   GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options);
+
glEnable(GL_BLEND);
// glColor4f(1.0, 1.0, 1.0, 0.05);
 
@@ -288,6 +291,8 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
 
glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buf);
 
+   GPU_BASIC_SHADER_ENABLE_AND_RESTORE(bound_options);
+
glDisable(GL_BLEND);
MEM_freeN(pixel_buf);
}

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


[Bf-blender-cvs] [646a390] compositor-2016: Cleanup - size_t is unsigned, so always >= 0!

2016-06-08 Thread Bastien Montagne
Commit: 646a390de5307bfcb6939928c5b2ea5166bbcb8b
Author: Bastien Montagne
Date:   Tue Jun 7 21:53:17 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB646a390de5307bfcb6939928c5b2ea5166bbcb8b

Cleanup - size_t is unsigned, so always >= 0!

===

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

===

diff --git a/source/blender/blenkernel/intern/customdata.c 
b/source/blender/blenkernel/intern/customdata.c
index de79a30..612f1f4 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1853,8 +1853,6 @@ static CustomDataLayer 
*customData_add_layer__internal(CustomData *data, int typ
   (alloctype == CD_DUPLICATE) ||
   (alloctype == CD_REFERENCE));
 
-   BLI_assert(size >= 0);
-
if (!typeInfo->defaultname && CustomData_has_layer(data, type))
return &data->layers[CustomData_get_layer_index(data, type)];

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


[Bf-blender-cvs] [83d7947] compositor-2016: 3D Text: move undo into its own file

2016-06-08 Thread Campbell Barton
Commit: 83d794728a4cddfeddcb20731c5f7f9922ed7bb1
Author: Campbell Barton
Date:   Wed Jun 8 16:38:27 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB83d794728a4cddfeddcb20731c5f7f9922ed7bb1

3D Text: move undo into its own file

===

M   source/blender/editors/curve/CMakeLists.txt
M   source/blender/editors/curve/editfont.c
A   source/blender/editors/curve/editfont_undo.c
M   source/blender/editors/include/ED_curve.h

===

diff --git a/source/blender/editors/curve/CMakeLists.txt 
b/source/blender/editors/curve/CMakeLists.txt
index ebdf6bb..2f5b2ab 100644
--- a/source/blender/editors/curve/CMakeLists.txt
+++ b/source/blender/editors/curve/CMakeLists.txt
@@ -43,6 +43,7 @@ set(SRC
editcurve_paint.c
editcurve_select.c
editfont.c
+   editfont_undo.c
 
curve_intern.h
 )
diff --git a/source/blender/editors/curve/editfont.c 
b/source/blender/editors/curve/editfont.c
index 7c1fe0c..053a7ee 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1794,64 +1794,6 @@ void FONT_OT_unlink(wmOperatorType *ot)
ot->exec = font_unlink_exec;
 }
 
-
-/*  undo for font object ** */
-
-static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata))
-{
-   Curve *cu = (Curve *)ecu;
-   EditFont *ef = cu->editfont;
-   const char *str = strv;
-
-   ef->pos = *((const short *)str);
-   ef->len = *((const short *)(str + 2));
-
-   memcpy(ef->textbuf, str + 4, (ef->len + 1) * sizeof(wchar_t));
-   memcpy(ef->textbufinfo, str + 4 + (ef->len + 1) * sizeof(wchar_t), 
ef->len * sizeof(CharInfo));
-   
-   ef->selstart = ef->selend = 0;
-
-}
-
-static void *editFont_to_undoFont(void *ecu, void *UNUSED(obdata))
-{
-   Curve *cu = (Curve *)ecu;
-   EditFont *ef = cu->editfont;
-   char *str;
-   
-   /* The undo buffer includes [MAXTEXT+6]=actual string and 
[MAXTEXT+4]*sizeof(CharInfo)=charinfo */
-   str = MEM_callocN((MAXTEXT + 6) * sizeof(wchar_t) + (MAXTEXT + 4) * 
sizeof(CharInfo), "string undo");
-
-   /* Copy the string and string information */
-   memcpy(str + 4, ef->textbuf, (ef->len + 1) * sizeof(wchar_t));
-   memcpy(str + 4 + (ef->len + 1) * sizeof(wchar_t), ef->textbufinfo, 
ef->len * sizeof(CharInfo));
-
-   *((short *)(str + 0)) = ef->pos;
-   *((short *)(str + 2)) = ef->len;
-   
-   return str;
-}
-
-static void free_undoFont(void *strv)
-{
-   MEM_freeN(strv);
-}
-
-static void *get_undoFont(bContext *C)
-{
-   Object *obedit = CTX_data_edit_object(C);
-   if (obedit && obedit->type == OB_FONT) {
-   return obedit->data;
-   }
-   return NULL;
-}
-
-/* and this is all the undo system needs to know */
-void undo_push_font(bContext *C, const char *name)
-{
-   undo_editmode_push(C, name, get_undoFont, free_undoFont, 
undoFont_to_editFont, editFont_to_undoFont, NULL);
-}
-
 /**
  * TextBox selection
  */
diff --git a/source/blender/editors/curve/editfont_undo.c 
b/source/blender/editors/curve/editfont_undo.c
new file mode 100644
index 000..cee1069
--- /dev/null
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -0,0 +1,99 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+/** \file blender/editors/curve/editfont_undo.c
+ *  \ingroup edcurve
+ */
+
+#include 
+#include 
+#include 
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+
+#include "DNA_curve_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_context.h"
+#include "BKE_font.h"
+
+#include "ED_curve.h"
+#include "ED_util.h"
+
+/* TODO, remove */
+#define MAXTEXT 32766
+
+static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata))
+{
+   Curve *cu = (Curve *)ecu;
+   EditFont *ef = cu->editfont;
+   const char *str = strv;
+
+   ef->pos = *((const short *)str);
+   ef->len = *((const short *)(str + 2));
+
+   memcpy(ef->textbuf, str + 4, (ef->len + 1) * sizeof(wchar_t));
+   memcpy(ef->t

[Bf-blender-cvs] [b5a9434] compositor-2016: Cleanup: Add comment on behavior of tweak events

2016-06-08 Thread Julian Eisel
Commit: b5a9434a29a19e214c2fee8427351392620f3762
Author: Julian Eisel
Date:   Tue Jun 7 23:10:53 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBb5a9434a29a19e214c2fee8427351392620f3762

Cleanup: Add comment on behavior of tweak events

It's not obvious that they use the mouse coordinate of the initial key-press 
event (behavior since rBf1f33ba7be2d), so added comment.

Also corrected other comments.

===

M   source/blender/windowmanager/wm_event_types.h

===

diff --git a/source/blender/windowmanager/wm_event_types.h 
b/source/blender/windowmanager/wm_event_types.h
index e2b95da..3085f13 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -311,14 +311,17 @@ enum {
TIMERNOTIFIER = 0x0118,  /* timer event, notifier sender */
TIMERF= 0x011F,  /* last timer */
 
-   /* Tweak, gestures: 0x500x, 0x501x */
+   /* Actionzones, tweak, gestures: 0x500x, 0x501x */
EVT_ACTIONZONE_AREA   = 0x5000,
EVT_ACTIONZONE_REGION = 0x5001,
EVT_ACTIONZONE_FULLSCREEN = 0x5011,
 
/* NOTE: these values are saved in keymap files, do not change them but 
just add new ones */
 
-   /* tweak events, for L M R mousebuttons */
+   /* Tweak events:
+* Sent as additional event with the mouse coordinates from where the 
initial click was placed. */
+
+   /* tweak events for L M R mousebuttons */
EVT_TWEAK_L   = 0x5002,
EVT_TWEAK_M   = 0x5003,
EVT_TWEAK_R   = 0x5004,

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


[Bf-blender-cvs] [fa9d7bc] compositor-2016: readfile: avoid library lookups for every id on undo

2016-06-08 Thread Campbell Barton
Commit: fa9d7bcff67fd3fb842554a284a57eb46e3df2d1
Author: Campbell Barton
Date:   Tue Jun 7 01:54:59 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBfa9d7bcff67fd3fb842554a284a57eb46e3df2d1

readfile: avoid library lookups for every id on undo

Instead index libraries, makes minor speedup when using many libraries.

===

M   source/blender/blenloader/intern/readfile.c
M   source/blender/makesdna/DNA_ID.h

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 96a9c44..fd105f6 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -485,53 +485,57 @@ void blo_join_main(ListBase *mainlist)
}
 }
 
-static void split_libdata(ListBase *lb, Main *first)
+static void split_libdata(ListBase *lb_src, Main **lib_main_array, const 
unsigned int lib_main_array_len)
 {
-   ListBase *lbn;
-   ID *id, *idnext;
-   Main *mainvar;
-   
-   id = lb->first;
-   while (id) {
+   for (ID *id = lb_src->first, *idnext; id; id = idnext) {
idnext = id->next;
+
if (id->lib) {
-   mainvar = first;
-   while (mainvar) {
-   if (mainvar->curlib == id->lib) {
-   lbn= which_libbase(mainvar, 
GS(id->name));
-   BLI_remlink(lb, id);
-   BLI_addtail(lbn, id);
-   break;
-   }
-   mainvar = mainvar->next;
+   if (((unsigned int)id->lib->temp_index < 
lib_main_array_len) &&
+   /* this check should never fail, just incase 
'id->lib' is a dangling pointer. */
+   (lib_main_array[id->lib->temp_index]->curlib == 
id->lib))
+   {
+   Main *mainvar = 
lib_main_array[id->lib->temp_index];
+   ListBase *lb_dst = which_libbase(mainvar, 
GS(id->name));
+   BLI_remlink(lb_src, id);
+   BLI_addtail(lb_dst, id);
+   }
+   else {
+   printf("%s: invalid library for '%s'\n", 
__func__, id->name);
+   BLI_assert(0);
}
-   if (mainvar == NULL) printf("error split_libdata\n");
}
-   id = idnext;
}
 }
 
 void blo_split_main(ListBase *mainlist, Main *main)
 {
-   ListBase *lbarray[MAX_LIBARRAY];
-   Library *lib;
-   int i;
-   
mainlist->first = mainlist->last = main;
main->next = NULL;

if (BLI_listbase_is_empty(&main->library))
return;

-   for (lib = main->library.first; lib; lib = lib->id.next) {
+   /* (Library.temp_index -> Main), lookup table */
+   const unsigned int lib_main_array_len = 
BLI_listbase_count(&main->library);
+   Main **lib_main_array = MEM_mallocN(lib_main_array_len 
* sizeof(*lib_main_array), __func__);
+
+   int i = 0;
+   for (Library *lib = main->library.first; lib; lib = lib->id.next, i++) {
Main *libmain = BKE_main_new();
libmain->curlib = lib;
BLI_addtail(mainlist, libmain);
+   lib->temp_index = i;
+   lib_main_array[i] = libmain;
}

+   ListBase *lbarray[MAX_LIBARRAY];
i = set_listbasepointers(main, lbarray);
-   while (i--)
-   split_libdata(lbarray[i], main->next);
+   while (i--) {
+   split_libdata(lbarray[i], lib_main_array, lib_main_array_len);
+   }
+
+   MEM_freeN(lib_main_array);
 }
 
 static void read_file_version(FileData *fd, Main *main)
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index d3d7d07..b0812a8 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -154,6 +154,9 @@ typedef struct Library {
struct Library *parent; /* set for indirectly linked libs, used in the 
outliner and while reading */

struct PackedFile *packedfile;
+
+   int temp_index;
+   int _pad;
 } Library;
 
 enum eIconSizes {

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


[Bf-blender-cvs] [e2ae104] compositor-2016: Cleanup: warning

2016-06-08 Thread Campbell Barton
Commit: e2ae104372d781e0b0351e9e48c08e7f754aca93
Author: Campbell Barton
Date:   Tue Jun 7 19:23:43 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rBe2ae104372d781e0b0351e9e48c08e7f754aca93

Cleanup: warning

===

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

===

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index d16e6d5..a3393b6 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2196,7 +2196,8 @@ bool BKE_scene_use_shading_nodes_custom(Scene *scene)
 bool BKE_scene_use_world_space_shading(Scene *scene)
 {
const RenderEngineType *type = RE_engines_find(scene->r.engine);
-   return (type && (type->flag & RE_USE_SHADING_NODES) || (scene->r.mode & 
R_USE_WS_SHADING));
+   return ((scene->r.mode & R_USE_WS_SHADING) ||
+   (type && (type->flag & RE_USE_SHADING_NODES)));
 }
 
 bool BKE_scene_use_spherical_stereo(Scene *scene)

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


[Bf-blender-cvs] [2f8f79b] compositor-2016: Fix T48589: Compositor Backdrop crashes Blender

2016-06-08 Thread Sergey Sharybin
Commit: 2f8f79bcfaed8b0119cbcd0e8077c540e49b98c4
Author: Sergey Sharybin
Date:   Tue Jun 7 16:44:15 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB2f8f79bcfaed8b0119cbcd0e8077c540e49b98c4

Fix T48589: Compositor Backdrop crashes Blender

===

M   source/blender/compositor/operations/COM_ImageOperation.cpp

===

diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp 
b/source/blender/compositor/operations/COM_ImageOperation.cpp
index 624378f..7d59358 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -160,10 +160,10 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, 
float y, PixelSampler sa
 void ImageOperation::executePixelSampled(float output[4], float x, float y, 
PixelSampler sampler)
 {
int ix = x, iy = y;
-   if (ix < 0 || iy < 0 || ix >= this->m_buffer->x || iy >= 
this->m_buffer->y) {
+   if (this->m_imageFloatBuffer == NULL && this->m_imageByteBuffer == 
NULL) {
zero_v4(output);
}
-   else if (this->m_imageFloatBuffer == NULL && this->m_imageByteBuffer == 
NULL) {
+   else if (ix < 0 || iy < 0 || ix >= this->m_buffer->x || iy >= 
this->m_buffer->y) {
zero_v4(output);
}
else {

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


[Bf-blender-cvs] [a9d2f51] compositor-2016: Cycles: Limit degenerated triangle check got CUDA only

2016-06-08 Thread Sergey Sharybin
Commit: a9d2f5172285acf838e66719bff44033b079d123
Author: Sergey Sharybin
Date:   Tue Jun 7 15:47:39 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBa9d2f5172285acf838e66719bff44033b079d123

Cycles: Limit degenerated triangle check got CUDA only

OpenCL seems to work fine here, and for some reason that comparison was
giving compilation error on OpenCL here.

Better to compile OpenCL kernel than to be fully robust to weird corner
cases.

===

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

===

diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h 
b/intern/cycles/kernel/geom/geom_triangle_intersect.h
index 4e2f46d..b6dfc76 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -159,7 +159,7 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility)
 #endif
{
-#ifdef __KERNEL_GPU__
+#ifdef __KERNEL_CUDA__
if(A == B && B == C) {
return false;
}

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


[Bf-blender-cvs] [08fc85f] compositor-2016: Correct exit-code check

2016-06-08 Thread Campbell Barton
Commit: 08fc85f49f637842cca72fcc4056ad4d35ef8cda
Author: Campbell Barton
Date:   Tue Jun 7 13:57:50 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB08fc85f49f637842cca72fcc4056ad4d35ef8cda

Correct exit-code check

===

M   doc/python_api/sphinx_doc_gen.sh

===

diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh
index 7095808..1ab6bd5 100755
--- a/doc/python_api/sphinx_doc_gen.sh
+++ b/doc/python_api/sphinx_doc_gen.sh
@@ -61,7 +61,7 @@ if $DO_EXE_BLENDER ; then
--python-exit-code 1 \
--python $SPHINXBASE/sphinx_doc_gen.py
 
-   if (($? == 1)) ; then
+   if (($? != 0)) ; then
echo "Generating documentation failed, aborting"
exit 1
fi

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


[Bf-blender-cvs] [a84bc16] compositor-2016: Fix T48472: issue in array refactor, causing performance regression in BVH build.

2016-06-08 Thread Brecht Van Lommel
Commit: a84bc16220dfd662ceeb4f2f1419b1b38fc95e50
Author: Brecht Van Lommel
Date:   Fri May 20 10:56:10 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBa84bc16220dfd662ceeb4f2f1419b1b38fc95e50

Fix T48472: issue in array refactor, causing performance regression in BVH 
build.

===

M   intern/cycles/util/util_vector.h

===

diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h
index a8a1c4c..8f833af 100644
--- a/intern/cycles/util/util_vector.h
+++ b/intern/cycles/util/util_vector.h
@@ -130,14 +130,8 @@ public:
array& operator=(const array& from)
{
if(this != &from) {
-   clear();
-
-   if(from.datasize_ > 0) {
-   data_ = mem_allocate(from.datasize_);
-   memcpy(data_, from.data_, 
from.datasize_*sizeof(T));
-   datasize_ = from.datasize_;
-   capacity_ = datasize_;
-   }
+   resize(from.size());
+   memcpy(data_, from.data_, datasize_*sizeof(T));
}
 
return *this;
@@ -145,12 +139,9 @@ public:
 
array& operator=(const vector& from)
{
-   clear();
+   resize(from.size());
 
if(from.size() > 0) {
-   datasize_ = from.size();
-   capacity_ = datasize_;
-   data_ = mem_allocate(datasize_);
memcpy(data_, &from[0], datasize_*sizeof(T));
}
 
@@ -164,42 +155,34 @@ public:
 
bool operator==(const vector& other)
{
-   if(datasize_ != other.datasize_)
+   if(datasize_ != other.datasize_) {
return false;
+   }
 
return memcmp(data_, other.data_, datasize_*sizeof(T)) == 0;
}
 
-   void steal_data(array& from)
-   {
-   if(this != &from)
-   {
-   clear();
-
-   data_ = from.data_;
-   datasize_ = from.datasize_;
-   capacity_ = from.capacity_;
-
-   from.data_ = NULL;
-   from.datasize_ = 0;
-   from.capacity_ = 0;
-   }
-   }
-
T* resize(size_t newsize)
{
if(newsize == 0) {
clear();
}
-   else if(newsize != capacity_) {
-   T *newdata = mem_allocate(newsize);
-   if(data_ != NULL) {
-   memcpy(newdata, data_, ((datasize_ < newsize)? 
datasize_: newsize)*sizeof(T));
-   mem_free(data_, capacity_);
+   else if(newsize != datasize_) {
+   if(newsize > capacity_) {
+   T *newdata = mem_allocate(newsize);
+   if(newdata == NULL) {
+   /* Allocation failed, likely out of 
memory. */
+   clear();
+   return NULL;
+   }
+   else if(data_ != NULL) {
+   memcpy(newdata, data_, ((datasize_ < 
newsize)? datasize_: newsize)*sizeof(T));
+   mem_free(data_, capacity_);
+   }
+   data_ = newdata;
+   capacity_ = newsize;
}
-   data_ = newdata;
datasize_ = newsize;
-   capacity_ = newsize;
}
return data_;
}

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


[Bf-blender-cvs] [3b43218] compositor-2016: Add Peak Memory as render stamp option

2016-06-08 Thread Lukas Stockner
Commit: 3b43218af3ccbb906005a8b050eb0581cc8a3016
Author: Lukas Stockner
Date:   Thu May 19 21:39:22 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB3b43218af3ccbb906005a8b050eb0581cc8a3016

Add Peak Memory as render stamp option

This commit adds Peak Memory to the stamp options, the value is the same one 
that is already shown in the image viewer.

Requested by @nutel.

Reviewers: campbellbarton

Subscribers: campbellbarton, nutel

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

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/blenkernel/intern/image.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 6c49049..13e7265 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -360,6 +360,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel):
 col.prop(rd, "use_stamp_render_time", text="RenderTime")
 col.prop(rd, "use_stamp_frame", text="Frame")
 col.prop(rd, "use_stamp_scene", text="Scene")
+col.prop(rd, "use_stamp_memory", text="Memory")
 
 col = split.column()
 col.prop(rd, "use_stamp_camera", text="Camera")
diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index d4551fd..1ae7ca1 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1748,6 +1748,7 @@ typedef struct StampData {
char scene[STAMP_NAME_SIZE];
char strip[STAMP_NAME_SIZE];
char rendertime[STAMP_NAME_SIZE];
+   char memory[STAMP_NAME_SIZE];
 } StampData;
 #undef STAMP_NAME_SIZE
 
@@ -1869,6 +1870,13 @@ static void stampdata(Scene *scene, Object *camera, 
StampData *stamp_data, int d
else {
stamp_data->rendertime[0] = '\0';
}
+
+   if (stats && (scene->r.stamp & R_STAMP_MEMORY)) {
+   BLI_snprintf(stamp_data->memory, 
sizeof(stamp_data->memory), do_prefix ? "Peak Memory %.2fM" : "%.2fM", 
stats->mem_peak);
+   }
+   else {
+   stamp_data->memory[0] = '\0';
+   }
}
 }
 
@@ -1943,6 +1951,12 @@ static void stampdata_from_template(StampData 
*stamp_data,
else {
stamp_data->rendertime[0] = '\0';
}
+   if (scene->r.stamp & R_STAMP_MEMORY) {
+   BLI_snprintf(stamp_data->memory, sizeof(stamp_data->memory), 
"Peak Memory %s", stamp_data_template->memory);
+   }
+   else {
+   stamp_data->memory[0] = '\0';
+   }
 }
 
 void BKE_image_stamp_buf(
@@ -2056,6 +2070,21 @@ void BKE_image_stamp_buf(
}
 
/* Top left corner, below File, Date, Rendertime */
+   if (TEXT_SIZE_CHECK(stamp_data.memory, w, h)) {
+   y -= h;
+
+   /* and space for background. */
+   buf_rectfill_area(rect, rectf, width, height, 
scene->r.bg_stamp, display,
+ 0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + 
h + BUFF_MARGIN_Y);
+
+   BLF_position(mono, x, y + y_ofs, 0.0);
+   BLF_draw_buffer(mono, stamp_data.memory, 
BLF_DRAW_STR_DUMMY_MAX);
+
+   /* the extra pixel for background. */
+   y -= BUFF_MARGIN_Y * 2;
+   }
+
+   /* Top left corner, below File, Date, Memory, Rendertime */
BLF_enable(mono, BLF_WORD_WRAP);
if (TEXT_SIZE_CHECK_WORD_WRAP(stamp_data.note, w, h)) {
y -= h;
@@ -2219,6 +2248,7 @@ void BKE_stamp_info_callback(void *data, struct StampData 
*stamp_data, StampCall
CALL(scene, "Scene");
CALL(strip, "Strip");
CALL(rendertime, "RenderTime");
+   CALL(memory, "Memory");
 
 #undef CALL
 }
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 27abbb6..d307ba1 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -545,7 +545,7 @@ void BKE_scene_init(Scene *sce)
sce->r.bake.im_format.compress = 15;
 
sce->r.scemode = R_DOCOMP | R_DOSEQ | R_EXTENSION;
-   sce->r.stamp = R_STAMP_TIME | R_STAMP_FRAME | R_STAMP_DATE | 
R_STAMP_CAMERA | R_STAMP_SCENE | R_STAMP_FILENAME | R_STAMP_RENDERTIME;
+   sce->r.stamp = R_STAMP_TIME | R_STAMP_FRAME | R_STAMP_DATE | 
R_STAMP_CAMERA | R_STAMP_SCENE | R_STAMP_FILENAME | R_STAMP_RENDERTIME | 
R_STAMP_MEMORY;
sce->r.stamp_font_id = 12;
sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
sce->r.fg_stamp[3] = 1.0f;
dif

[Bf-blender-cvs] [57e763d] compositor-2016: Cleanup: misleading indentation

2016-06-08 Thread Campbell Barton
Commit: 57e763d24d6ed08dbbd196f16e3a2cd3237a0f96
Author: Campbell Barton
Date:   Thu May 19 23:37:23 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB57e763d24d6ed08dbbd196f16e3a2cd3237a0f96

Cleanup: misleading indentation

===

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

===

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 6b39dea..9e384eb 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -3277,7 +3277,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface 
*surface,
nearest.dist_sq = 
brush_radius * brush_radius; /* find_nearest uses squared distance */
 
/* Check volume 
collision   */
-   if (brush->collision == 
MOD_DPAINT_COL_VOLUME || brush->collision == MOD_DPAINT_COL_VOLDIST)
+   if 
(ELEM(brush->collision, MOD_DPAINT_COL_VOLUME, MOD_DPAINT_COL_VOLDIST)) {

BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f,

 &hit, mesh_tris_spherecast_dp, &treeData);
if (hit.index 
!= -1) {
@@ -3321,9 +3321,10 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface 
*surface,

}
}
}
+   }
 
/* Check proximity 
collision*/
-   if ((brush->collision 
== MOD_DPAINT_COL_DIST || brush->collision == MOD_DPAINT_COL_VOLDIST) &&
+   if 
(ELEM(brush->collision, MOD_DPAINT_COL_DIST, MOD_DPAINT_COL_VOLDIST) &&
(!hit_found || 
(brush->flags & MOD_DPAINT_INVERSE_PROX)))
{
float proxDist 
= -1.0f;

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


[Bf-blender-cvs] [41dddc3] compositor-2016: Added P key toggle to allow mouse movement to control bevel profile (modal).

2016-06-08 Thread Howard Trickey
Commit: 41dddc37728a5e2b2ee9a680f9cf5af3bb86281b
Author: Howard Trickey
Date:   Mon Jun 6 13:15:13 2016 -0400
Branches: compositor-2016
https://developer.blender.org/rB41dddc37728a5e2b2ee9a680f9cf5af3bb86281b

Added P key toggle to allow mouse movement to control bevel profile (modal).

The Shift key can be held while adjusting profile to make finer changes
to the profile (just as it already does when adjusting offset).

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_bevel.c 
b/source/blender/editors/mesh/editmesh_bevel.c
index 242cbf7..0f871cd 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -58,6 +58,9 @@
 
 #define MVAL_PIXEL_MARGIN  5.0f
 
+/* until implement profile = 0 case, need to clamp somewhat above zero */
+#define PROFILE_HARD_MIN 0.15f
+
 typedef struct {
BMEditMesh *em;
float initial_length;
@@ -71,13 +74,14 @@ typedef struct {
BMBackup mesh_backup;
void *draw_handle_pixel;
short twtype;
+   bool mouse_controls_profile;
float segments; /* Segments as float so smooth mouse pan works in 
small increments */
 } BevelData;
 
 static void edbm_bevel_update_header(bContext *C, wmOperator *op)
 {
const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), 
Mode: %s (M), Clamp Overlap: %s (C), "
-"Vertex Only: %s (V), Offset: %s, Segments: 
%d");
+"Vertex Only: %s (V), Profile Control: %s (P), 
Offset: %s, Segments: %d");
 
char msg[UI_MAX_DRAW_STR];
ScrArea *sa = CTX_wm_area(C);
@@ -101,6 +105,7 @@ static void edbm_bevel_update_header(bContext *C, 
wmOperator *op)
BLI_snprintf(msg, sizeof(msg), str, type_str,
 WM_bool_as_string(RNA_boolean_get(op->ptr, 
"clamp_overlap")),
 WM_bool_as_string(RNA_boolean_get(op->ptr, 
"vertex_only")),
+WM_bool_as_string(opdata->mouse_controls_profile),
 offset_str, RNA_int_get(op->ptr, "segments"));
 
ED_area_headerprint(sa, msg);
@@ -123,6 +128,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, 
const bool is_modal)
opdata->em = em;
opdata->is_modal = is_modal;
opdata->shift_factor = -1.0f;
+   opdata->mouse_controls_profile = false;
 
initNumInput(&opdata->num_input);
opdata->num_input.idx_max = 0;
@@ -291,7 +297,7 @@ static float edbm_bevel_mval_factor(wmOperator *op, const 
wmEvent *event)
 {
BevelData *opdata = op->customdata;
bool use_dist;
-   bool is_percent;
+   bool is_percent, is_profile;
float mdiff[2];
float factor;
 
@@ -299,15 +305,20 @@ static float edbm_bevel_mval_factor(wmOperator *op, const 
wmEvent *event)
mdiff[1] = opdata->mcenter[1] - event->mval[1];
is_percent = (RNA_enum_get(op->ptr, "offset_type") == 
BEVEL_AMT_PERCENT);
use_dist = !is_percent;
+   is_profile = opdata->mouse_controls_profile;
 
factor = ((len_v2(mdiff) - MVAL_PIXEL_MARGIN) - opdata->initial_length) 
* opdata->pixel_size;
 
/* Fake shift-transform... */
if (event->shift) {
if (opdata->shift_factor < 0.0f) {
-   opdata->shift_factor = RNA_float_get(op->ptr, "offset");
-   if (is_percent) {
-   opdata->shift_factor /= 100.0f;
+   if (is_profile)
+   opdata->shift_factor = RNA_float_get(op->ptr, 
"profile");
+   else {
+   opdata->shift_factor = RNA_float_get(op->ptr, 
"offset");
+   if (is_percent) {
+   opdata->shift_factor /= 100.0f;
+   }
}
}
factor = (factor - opdata->shift_factor) * 0.1f + 
opdata->shift_factor;
@@ -316,14 +327,19 @@ static float edbm_bevel_mval_factor(wmOperator *op, const 
wmEvent *event)
opdata->shift_factor = -1.0f;
}
 
-   /* clamp differently based on distance/factor */
-   if (use_dist) {
-   if (factor < 0.0f) factor = 0.0f;
+   /* clamp differently based on distance/factor/profile */
+   if (is_profile) {
+   CLAMP(factor, PROFILE_HARD_MIN, 1.0f);
}
else {
-   CLAMP(factor, 0.0f, 1.0f);
-   if (is_percent) {
-   factor *= 100.0f;
+   if (use_dist) {
+   if (factor < 0.0f) factor = 0.0f;
+   }
+   else {
+   CLAMP(factor, 0.0f, 1.0f);
+ 

[Bf-blender-cvs] [163089e] compositor-2016: Cleanup: warning

2016-06-08 Thread Campbell Barton
Commit: 163089e01c073b9c32f33dbf9b5007fae49d65c5
Author: Campbell Barton
Date:   Tue Jun 7 00:34:03 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB163089e01c073b9c32f33dbf9b5007fae49d65c5

Cleanup: warning

===

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

===

diff --git a/source/blender/blenkernel/intern/object_update.c 
b/source/blender/blenkernel/intern/object_update.c
index e60ff05..2468cb8 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -348,7 +348,7 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx,
ob->recalc &= ~(OB_RECALC_DATA | OB_RECALC_TIME);
 }
 
-void BKE_object_eval_proxy_backlink(EvaluationContext *eval_ctx, Object *ob)
+void BKE_object_eval_proxy_backlink(EvaluationContext *UNUSED(eval_ctx), 
Object *ob)
 {
if (ob->proxy) {
ob->proxy->proxy_from = ob;

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


  1   2   3   4   5   >