[Bf-blender-cvs] [0552d58] master: Fix T49384: crash in tangent space calculation with NaN mesh vertices.

2016-09-18 Thread Brecht Van Lommel
Commit: 0552d5820b70d2bc60a703af23cdea6828317ab4
Author: Brecht Van Lommel
Date:   Sun Sep 18 13:06:15 2016 +0200
Branches: master
https://developer.blender.org/rB0552d5820b70d2bc60a703af23cdea6828317ab4

Fix T49384: crash in tangent space calculation with NaN mesh vertices.

===

M   intern/mikktspace/mikktspace.c

===

diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index 7e5861e..8d51816 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -579,11 +579,10 @@ static void MergeVertsFast(int piTriList_in_and_out[], 
STmpVert pTmpVert[], cons
 {
// make bbox
int c=0, l=0, channel=0;
-   float fvMin[3], fvMax[3];
+   float fvMin[3] = {INFINITY, INFINITY, INFINITY};
+   float fvMax[3] = {-INFINITY, -INFINITY, -INFINITY};
float dx=0, dy=0, dz=0, fSep=0;
-   for (c=0; c<3; c++)
-   {   fvMin[c]=pTmpVert[iL_in].vert[c]; fvMax[c]=fvMin[c];}
-   for (l=(iL_in+1); l<=iR_in; l++)
+   for (l=iL_in; l<=iR_in; l++)
for (c=0; c<3; c++)
if (fvMin[c]>pTmpVert[l].vert[c]) 
fvMin[c]=pTmpVert[l].vert[c];
else if (fvMax[c]=fvMax[channel] || fSep<=fvMin[channel])

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


[Bf-blender-cvs] [63b9085] master: GPencil: Fix memory leak using stroke arrange OP

2016-09-18 Thread Julian Eisel
Commit: 63b90851ce0f9e8dd863a0b2fad7e1ee2558c9a7
Author: Julian Eisel
Date:   Sun Sep 18 17:25:12 2016 +0200
Branches: master
https://developer.blender.org/rB63b90851ce0f9e8dd863a0b2fad7e1ee2558c9a7

GPencil: Fix memory leak using stroke arrange OP

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 9560ab1..01d388b 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -815,6 +815,8 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator 
*op)
BLI_assert(0);
break;
}
+   BLI_freelistN();
+
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);

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


[Bf-blender-cvs] [8f28441] master: Cycles: Adaptive isolation

2016-09-18 Thread Mai Lavelle
Commit: 8f28441487d5c8f960838cbd15068c0713d080ec
Author: Mai Lavelle
Date:   Fri Sep 16 18:07:24 2016 -0400
Branches: master
https://developer.blender.org/rB8f28441487d5c8f960838cbd15068c0713d080ec

Cycles: Adaptive isolation

Idea here is to select the lowest isolation level that wont compromise quality.
By using the lowest level we save memory and processing time. This will also
help avoid precision issues that have been showing up from using the highest
level (T49179, T49257).

This is a pretty simple heuristic that gives ok results. There's more we could
do here, such as filtering for vertices/edges adjacent geometric features that
need isolation instead of checking them all, but the logic there could get a
bit involved.

There's potential for slight popping of edges during animation if the dice
rate is low, but I don't think this should be a problem since low dice rates
really shouldn't be used in animation anyways.

Reviewed By: brecht, sergey

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

===

M   intern/cycles/render/mesh_subdivision.cpp

===

diff --git a/intern/cycles/render/mesh_subdivision.cpp 
b/intern/cycles/render/mesh_subdivision.cpp
index 3b4841f..0ae5ff7 100644
--- a/intern/cycles/render/mesh_subdivision.cpp
+++ b/intern/cycles/render/mesh_subdivision.cpp
@@ -16,12 +16,14 @@
 
 #include "mesh.h"
 #include "attribute.h"
+#include "camera.h"
 
 #include "subd_split.h"
 #include "subd_patch.h"
 #include "subd_patch_table.h"
 
 #include "util_foreach.h"
+#include "util_algorithm.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -177,7 +179,7 @@ public:

Far::TopologyRefinerFactory::Options(type, options));
 
/* adaptive refinement */
-   int max_isolation = 10;
+   int max_isolation = calculate_max_isolation();

refiner->RefineAdaptive(Far::TopologyRefiner::AdaptiveOptions(max_isolation));
 
/* create patch table */
@@ -248,6 +250,42 @@ public:
}
}
 
+   int calculate_max_isolation()
+   {
+   /* loop over all edges to find longest in screen space */
+   const Far::TopologyLevel& level = refiner->GetLevel(0);
+   Transform objecttoworld = mesh->subd_params->objecttoworld;
+   Camera* cam = mesh->subd_params->camera;
+
+   float longest_edge = 0.0f;
+
+   for(size_t i = 0; i < level.GetNumEdges(); i++) {
+   Far::ConstIndexArray verts = level.GetEdgeVertices(i);
+
+   float3 a = mesh->verts[verts[0]];
+   float3 b = mesh->verts[verts[1]];
+
+   float edge_len;
+
+   if(cam) {
+   a = transform_point(, a);
+   b = transform_point(, b);
+
+   edge_len = len(a - b) / 
cam->world_to_raster_size((a + b) * 0.5f);
+   }
+   else {
+   edge_len = len(a - b);
+   }
+
+   longest_edge = max(longest_edge, edge_len);
+   }
+
+   /* calculate isolation level */
+   int isolation = (int)(log2f(max(longest_edge / 
mesh->subd_params->dicing_rate, 1.0f)) + 1.0f);
+
+   return min(isolation, 10);
+   }
+
friend struct OsdPatch;
friend class Mesh;
 };

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


[Bf-blender-cvs] [7994548] master: Cycles: Soft minimum for dice rates

2016-09-18 Thread Mai Lavelle
Commit: 799454821e490d8024468ba623b2e10e67736a55
Author: Mai Lavelle
Date:   Sat Sep 17 20:45:00 2016 -0400
Branches: master
https://developer.blender.org/rB799454821e490d8024468ba623b2e10e67736a55

Cycles: Soft minimum for dice rates

Use 0.5 as a soft minimum for dice rates to help from setting them too
low. Lower values can still be set by typing in the value.

===

M   intern/cycles/blender/addon/properties.py

===

diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index 82a18b3..977d7f7 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -367,14 +367,14 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 cls.dicing_rate = FloatProperty(
 name="Dicing Rate",
 description="Size of a micropolygon in pixels",
-min=0.1, max=1000.0,
+min=0.1, max=1000.0, soft_min=0.5,
 default=1.0,
 subtype="PIXEL"
 )
 cls.preview_dicing_rate = FloatProperty(
 name="Preview Dicing Rate",
 description="Size of a micropolygon in pixels during preview 
render",
-min=0.1, max=1000.0,
+min=0.1, max=1000.0, soft_min=0.5,
 default=8.0,
 subtype="PIXEL"
 )
@@ -1011,7 +1011,7 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
 cls.dicing_rate = FloatProperty(
 name="Dicing Scale",
 description="Multiplier for scene dicing rate (located in the 
Geometry Panel)",
-min=0.1, max=1000.0,
+min=0.1, max=1000.0, soft_min=0.5,
 default=1.0,
 )

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


[Bf-blender-cvs] [940f360] master: Cycles: Fix update of subdivision meshes when global dice rates change

2016-09-18 Thread Mai Lavelle
Commit: 940f360479f2d160e63d91dd7c64d4a91471fa73
Author: Mai Lavelle
Date:   Sun Sep 18 12:04:12 2016 -0400
Branches: master
https://developer.blender.org/rB940f360479f2d160e63d91dd7c64d4a91471fa73

Cycles: Fix update of subdivision meshes when global dice rates change

When subdivision settings were moved from meshes to objects this was missed,
should work fine now.

===

M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_util.h

===

diff --git a/intern/cycles/blender/blender_mesh.cpp 
b/intern/cycles/blender/blender_mesh.cpp
index c33bc4c..7c382fa 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -959,25 +959,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
 
bool need_undeformed = mesh->need_attribute(scene, 
ATTR_STD_GENERATED);
 
-   mesh->subdivision_type = Mesh::SUBDIVISION_NONE;
-
-   PointerRNA cobj = RNA_pointer_get(_ob.ptr, "cycles");
-
-   if(cobj.data && b_ob.modifiers.length() > 0 && experimental) {
-   BL::Modifier mod = 
b_ob.modifiers[b_ob.modifiers.length()-1];
-   bool enabled = preview ? mod.show_viewport() : 
mod.show_render();
-
-   if(enabled && mod.type() == BL::Modifier::type_SUBSURF 
&& RNA_boolean_get(, "use_adaptive_subdivision")) {
-   BL::SubsurfModifier subsurf(mod);
-
-   if(subsurf.subdivision_type() == 
BL::SubsurfModifier::subdivision_type_CATMULL_CLARK) {
-   mesh->subdivision_type = 
Mesh::SUBDIVISION_CATMULL_CLARK;
-   }
-   else {
-   mesh->subdivision_type = 
Mesh::SUBDIVISION_LINEAR;
-   }
-   }
-   }
+   mesh->subdivision_type = object_subdivision_type(b_ob, preview, 
experimental);
 
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, 
!preview, need_undeformed, mesh->subdivision_type);
 
diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index e7e57b2..4ca202a 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -103,6 +103,27 @@ bool BlenderSync::sync_recalc()
if(b_lamp->is_updated() || (b_lamp->node_tree() && 
b_lamp->node_tree().is_updated()))
shader_map.set_recalc(*b_lamp);
 
+   bool dicing_prop_changed = false;
+
+   if(experimental) {
+   PointerRNA cscene = RNA_pointer_get(_scene.ptr, "cycles");
+
+   float updated_dicing_rate = preview ? RNA_float_get(, 
"preview_dicing_rate")
+   : RNA_float_get(, 
"dicing_rate");
+
+   if(dicing_rate != updated_dicing_rate) {
+   dicing_rate = updated_dicing_rate;
+   dicing_prop_changed = true;
+   }
+
+   int updated_max_subdivisions = RNA_int_get(, 
"max_subdivisions");
+
+   if(max_subdivisions != updated_max_subdivisions) {
+   max_subdivisions = updated_max_subdivisions;
+   dicing_prop_changed = true;
+   }
+   }
+
BL::BlendData::objects_iterator b_ob;
 
for(b_data.objects.begin(b_ob); b_ob != b_data.objects.end(); ++b_ob) {
@@ -112,7 +133,9 @@ bool BlenderSync::sync_recalc()
}
 
if(object_is_mesh(*b_ob)) {
-   if(b_ob->is_updated_data() || 
b_ob->data().is_updated()) {
+   if(b_ob->is_updated_data() || b_ob->data().is_updated() 
||
+  (dicing_prop_changed && 
object_subdivision_type(*b_ob, preview, experimental) != 
Mesh::SUBDIVISION_NONE))
+   {
BL::ID key = BKE_object_is_modified(*b_ob)? 
*b_ob: b_ob->data();
mesh_map.set_recalc(key);
}
@@ -129,42 +152,14 @@ bool BlenderSync::sync_recalc()
}
}
 
-   bool dicing_prop_changed = false;
-
-   if(experimental) {
-   PointerRNA cscene = RNA_pointer_get(_scene.ptr, "cycles");
-
-   float updated_dicing_rate = preview ? RNA_float_get(, 
"preview_dicing_rate")
-   : RNA_float_get(, 
"dicing_rate");
-
-   if(dicing_rate != updated_dicing_rate) {
-   dicing_rate = updated_dicing_rate;
-   dicing_prop_changed = true;
-   }
-
-   int updated_max_subdivisions = RNA_int_get(, 

[Bf-blender-cvs] [c0aabee] master: GPencil: Don't show error popup when strokes can't be reordered further

2016-09-18 Thread Julian Eisel
Commit: c0aabeede8775c790be489e7e28f34f87b7271f3
Author: Julian Eisel
Date:   Sun Sep 18 18:46:22 2016 +0200
Branches: master
https://developer.blender.org/rBc0aabeede8775c790be489e7e28f34f87b7271f3

GPencil: Don't show error popup when strokes can't be reordered further

Was spawning error popup each time user tried to move a stroke higher or lower 
than the list allowed. We don't do that anywhere else and it's not really 
useful info for the user. So rather not bother her.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 01d388b..ce1e397 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -761,14 +761,12 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator 
*op)
/* some stroke is already at front*/
if ((direction == GP_STROKE_MOVE_TOP) || (direction == 
GP_STROKE_MOVE_UP)) {
if (gps == gpf->strokes.last) {
-   BKE_report(op->reports, RPT_ERROR, 
"Some selected stroke is already on top");
return OPERATOR_CANCELLED;
}
}
/* some stroke is already at botom */
if ((direction == GP_STROKE_MOVE_BOTTOM) || (direction 
== GP_STROKE_MOVE_DOWN)) {
if (gps == gpf->strokes.first) {
-   BKE_report(op->reports, RPT_ERROR, 
"Some selected stroke is already on bottom");
return OPERATOR_CANCELLED;
}
}

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


[Bf-blender-cvs] [404a427] master: Minor corrections for previous commit

2016-09-18 Thread Julian Eisel
Commit: 404a427dfdee0f5300b7c4f375cd7ff4a0b8bc8e
Author: Julian Eisel
Date:   Sun Sep 18 21:54:24 2016 +0200
Branches: master
https://developer.blender.org/rB404a427dfdee0f5300b7c4f375cd7ff4a0b8bc8e

Minor corrections for previous commit

Was using wrong argument name in doxygen comment. Also reduced scope of vars.

Sorry for the noise :/

===

M   source/blender/blenlib/intern/listbase.c
M   source/blender/editors/armature/pose_group.c

===

diff --git a/source/blender/blenlib/intern/listbase.c 
b/source/blender/blenlib/intern/listbase.c
index e72eff5..d6c0219 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -343,12 +343,12 @@ void BLI_insertlinkbefore(ListBase *listbase, void 
*vnextlink, void *vnewlink)
 }
 
 /**
- * Reinsert \a link relative to its current position but offset by \a step. 
Doesn't move
+ * Reinsert \a vlink relative to its current position but offset by \a step. 
Doesn't move
  * item if new position would exceed list (could optionally move to head/tail).
  *
  * \param step: Absolute value defines step size, sign defines direction. E.g 
pass -1
- *  to move \a link before previous, or 1 to move behind next.
- * \return If position of \a link has changed.
+ *  to move \a vlink before previous, or 1 to move behind next.
+ * \return If position of \a vlink has changed.
  */
 bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step)
 {
diff --git a/source/blender/editors/armature/pose_group.c 
b/source/blender/editors/armature/pose_group.c
index 85cff2e..c492772 100644
--- a/source/blender/editors/armature/pose_group.c
+++ b/source/blender/editors/armature/pose_group.c
@@ -292,7 +292,6 @@ static int group_move_exec(bContext *C, wmOperator *op)
bPoseChannel *pchan;
bActionGroup *grp;
int dir = RNA_enum_get(op->ptr, "direction");
-   int grpIndexA, grpIndexB;
 
if (ELEM(NULL, ob, pose))
return OPERATOR_CANCELLED;
@@ -305,9 +304,10 @@ static int group_move_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
 
/* move bone group */
-   grpIndexA = pose->active_group;
if (BLI_listbase_link_move(>agroups, grp, dir)) {
-   grpIndexB = grpIndexA + dir;
+   int grpIndexA = pose->active_group;
+   int grpIndexB = grpIndexA + dir;
+
pose->active_group += dir;
/* fix changed bone group indices in bones (swap grpIndexA with 
grpIndexB) */
for (pchan = ob->pose->chanbase.first; pchan; pchan = 
pchan->next) {

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


[Bf-blender-cvs] [6c28d3b] master: Fix T49245: Adaptive Subdivision with Auto Smooth causes weird mesh appearance

2016-09-18 Thread Mai Lavelle
Commit: 6c28d3bac26b22049768824bef6ae9d0e82bb71f
Author: Mai Lavelle
Date:   Sun Sep 18 13:21:29 2016 -0400
Branches: master
https://developer.blender.org/rB6c28d3bac26b22049768824bef6ae9d0e82bb71f

Fix T49245: Adaptive Subdivision with Auto Smooth causes weird mesh appearance

===

M   intern/cycles/blender/blender_mesh.cpp

===

diff --git a/intern/cycles/blender/blender_mesh.cpp 
b/intern/cycles/blender/blender_mesh.cpp
index 7c382fa..ff1d49f 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -606,7 +606,7 @@ static void create_mesh(Scene *scene,
int numtris = 0;
int numcorners = 0;
int numngons = 0;
-   bool use_loop_normals = b_mesh.use_auto_smooth();
+   bool use_loop_normals = b_mesh.use_auto_smooth() && 
(mesh->subdivision_type != Mesh::SUBDIVISION_CATMULL_CLARK);
 
BL::Mesh::vertices_iterator v;
BL::Mesh::tessfaces_iterator f;

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


[Bf-blender-cvs] [572bc13] master: BLI_listbase: Add/use utility to move link (BLI_listbase_link_move)

2016-09-18 Thread Julian Eisel
Commit: 572bc1364ca9d978edf5aee991849dd4f8e56a52
Author: Julian Eisel
Date:   Sun Sep 18 21:36:34 2016 +0200
Branches: master
https://developer.blender.org/rB572bc1364ca9d978edf5aee991849dd4f8e56a52

BLI_listbase: Add/use utility to move link (BLI_listbase_link_move)

We were calling BLI_remlink and then BLI_insertlinkbefore/after quite often. 
BLI_listbase_link_move simplifies code a bit and makes it easier to follow. It 
also returns if link position has changed which can be used to avoid 
unnecessary updates.

Added it to a number of list reorder operators for now and made use of return 
value. Behavior shouldn't be changed.

Also some minor cleanup.

===

M   source/blender/blenkernel/BKE_freestyle.h
M   source/blender/blenkernel/BKE_linestyle.h
M   source/blender/blenkernel/intern/freestyle.c
M   source/blender/blenkernel/intern/linestyle.c
M   source/blender/blenlib/BLI_listbase.h
M   source/blender/blenlib/intern/listbase.c
M   source/blender/editors/armature/pose_group.c
M   source/blender/editors/armature/pose_lib.c
M   source/blender/editors/gpencil/gpencil_data.c
M   source/blender/editors/object/object_vgroup.c
M   source/blender/editors/render/render_shading.c
M   source/blender/freestyle/FRS_freestyle.h
M   source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
M   source/blender/makesrna/RNA_access.h

===

diff --git a/source/blender/blenkernel/BKE_freestyle.h 
b/source/blender/blenkernel/BKE_freestyle.h
index e105946..50407f3 100644
--- a/source/blender/blenkernel/BKE_freestyle.h
+++ b/source/blender/blenkernel/BKE_freestyle.h
@@ -55,8 +55,7 @@ void BKE_freestyle_config_copy(FreestyleConfig *new_config, 
FreestyleConfig *con
 /* FreestyleConfig.modules */
 FreestyleModuleConfig *BKE_freestyle_module_add(FreestyleConfig *config);
 bool BKE_freestyle_module_delete(FreestyleConfig *config, 
FreestyleModuleConfig *module_conf);
-bool BKE_freestyle_module_move_up(FreestyleConfig *config, 
FreestyleModuleConfig *module_conf);
-bool BKE_freestyle_module_move_down(FreestyleConfig *config, 
FreestyleModuleConfig *module_conf);
+bool BKE_freestyle_module_move(FreestyleConfig *config, FreestyleModuleConfig 
*module_conf, int direction);
 
 /* FreestyleConfig.linesets */
 FreestyleLineSet *BKE_freestyle_lineset_add(struct Main *bmain, 
FreestyleConfig *config, const char *name);
diff --git a/source/blender/blenkernel/BKE_linestyle.h 
b/source/blender/blenkernel/BKE_linestyle.h
index e96ef4e..af9bf58 100644
--- a/source/blender/blenkernel/BKE_linestyle.h
+++ b/source/blender/blenkernel/BKE_linestyle.h
@@ -73,10 +73,10 @@ int BKE_linestyle_alpha_modifier_remove(FreestyleLineStyle 
*linestyle, LineStyle
 int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier);
 int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier);
 
-void BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
-void BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
-void BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
-void BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
+bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
+bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
+bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
+bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, 
LineStyleModifier *modifier, int direction);
 
 void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, 
ListBase *listbase);
 char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, struct 
ColorBand *color_ramp);
diff --git a/source/blender/blenkernel/intern/freestyle.c 
b/source/blender/blenkernel/intern/freestyle.c
index 3a15be5..21fc167 100644
--- a/source/blender/blenkernel/intern/freestyle.c
+++ b/source/blender/blenkernel/intern/freestyle.c
@@ -151,22 +151,14 @@ bool BKE_freestyle_module_delete(FreestyleConfig *config, 
FreestyleModuleConfig
return true;
 }
 
-bool BKE_freestyle_module_move_up(FreestyleConfig *config, 
FreestyleModuleConfig *module_conf)
-{
-   if (BLI_findindex(>modules, module_conf) == -1)
-   return false;
-   BLI_remlink(>modules, module_conf);
-   BLI_insertlinkbefore(>modules, module_conf->prev, module_conf);
-   return true;
-}
-
-bool BKE_freestyle_module_move_down(FreestyleConfig *config, 
FreestyleModuleConfig 

[Bf-blender-cvs] [db18178] fluid-mantaflow: refactored manta script export and also added script export functionality for liquids

2016-09-18 Thread Sebastián Barschkis
Commit: db18178f97e1e81a29193bcb5d32bff0060047e3
Author: Sebastián Barschkis
Date:   Sun Sep 11 19:24:18 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBdb18178f97e1e81a29193bcb5d32bff0060047e3

refactored manta script export and also added script export functionality for 
liquids

===

M   intern/mantaflow/extern/manta_fluid_API.h
M   intern/mantaflow/intern/FLUID.cpp
M   intern/mantaflow/intern/FLUID.h
M   intern/mantaflow/intern/manta_fluid_API.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
M   source/blender/editors/physics/physics_fluid.c

===

diff --git a/intern/mantaflow/extern/manta_fluid_API.h 
b/intern/mantaflow/extern/manta_fluid_API.h
index 7cca7b5..668b4f2 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -111,6 +111,8 @@ void liquid_update_mesh_data(struct FLUID *liquid, char 
*filename);
 void liquid_save_mesh_high(struct FLUID *liquid, char *filename);
 void liquid_save_data_high(struct FLUID *liquid, char *pathname);
 void liquid_load_data_high(struct FLUID *liquid, char *pathname);
+void liquid_manta_export(struct FLUID* smoke, SmokeModifierData *smd);
+
 
 #ifdef __cplusplus
 }
diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index 216e09c..4738999 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -216,6 +216,7 @@ void FLUID::initSmoke(SmokeModifierData *smd)
+ smoke_variables_low
+ smoke_bounds_low
+ smoke_adaptive_step
+   + smoke_export_low
+ smoke_step_low;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
@@ -231,6 +232,7 @@ void FLUID::initSmokeHigh(SmokeModifierData *smd)
+ smoke_uv_setup
+ smoke_bounds_high
+ smoke_wavelet_turbulence_noise
+   + smoke_export_high
+ smoke_step_high;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
@@ -633,7 +635,7 @@ std::string FLUID::parseScript(const std::string& 
setup_string, SmokeModifierDat
return res.str();
 }
 
-void FLUID::exportScript(SmokeModifierData *smd)
+void FLUID::exportSmokeScript(SmokeModifierData *smd)
 {
// Setup low
std::string manta_script =
@@ -711,7 +713,8 @@ void FLUID::exportScript(SmokeModifierData *smd)
std::string final_script = FLUID::parseScript(manta_script, smd);

// Add standalone mode (loop, gui, ...)
-   final_script += smoke_standalone;
+   final_script += smoke_standalone_load;
+   final_script += fluid_standalone;

// Write script
std::ofstream myfile;
@@ -720,18 +723,71 @@ void FLUID::exportScript(SmokeModifierData *smd)
myfile.close();
 }
 
-void FLUID::exportGrids(SmokeModifierData *smd)
+void FLUID::exportSmokeData(SmokeModifierData *smd)
 {
-   PyGILState_STATE gilstate = PyGILState_Ensure();
+   bool highres = smd->domain->flags & MOD_SMOKE_HIGHRES;
+
+   char parent_dir[1024];
+   BLI_split_dir_part(smd->domain->manta_filepath, parent_dir, 
sizeof(parent_dir));

-   // Export low res grids
-   PyRun_SimpleString(FLUID::parseScript(smoke_export_low, smd).c_str());
+   FLUID::saveSmokeData(parent_dir);
+   if (highres)
+   FLUID::saveSmokeDataHigh(parent_dir);
+}
 
-   // Export high res grids
-   if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
-   PyRun_SimpleString(FLUID::parseScript(smoke_export_high, 
smd).c_str());
+void FLUID::exportLiquidScript(SmokeModifierData *smd)
+{
+   bool highres = smd->domain->flags & MOD_SMOKE_HIGHRES;
+
+   std::string manta_script;
+   
+   manta_script += manta_import
+   + fluid_solver_low
+   + fluid_adaptive_time_stepping_low
+   + liquid_alloc_low
+   + liquid_init_phi
+   + liquid_bounds_low
+   + liquid_variables_low;
+
+   if (highres) {
+   manta_script += fluid_solver_high
+   + fluid_adaptive_time_stepping_high
+   + liquid_alloc_high
+   + liquid_bounds_high
+   + liquid_variables_high;
}
-   PyGILState_Release(gilstate);
+
+   manta_script += liquid_import_low;
+   if (highres)
+   manta_script += liquid_import_high;
+
+   manta_script += liquid_step_low;
+   if (highres)
+   manta_script += liquid_step_high;
+   
+   manta_script += liquid_adaptive_step;
+   manta_script += liquid_standalone_load;
+   

[Bf-blender-cvs] [976e591] master: Cleanup: Completely replace/remove uiBut.lock

2016-09-18 Thread Julian Eisel
Commit: 976e591e93dd97de2c8f5be639a78c22e6505bae
Author: Julian Eisel
Date:   Mon Sep 19 01:49:17 2016 +0200
Branches: master
https://developer.blender.org/rB976e591e93dd97de2c8f5be639a78c22e6505bae

Cleanup: Completely replace/remove uiBut.lock

Old leftover from pre 2.5 days. Now handled through UI_BUT_DISABLED button flag.

===

M   source/blender/editors/interface/interface.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_layout.c
M   source/blender/editors/interface/interface_regions.c

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index cbe8654..6d4c8f0 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1247,7 +1247,6 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, 
const int xy[2])
 
if (ot == NULL || WM_operator_poll_context((bContext 
*)C, ot, but->opcontext) == 0) {
but->flag |= UI_BUT_DISABLED;
-   but->lock = true;
}
 
if (but->context)
@@ -3122,7 +3121,6 @@ static uiBut *ui_def_but(
but->a2 = a2;
but->tip = tip;
 
-   but->lock = block->lock;
but->lockstr = block->lockstr;
but->dt = block->dt;
but->pie_dir = UI_RADIAL_NONE;
@@ -3171,10 +3169,8 @@ static uiBut *ui_def_but(
 
but->drawflag |= (block->flag & UI_BUT_ALIGN);
 
-   if (but->lock == true) {
-   if (but->lockstr) {
-   but->flag |= UI_BUT_DISABLED;
-   }
+   if (block->lock == true) {
+   but->flag |= UI_BUT_DISABLED;
}
 
/* keep track of UI_interface.h */
@@ -3222,7 +3218,6 @@ void ui_def_but_icon(uiBut *but, const int icon, const 
int flag)
 static void ui_def_but_rna__disable(uiBut *but)
 {
but->flag |= UI_BUT_DISABLED;
-   but->lock = true;
but->lockstr = "";
 }
 
@@ -3548,7 +3543,6 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int 
type, wmOperatorType *
 
if (!ot) {
but->flag |= UI_BUT_DISABLED;
-   but->lock = true;
but->lockstr = "";
}
 
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 4972e16..5e9fc53 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2248,7 +2248,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, 
uiHandleButtonData *data,
bool buf_paste_alloc = false;
bool show_report = false;  /* use to display errors parsing paste input 
*/
 
-   if (mode == 'v' && but->lock  == true) {
+   if (mode == 'v' && (but->flag & UI_BUT_DISABLED)) {
return;
}
 
@@ -7100,8 +7100,7 @@ static int ui_do_button(bContext *C, uiBlock *block, 
uiBut *but, const wmEvent *
 
/* verify if we can edit this button */
if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
-   /* this should become disabled button .. */
-   if (but->lock == true) {
+   if (but->flag & UI_BUT_DISABLED) {
if (but->lockstr) {
WM_report(RPT_INFO, but->lockstr);
button_activate_state(C, but, 
BUTTON_STATE_EXIT);
diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index 8336efa..c274210 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -274,7 +274,6 @@ struct uiBut {
const char *lockstr;
 
BIFIconID icon;
-   bool lock;
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from 
the block */
signed char pie_dir; /* direction in a pie menu, used for collision 
detection (RadialDirection) */
char changed; /* could be made into a single flag */
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index e802cf8..672bd74 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -745,7 +745,6 @@ static void ui_item_disabled(uiLayout *layout, const char 
*name)
 
but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, 
NULL, 0.0, 0.0, 0, 0, "");
but->flag |= UI_BUT_DISABLED;
-   but->lock = true;
but->lockstr = "";
 }
 
diff --git a/source/blender/editors/interface/interface_regions.c 

[Bf-blender-cvs] [c2d7d47] master: Various cleanups related to button locking

2016-09-18 Thread Julian Eisel
Commit: c2d7d4764e86d8a133168ff8ea9aedbd78b5cd72
Author: Julian Eisel
Date:   Mon Sep 19 02:25:59 2016 +0200
Branches: master
https://developer.blender.org/rBc2d7d4764e86d8a133168ff8ea9aedbd78b5cd72

Various cleanups related to button locking

* Rename uiBut.lockstr to disabled_info
* Remove unreachable code
* Replace duplicated check with assert
* Replace overly ambitious check with assert
* Add comments

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_layout.c
M   source/blender/editors/interface/interface_regions.c

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index 26a6fdd..ad4066f 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -161,13 +161,13 @@ enum {
UI_BUT_NODE_LINK   = (1 << 8),
UI_BUT_NODE_ACTIVE = (1 << 9),
UI_BUT_DRAG_LOCK   = (1 << 10),
-   UI_BUT_DISABLED= (1 << 11),
+   UI_BUT_DISABLED= (1 << 11),  /* grayed out and uneditable */
UI_BUT_COLOR_LOCK  = (1 << 12),
UI_BUT_ANIMATED= (1 << 13),
UI_BUT_ANIMATED_KEY= (1 << 14),
UI_BUT_DRIVEN  = (1 << 15),
UI_BUT_REDALERT= (1 << 16),
-   UI_BUT_INACTIVE= (1 << 17),
+   UI_BUT_INACTIVE= (1 << 17),  /* grayed out but still editable */
UI_BUT_LAST_ACTIVE = (1 << 18),
UI_BUT_UNDO= (1 << 19),
UI_BUT_IMMEDIATE   = (1 << 20),
diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 6d4c8f0..aca1070 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3121,7 +3121,7 @@ static uiBut *ui_def_but(
but->a2 = a2;
but->tip = tip;
 
-   but->lockstr = block->lockstr;
+   but->disabled_info = block->lockstr;
but->dt = block->dt;
but->pie_dir = UI_RADIAL_NONE;
 
@@ -3218,7 +3218,7 @@ void ui_def_but_icon(uiBut *but, const int icon, const 
int flag)
 static void ui_def_but_rna__disable(uiBut *but)
 {
but->flag |= UI_BUT_DISABLED;
-   but->lockstr = "";
+   but->disabled_info = "";
 }
 
 static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void 
*but_p)
@@ -3543,7 +3543,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int 
type, wmOperatorType *
 
if (!ot) {
but->flag |= UI_BUT_DISABLED;
-   but->lockstr = "";
+   but->disabled_info = "";
}
 
return but;
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 5e9fc53..933beaf 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2248,9 +2248,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, 
uiHandleButtonData *data,
bool buf_paste_alloc = false;
bool show_report = false;  /* use to display errors parsing paste input 
*/
 
-   if (mode == 'v' && (but->flag & UI_BUT_DISABLED)) {
-   return;
-   }
+   BLI_assert((but->flag & UI_BUT_DISABLED) == 0); /* caller should check 
*/
 
if (mode == 'c') {
/* disallow copying from any passwords */
@@ -6974,6 +6972,9 @@ static int ui_do_button(bContext *C, uiBlock *block, 
uiBut *but, const wmEvent *
if (but->flag & UI_BUT_DISABLED)
return WM_UI_HANDLER_CONTINUE;
 
+   /* if but->pointype is set, but->poin should be too */
+   BLI_assert(!but->pointype || but->poin);
+
if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == 
EVT_DROP)) {
/* handle copy-paste */
if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS &&
@@ -7098,23 +7099,6 @@ static int ui_do_button(bContext *C, uiBlock *block, 
uiBut *but, const wmEvent *
}
}
 
-   /* verify if we can edit this button */
-   if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
-   if (but->flag & UI_BUT_DISABLED) {
-   if (but->lockstr) {
-   WM_report(RPT_INFO, but->lockstr);
-   button_activate_state(C, but, 
BUTTON_STATE_EXIT);
-   return WM_UI_HANDLER_BREAK;
-   }
-   }
-   else if (but->pointype && but->poin == NULL) {
-   /* there's a pointer needed */
-   

[Bf-blender-cvs] [772dab9] master: Cycles: Fix typo that would sometimes result in subsurf modifier being disabled

2016-09-18 Thread Mai Lavelle
Commit: 772dab9df1fb208bfe2486b7ca6760da051f42f6
Author: Mai Lavelle
Date:   Sun Sep 18 22:11:07 2016 -0400
Branches: master
https://developer.blender.org/rB772dab9df1fb208bfe2486b7ca6760da051f42f6

Cycles: Fix typo that would sometimes result in subsurf modifier being disabled

===

M   intern/cycles/blender/blender_util.h

===

diff --git a/intern/cycles/blender/blender_util.h 
b/intern/cycles/blender/blender_util.h
index e606696..f17a61f 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -57,11 +57,10 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
BL::Modifier subsurf_mod = 
object.modifiers[object.modifiers.length()-1];
 
subsurf_mod_show_render = subsurf_mod.show_render();
-   subsurf_mod_show_viewport = subsurf_mod.show_render();
+   subsurf_mod_show_viewport = subsurf_mod.show_viewport();
 
subsurf_mod.show_render(false);
subsurf_mod.show_viewport(false);
-
}
 
BL::Mesh me = data.meshes.new_from_object(scene, object, 
apply_modifiers, (render)? 2: 1, false, calc_undeformed);

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