Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py11
-rw-r--r--release/scripts/startup/bl_ui/space_image.py8
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py14
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c30
-rw-r--r--source/blender/blenlib/BLI_math_color.h3
-rw-r--r--source/blender/blenlib/intern/math_color.c22
-rw-r--r--source/blender/blenlib/intern/math_color_inline.c26
-rw-r--r--source/blender/editors/include/ED_mesh.h4
-rw-r--r--source/blender/editors/mesh/mesh_data.c90
-rw-r--r--source/blender/editors/object/object_bake.c19
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c284
-rw-r--r--source/blender/makesdna/DNA_image_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c16
-rw-r--r--source/blender/render/extern/include/RE_shader_ext.h4
-rw-r--r--source/blender/render/intern/source/imagetexture.c6
-rw-r--r--source/blender/render/intern/source/rendercore.c16
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c3
17 files changed, 344 insertions, 213 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index dcfa7e0a977..7af8d79a01e 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -824,12 +824,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
def REMESH(self, layout, ob, md):
layout.prop(md, "mode")
-
- layout.prop(md, "octree_depth")
- layout.prop(md, "scale")
+
row = layout.row()
- row.active = md.mode == "SHARP"
- row.prop(md, "sharpness")
+ row.prop(md, "octree_depth")
+ row.prop(md, "scale")
+
+ if md.mode == "SHARP":
+ layout.prop(md, "sharpness")
layout.prop(md, "remove_disconnected_pieces")
row = layout.row()
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 409494b5cbb..aabf86c6c18 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -671,11 +671,11 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel):
col.prop(brush, "color", text="")
row = col.row(align=True)
- self.prop_unified_size(row, context, brush, "size", slider=True)
+ self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True)
- self.prop_unified_strength(row, context, brush, "strength", slider=True)
+ self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
row = col.row(align=True)
@@ -820,11 +820,11 @@ class IMAGE_UV_sculpt(Panel, ImagePaintPanel):
col = layout.column()
row = col.row(align=True)
- self.prop_unified_size(row, context, brush, "size", slider=True)
+ self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True)
- self.prop_unified_strength(row, context, brush, "strength", slider=True)
+ self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
split = layout.split()
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index bbc04dad816..ff482e7cb74 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -526,16 +526,16 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
if brush.use_space and tool != 'SMOOTH':
if brush.use_space_atten:
- row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
+ row.prop(brush, "use_space_atten", toggle=True, icon='LOCKED')
else:
- row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
+ row.prop(brush, "use_space_atten", toggle=True, icon='UNLOCKED')
- self.prop_unified_strength(row, context, brush, "strength")
+ self.prop_unified_strength(row, context, brush, "strength", text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
if tool == 'ROTATE':
row = col.row(align=True)
- self.prop_unified_strength(row, context, brush, "strength")
+ self.prop_unified_strength(row, context, brush, "strength", text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
if tool != 'SMOOTH':
@@ -627,7 +627,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
self.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True)
- self.prop_unified_strength(row, context, brush, "strength")
+ self.prop_unified_strength(row, context, brush, "strength", text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
row = col.row(align=True)
@@ -653,7 +653,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
self.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True)
- self.prop_unified_strength(row, context, brush, "strength")
+ self.prop_unified_strength(row, context, brush, "strength", text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
row = col.row(align=True)
@@ -671,7 +671,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
self.prop_unified_size(row, context, brush, "use_pressure_size")
row = col.row(align=True)
- self.prop_unified_strength(row, context, brush, "strength")
+ self.prop_unified_strength(row, context, brush, "strength", text="Strength")
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
# XXX - TODO
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index c057d96a5c4..52a505998e1 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -97,9 +97,16 @@ static void arena_release(CCGAllocatorHDL a) {
BLI_memarena_free(a);
}
-static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAging, int useArena, int UNUSED(useFlatSubdiv)) {
+typedef enum {
+ CCG_USE_AGING = 1,
+ CCG_USE_ARENA = 2,
+} CCGFlags;
+
+static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags flags) {
CCGMeshIFC ifc;
CCGSubSurf *ccgSS;
+ int useAging = !!(flags & CCG_USE_AGING);
+ int useArena = flags & CCG_USE_ARENA;
/* subdivLevels==0 is not allowed */
subdivLevels = MAX2(subdivLevels, 1);
@@ -107,7 +114,6 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin
if (prevSS) {
int oldUseAging;
- useAging = !!useAging;
ccgSubSurf_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL);
if (oldUseAging!=useAging) {
@@ -342,7 +348,7 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
return;
/* create a CCGSubSurf from uv's */
- uvss = _getSubSurf(NULL, ccgSubSurf_getSubdivisionLevels(ss), 0, 1, 0);
+ uvss = _getSubSurf(NULL, ccgSubSurf_getSubdivisionLevels(ss), CCG_USE_ARENA);
if(!ss_sync_from_uv(uvss, ss, dm, dmloopuv)) {
ccgSubSurf_free(uvss);
@@ -3245,7 +3251,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
int isFinalCalc, int forEditMode, int inEditMode)
{
int useSimple = smd->subdivType == ME_SIMPLE_SUBSURF;
- int useAging = smd->flags & eSubsurfModifierFlag_DebugIncr;
+ CCGFlags useAging = smd->flags & eSubsurfModifierFlag_DebugIncr ? CCG_USE_AGING : 0;
int useSubsurfUv = smd->flags & eSubsurfModifierFlag_SubsurfUv;
int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
CCGDerivedMesh *result = NULL;
@@ -3253,8 +3259,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if(forEditMode) {
int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels): smd->levels;
- smd->emCache = _getSubSurf(smd->emCache, levels, useAging, 0,
- useSimple);
+ smd->emCache = _getSubSurf(smd->emCache, levels, useAging);
ss_sync_from_derivedmesh(smd->emCache, dm, vertCos, useSimple);
result = getCCGDerivedMesh(smd->emCache,
@@ -3268,7 +3273,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if(levels == 0)
return dm;
- ss = _getSubSurf(NULL, levels, 0, 1, useSimple);
+ ss = _getSubSurf(NULL, levels, CCG_USE_ARENA);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
@@ -3278,7 +3283,6 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
result->freeSS = 1;
} else {
int useIncremental = 1; //(smd->flags & eSubsurfModifierFlag_Incremental);
- int useAging = smd->flags & eSubsurfModifierFlag_DebugIncr;
int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels): smd->levels;
CCGSubSurf *ss;
@@ -3299,13 +3303,11 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
}
if(useIncremental && isFinalCalc) {
- smd->mCache = ss = _getSubSurf(smd->mCache, levels,
- useAging, 0, useSimple);
+ smd->mCache = ss = _getSubSurf(smd->mCache, levels, useAging);
if (!ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple)) {
//ccgSubSurf_free(smd->mCache);
- smd->mCache = ss = _getSubSurf(NULL, levels,
- useAging, 0, useSimple);
+ smd->mCache = ss = _getSubSurf(NULL, levels, useAging);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
@@ -3320,7 +3322,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
smd->mCache = NULL;
}
- ss = _getSubSurf(NULL, levels, 0, 1, useSimple);
+ ss = _getSubSurf(NULL, levels, CCG_USE_ARENA);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
result = getCCGDerivedMesh(ss, drawInteriorEdges, useSubsurfUv, dm);
@@ -3342,7 +3344,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
* calculated vert positions is incorrect for the verts
* on the boundary of the mesh.
*/
- CCGSubSurf *ss = _getSubSurf(NULL, 1, 0, 1, 0);
+ CCGSubSurf *ss = _getSubSurf(NULL, 1, CCG_USE_ARENA);
float edge_sum[3], face_sum[3];
CCGVertIterator *vi;
DerivedMesh *dm = CDDM_from_mesh(me, NULL);
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 453f1258272..f4d6882b5d8 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -91,6 +91,9 @@ MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4]);
MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4]);
MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]);
+MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3]);
+MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4]);
+
void BLI_init_srgb_conversion(void);
/************************** Other *************************/
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 94dbdf9fe58..ca2aeca8f36 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -354,30 +354,12 @@ void rgba_uchar_to_float(float col_r[4], const unsigned char col_ub[4])
void rgb_float_to_uchar(unsigned char col_r[3], const float col_f[3])
{
- int r, g, b;
-
- r= (int)(col_f[0] * 255.0f);
- g= (int)(col_f[1] * 255.0f);
- b= (int)(col_f[2] * 255.0f);
-
- col_r[0]= (char)((r <= 0)? 0 : (r >= 255)? 255 : r);
- col_r[1]= (char)((g <= 0)? 0 : (g >= 255)? 255 : g);
- col_r[2]= (char)((b <= 0)? 0 : (b >= 255)? 255 : b);
+ F3TOCHAR3(col_f, col_r);
}
void rgba_float_to_uchar(unsigned char col_r[4], const float col_f[4])
{
- int r, g, b, a;
-
- r= (int)(col_f[0] * 255.0f);
- g= (int)(col_f[1] * 255.0f);
- b= (int)(col_f[2] * 255.0f);
- a= (int)(col_f[3] * 255.0f);
-
- col_r[0]= (char)((r <= 0)? 0 : (r >= 255)? 255 : r);
- col_r[1]= (char)((g <= 0)? 0 : (g >= 255)? 255 : g);
- col_r[2]= (char)((b <= 0)? 0 : (b >= 255)? 255 : b);
- col_r[3]= (char)((a <= 0)? 0 : (a >= 255)? 255 : a);
+ F4TOCHAR4(col_f, col_r);
}
/* ********************************* color transforms ********************************* */
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index 2c7b13b86a2..386452ed592 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -62,32 +62,20 @@ MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4])
srgb[3] = linear[3];
}
-MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[4], const float linear[4])
+MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3])
{
- int r, g, b;
+ float srgb_f[3];
- r = 255 * linearrgb_to_srgb(linear[0]);
- g = 255 * linearrgb_to_srgb(linear[1]);
- b = 255 * linearrgb_to_srgb(linear[2]);
-
- srgb[0] = FTOCHAR(r);
- srgb[1] = FTOCHAR(g);
- srgb[2] = FTOCHAR(b);
+ linearrgb_to_srgb_v3_v3(srgb_f, linear);
+ F3TOCHAR3(srgb_f, srgb);
}
MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
{
- int r, g, b, a;
-
- r = 255 * linearrgb_to_srgb(linear[0]);
- g = 255 * linearrgb_to_srgb(linear[1]);
- b = 255 * linearrgb_to_srgb(linear[2]);
- a = 255 * linear[3];
+ float srgb_f[4];
- srgb[0] = FTOCHAR(r);
- srgb[1] = FTOCHAR(g);
- srgb[2] = FTOCHAR(b);
- srgb[3] = FTOCHAR(a);
+ linearrgb_to_srgb_v4(srgb_f, linear);
+ F4TOCHAR4(srgb_f, srgb);
}
/* predivide versions to work on associated/premultipled alpha. if this should
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 4abba91b716..a6cc38de084 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -292,6 +292,10 @@ void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count)
void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count);
void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_faces_remove(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count);
+
void ED_mesh_transform(struct Mesh *me, float *mat);
void ED_mesh_calc_normals(struct Mesh *me);
void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index b0512414a7f..194759bddfe 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -818,15 +818,15 @@ static void mesh_add_verts(Mesh *mesh, int len)
mesh->totvert= totvert;
}
-void ED_mesh_transform(Mesh *mesh, float *mat)
+void ED_mesh_transform(Mesh *me, float *mat)
{
int i;
- MVert *mvert= mesh->mvert;
+ MVert *mvert= me->mvert;
- for(i= 0; i < mesh->totvert; i++, mvert++)
+ for(i= 0; i < me->totvert; i++, mvert++)
mul_m4_v3((float (*)[4])mat, mvert->co);
- mesh_calc_normals_mapping(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
+ mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
}
static void mesh_add_edges(Mesh *mesh, int len)
@@ -943,6 +943,46 @@ static void mesh_add_polys(Mesh *mesh, int len)
mesh->totpoly= totpoly;
}
+static void mesh_remove_verts(Mesh *mesh, int len)
+{
+ int totvert;
+
+ if(len == 0)
+ return;
+
+ totvert= mesh->totvert - len;
+ CustomData_free_elem(&mesh->vdata, totvert, len);
+
+ /* set final vertex list size */
+ mesh->totvert= totvert;
+}
+
+static void mesh_remove_edges(Mesh *mesh, int len)
+{
+ int totedge;
+
+ if(len == 0)
+ return;
+
+ totedge= mesh->totedge - len;
+ CustomData_free_elem(&mesh->edata, totedge, len);
+
+ mesh->totedge= totedge;
+}
+
+static void mesh_remove_faces(Mesh *mesh, int len)
+{
+ int totface;
+
+ if(len == 0)
+ return;
+
+ totface= mesh->totface - len; /* new face count */
+ CustomData_free_elem(&mesh->fdata, totface, len);
+
+ mesh->totface= totface;
+}
+
/*
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
{
@@ -990,6 +1030,48 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
mesh_add_verts(mesh, count);
}
+void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't remove faces in edit mode");
+ return;
+ }
+ else if(count > mesh->totface) {
+ BKE_report(reports, RPT_ERROR, "Can't remove more faces than the mesh contains");
+ return;
+ }
+
+ mesh_remove_faces(mesh, count);
+}
+
+void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't remove edges in edit mode");
+ return;
+ }
+ else if(count > mesh->totedge) {
+ BKE_report(reports, RPT_ERROR, "Can't remove more edges than the mesh contains");
+ return;
+ }
+
+ mesh_remove_edges(mesh, count);
+}
+
+void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't remove vertices in edit mode");
+ return;
+ }
+ else if(count > mesh->totvert) {
+ BKE_report(reports, RPT_ERROR, "Can't remove more vertices than the mesh contains");
+ return;
+ }
+
+ mesh_remove_verts(mesh, count);
+}
+
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
{
if(mesh->edit_btmesh) {
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index e7ab823fc99..75fa52bf7ac 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -1257,7 +1257,7 @@ typedef struct BakeRender {
Main *main;
Scene *scene;
struct Object *actob;
- int tot, ready;
+ int result, ready;
ReportList *reports;
@@ -1330,7 +1330,7 @@ static void finish_bake_internal(BakeRender *bkr)
if(bkr->prev_r_raytrace == 0)
bkr->scene->r.mode &= ~R_RAYTRACE;
- if(bkr->tot) {
+ if(bkr->result==BAKE_RESULT_OK) {
Image *ima;
/* force OpenGL reload and mipmap recalc */
for(ima= G.main->image.first; ima; ima= ima->id.next) {
@@ -1357,7 +1357,7 @@ static void *do_bake_render(void *bake_v)
{
BakeRender *bkr= bake_v;
- bkr->tot= RE_bake_shade_all_selected(bkr->re, bkr->scene->r.bake_mode, bkr->actob, NULL, bkr->progress);
+ bkr->result= RE_bake_shade_all_selected(bkr->re, bkr->scene->r.bake_mode, bkr->actob, NULL, bkr->progress);
bkr->ready= 1;
return NULL;
@@ -1379,7 +1379,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update, float *progr
RE_Database_Baking(bkr->re, bmain, scene, scene->lay, scene->r.bake_mode, bkr->actob);
/* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */
- bkr->tot= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress);
+ bkr->result= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress);
}
static void bake_update(void *bkv)
@@ -1398,7 +1398,11 @@ static void bake_freejob(void *bkv)
BakeRender *bkr= bkv;
finish_bake_internal(bkr);
- if(bkr->tot==0) BKE_report(bkr->reports, RPT_ERROR, "No objects or images found to bake to");
+ if(bkr->result==BAKE_RESULT_NO_OBJECTS)
+ BKE_report(bkr->reports, RPT_ERROR, "No objects or images found to bake to");
+ else if(bkr->result==BAKE_RESULT_FEEDBACK_LOOP)
+ BKE_report(bkr->reports, RPT_WARNING, "Feedback loop detected");
+
MEM_freeN(bkr);
G.rendering = 0;
}
@@ -1515,7 +1519,10 @@ static int bake_image_exec(bContext *C, wmOperator *op)
}
BLI_end_threads(&threads);
- if(bkr.tot==0) BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to");
+ if(bkr.result==BAKE_RESULT_NO_OBJECTS)
+ BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to");
+ else if(bkr.result==BAKE_RESULT_FEEDBACK_LOOP)
+ BKE_report(op->reports, RPT_ERROR, "Feedback loop detected");
finish_bake_internal(&bkr);
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index cc139544ce3..023d55d053d 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -84,10 +84,12 @@ typedef struct IslandStitchData{
float medianPoint[2];
int numOfElements;
int num_rot_elements;
- /* Flag to remember if island has been added for preview */
+ /* flag to remember if island has been added for preview */
char addedForPreview;
- /* Flag an island to be considered for determining static island */
+ /* flag an island to be considered for determining static island */
char stitchableCandidate;
+ /* if edge rotation is used, flag so that vertex rotation is not used */
+ char use_edge_rotation;
}IslandStitchData;
/* just for averaging UVs */
@@ -266,6 +268,38 @@ static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2]){
uv[1] = uv_rotation_result[1] + medianPoint[1];
}
+static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state){
+ float limit;
+ int do_limit;
+
+ if(element_iter == element){
+ return 0;
+ }
+
+ limit = state->limit_dist;
+ do_limit = state->use_limit;
+
+ if(do_limit){
+ MTFace *mtface_orig = CustomData_em_get(&state->em->fdata, element->face->data, CD_MTFACE);
+ MTFace *mtface_iter = CustomData_em_get(&state->em->fdata, element_iter->face->data, CD_MTFACE);
+
+ if(fabs(mtface_orig->uv[element->tfindex][0] - mtface_iter->uv[element_iter->tfindex][0]) < limit
+ && fabs(mtface_orig->uv[element->tfindex][1] - mtface_iter->uv[element_iter->tfindex][1]) < limit){
+ return 1;
+ }else
+ return 0;
+ }else
+ return 1;
+}
+
+
+static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state){
+ if(state->snap_islands && element->island == element_iter->island)
+ return 0;
+
+ return stitch_check_uvs_stitchable(element, element_iter, state);
+}
+
/* calculate snapping for islands */
static void stitch_calculate_island_snapping(StitchState *state, StitchPreviewer *preview, IslandStitchData *island_stitch_data, int final){
@@ -328,26 +362,31 @@ static void stitch_calculate_island_snapping(StitchState *state, StitchPreviewer
static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *state, UVVertAverage *uv_average, unsigned int *uvfinal_map, IslandStitchData *island_stitch_data)
{
- UvElement *element;
- EditFace *efa;
- MTFace *mt;
- int nverts;
+ UvElement *element1, *element2;
+ EditFace *efa1;
+ EditFace *efa2;
+ MTFace *mt1;
+ MTFace *mt2;
float uv1[2], uv2[2];
float edgecos, edgesin;
int index1, index2;
+ float rotation;
+
+ element1 = state->uvs[edge->uv1];
+ element2 = state->uvs[edge->uv2];
- element = edge->element;
- efa = element->face;
- nverts = (efa->v4)? 4 : 3;
- mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+ efa1 = element1->face;
+ mt1 = CustomData_em_get(&state->em->fdata, efa1->data, CD_MTFACE);
+ efa2 = element2->face;
+ mt2 = CustomData_em_get(&state->em->fdata, efa2->data, CD_MTFACE);
- index1 = uvfinal_map[(*(&element->face->v1 + element->tfindex))->tmp.l];
- index2 = uvfinal_map[(*(&element->face->v1 + (element->tfindex + 1)%nverts))->tmp.l];
+ index1 = uvfinal_map[element1 - state->element_map->buf];
+ index2 = uvfinal_map[element2 - state->element_map->buf];
/* the idea here is to take the directions of the edges and find the rotation between final and initial
* direction. This, using inner and outer vector products, gives the angle. Directions are differences so... */
- uv1[0] = mt->uv[(element->tfindex + 1)%nverts][0] - mt->uv[element->tfindex][0];
- uv1[1] = mt->uv[(element->tfindex + 1)%nverts][1] - mt->uv[element->tfindex][1];
+ uv1[0] = mt2->uv[element2->tfindex][0] - mt1->uv[element1->tfindex][0];
+ uv1[1] = mt2->uv[element2->tfindex][1] - mt1->uv[element1->tfindex][1];
uv2[0] = uv_average[index2].uv[0] - uv_average[index1].uv[0];
uv2[1] = uv_average[index2].uv[1] - uv_average[index1].uv[1];
@@ -357,47 +396,50 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
edgecos = uv1[0]*uv2[0] + uv1[1]*uv2[1];
edgesin = uv1[0]*uv2[1] - uv2[0]*uv1[1];
- island_stitch_data[element->island].num_rot_elements++;
- island_stitch_data[element->island].rotation += (edgesin > 0)? acos(MAX2(-1.0, MIN2(1.0, edgecos))): -acos(MAX2(-1.0, MIN2(1.0, edgecos)));
+
+ rotation = (edgesin > 0)? acos(MAX2(-1.0, MIN2(1.0, edgecos))): -acos(MAX2(-1.0, MIN2(1.0, edgecos)));
+
+ island_stitch_data[element1->island].num_rot_elements++;
+ island_stitch_data[element1->island].rotation += rotation;
}
-static void stitch_island_calculate_vert_rotation(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data, char do_static)
+
+static void stitch_island_calculate_vert_rotation(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data)
{
float edgecos = 1, edgesin = 0;
int index;
UvElement *element_iter;
+ float rotation = 0;
- if((element->island == state->static_island) && !do_static)
+ if(element->island == state->static_island && !state->midpoints)
return;
index = (*(&element->face->v1 + element->tfindex))->tmp.l;
element_iter = state->element_map->vert[index];
- if(!do_static){
- for(; element_iter; element_iter = element_iter->next){
- if((element_iter->separate) && (element_iter->flag & STITCH_STITCHABLE) &&
- (element_iter != element) && (element_iter->island == state->static_island)
- ){
- int index_tmp1, index_tmp2;
- float normal[2];
- /* easily possible*/
-
- index_tmp1 = element_iter - state->element_map->buf;
- index_tmp1 = state->map[index_tmp1];
- index_tmp2 = element - state->element_map->buf;
- index_tmp2 = state->map[index_tmp2];
-
- negate_v2_v2(normal, state->normals + index_tmp2*2);
- edgecos = dot_v2v2(normal, state->normals + index_tmp1*2);
- edgesin = cross_v2v2(normal, state->normals + index_tmp1*2);
- break;
- }
+ for(; element_iter; element_iter = element_iter->next){
+ if(element_iter->separate && stitch_check_uvs_state_stitchable(element, element_iter, state)){
+ int index_tmp1, index_tmp2;
+ float normal[2];
+ /* easily possible*/
+
+ index_tmp1 = element_iter - state->element_map->buf;
+ index_tmp1 = state->map[index_tmp1];
+ index_tmp2 = element - state->element_map->buf;
+ index_tmp2 = state->map[index_tmp2];
+
+ negate_v2_v2(normal, state->normals + index_tmp2*2);
+ edgecos = dot_v2v2(normal, state->normals + index_tmp1*2);
+ edgesin = cross_v2v2(normal, state->normals + index_tmp1*2);
+ rotation += (edgesin > 0)? acos(edgecos): -acos(edgecos);
}
}
+ if(state->midpoints)
+ rotation /= 2.0;
island_stitch_data[element->island].num_rot_elements++;
- island_stitch_data[element->island].rotation += (edgesin > 0)? acos(edgecos): -acos(edgecos);
+ island_stitch_data[element->island].rotation += rotation;
}
@@ -438,8 +480,6 @@ static void stitch_state_delete(StitchState *stitch_state)
static void determine_uv_stitchability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data){
int vert_index;
UvElement *element_iter;
- float limit= state->limit_dist;
- int do_limit = state->use_limit;
vert_index = (*(&element->face->v1 + element->tfindex))->tmp.l;
element_iter = state->element_map->vert[vert_index];
@@ -449,18 +489,7 @@ static void determine_uv_stitchability(UvElement *element, StitchState *state, I
if(element_iter == element){
continue;
}
- if(do_limit){
- MTFace *mtface_orig = CustomData_em_get(&state->em->fdata, element->face->data, CD_MTFACE);
- MTFace *mtface_iter = CustomData_em_get(&state->em->fdata, element_iter->face->data, CD_MTFACE);
-
- if(fabs(mtface_orig->uv[element->tfindex][0] - mtface_iter->uv[element_iter->tfindex][0]) < limit
- && fabs(mtface_orig->uv[element->tfindex][1] - mtface_iter->uv[element_iter->tfindex][1]) < limit){
- island_stitch_data[element_iter->island].stitchableCandidate = 1;
- island_stitch_data[element->island].stitchableCandidate = 1;
- element->flag |= STITCH_STITCHABLE_CANDIDATE;
- }
- }else{
- /* if no limit exists, then the mere existence of a separate uv means that the uv is stitchable */
+ if(stitch_check_uvs_stitchable(element, element_iter, state)){
island_stitch_data[element_iter->island].stitchableCandidate = 1;
island_stitch_data[element->island].stitchableCandidate = 1;
element->flag |= STITCH_STITCHABLE_CANDIDATE;
@@ -470,7 +499,6 @@ static void determine_uv_stitchability(UvElement *element, StitchState *state, I
}
-
/* set preview buffer position of UV face in editface->tmp.l */
static void stitch_set_face_preview_buffer_position(EditFace *efa, StitchPreviewer *preview)
{
@@ -493,8 +521,8 @@ static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchSta
StitchPreviewer *preview = uv_get_stitch_previewer();
/* static island does not change so returning immediately */
- //if(state->snap_islands && !state->midpoints && state->static_island == element->island)
- // return;
+ if(state->snap_islands && !state->midpoints && state->static_island == element->island)
+ return;
if(state->snap_islands){
island_stitch_data[element->island].addedForPreview = 1;
@@ -519,21 +547,7 @@ static void stitch_validate_stichability(UvElement *element, StitchState *state,
if(element_iter->separate){
if(element_iter == element)
continue;
- if(state->use_limit){
- MTFace *mtface_orig = CustomData_em_get(&state->em->fdata, element->face->data, CD_MTFACE);
- MTFace *mtface_iter = CustomData_em_get(&state->em->fdata, element_iter->face->data, CD_MTFACE);
-
- if(fabs(mtface_orig->uv[element->tfindex][0] - mtface_iter->uv[element_iter->tfindex][0]) < state->limit_dist
- && fabs(mtface_orig->uv[element->tfindex][1] - mtface_iter->uv[element_iter->tfindex][1]) < state->limit_dist){
- if(((element_iter->island == state->static_island) || (element->island == state->static_island)) &&
- !((element_iter->island == element->island) && state->snap_islands)){
- element->flag |= STITCH_STITCHABLE;
- preview->num_stitchable++;
- stitch_setup_face_preview_for_uv_group(element, state, island_stitch_data);
- return;
- }
- }
- }else{
+ if(stitch_check_uvs_stitchable(element, element_iter, state)){
if(((element_iter->island == state->static_island) || (element->island == state->static_island)) &&
!((element_iter->island == element->island) && state->snap_islands)){
element->flag |= STITCH_STITCHABLE;
@@ -562,8 +576,6 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
EditVert *ev;
UVVertAverage *final_position;
char stitch_midpoints = state->midpoints;
- /* use vertex normals for snapping rotation */
- char use_vert_normals = 1;
/* used to map uv indices to uvaverage indices for selection */
unsigned int *uvfinal_map;
@@ -582,7 +594,7 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
return 0;
}
- /* store Indices to editVerts. */
+ /* store indices to editVerts. */
for(ev = state->em->verts.first, i = 0; ev; ev = ev->next, i++){
ev->tmp.l = i;
}
@@ -712,26 +724,46 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
******************************************************/
final_position = MEM_callocN(state->selection_size*sizeof(*final_position), "stitch_uv_average");
- uvfinal_map = MEM_mallocN(state->em->totvert*sizeof(*uvfinal_map), "stitch_uv_final_map");
+ uvfinal_map = MEM_mallocN(state->element_map->totalUVs*sizeof(*uvfinal_map), "stitch_uv_final_map");
/* first pass, calculate final position for stitchable uvs of the static island */
for(i = 0; i < state->selection_size; i++){
UvElement *element = state->selection_stack[i];
if(element->flag & STITCH_STITCHABLE){
- UvElement *element_iter = state->element_map->vert[(*(&element->face->v1 + element->tfindex))->tmp.l];
- uvfinal_map[(*(&element->face->v1 + element->tfindex))->tmp.l] = i;
+ MTFace *mt;
+
+ UvElement *element_iter;
+
+ uvfinal_map[element - state->element_map->buf] = i;
+
+ efa = element->face;
+ mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+
+ final_position[i].uv[0] = mt->uv[element->tfindex][0];
+ final_position[i].uv[1] = mt->uv[element->tfindex][1];
+ final_position[i].count = 1;
+
+ if(state->snap_islands && element->island == state->static_island && !stitch_midpoints)
+ continue;
+
+ element_iter = state->element_map->vert[(*(&element->face->v1 + element->tfindex))->tmp.l];
+
for(;element_iter; element_iter = element_iter->next){
- if(element_iter->flag & STITCH_STITCHABLE){
- MTFace *mt;
- efa = element_iter->face;
- mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
- if(stitch_midpoints){
- final_position[i].uv[0] += mt->uv[element_iter->tfindex][0];
- final_position[i].uv[1] += mt->uv[element_iter->tfindex][1];
- final_position[i].count++;
- }else if(element_iter->island == state->static_island){
- final_position[i].uv[0] = mt->uv[element_iter->tfindex][0];
- final_position[i].uv[1] = mt->uv[element_iter->tfindex][1];
+ if(element_iter->separate){
+ if(stitch_check_uvs_state_stitchable(element, element_iter, state)){
+ efa = element_iter->face;
+ mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+ if(stitch_midpoints){
+ final_position[i].uv[0] += mt->uv[element_iter->tfindex][0];
+ final_position[i].uv[1] += mt->uv[element_iter->tfindex][1];
+ final_position[i].count++;
+ }else if(element_iter->island == state->static_island){
+ /* if multiple uvs on the static island exist,
+ * last checked remains. to disambiguate we need to limit or use
+ * edge stitch */
+ final_position[i].uv[0] = mt->uv[element_iter->tfindex][0];
+ final_position[i].uv[1] = mt->uv[element_iter->tfindex][1];
+ }
}
}
}
@@ -766,65 +798,57 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
UvEdge *edge = state->edges+i;
if((state->uvs[edge->uv1]->flag & STITCH_STITCHABLE) && (state->uvs[edge->uv2]->flag & STITCH_STITCHABLE)){
stitch_island_calculate_edge_rotation(edge, state, final_position, uvfinal_map, island_stitch_data);
- use_vert_normals = 0;
+ island_stitch_data[state->uvs[edge->uv1]->island].use_edge_rotation = 1;
}
}
- if(use_vert_normals){
- for(i = 0; i < state->selection_size; i++){
- UvElement *element = state->selection_stack[i];
+
+ for(i = 0; i < state->selection_size; i++){
+ UvElement *element = state->selection_stack[i];
+ if(!island_stitch_data[element->island].use_edge_rotation){
if(element->flag & STITCH_STITCHABLE){
- stitch_island_calculate_vert_rotation(element, state, island_stitch_data, 0);
+ stitch_island_calculate_vert_rotation(element, state, island_stitch_data);
}
}
}
+
}
- /* third pass, propagate changes to stitchable uvs */
+ /* third pass, propagate changes to coincident uvs */
for(i = 0; i < state->selection_size; i++){
UvElement *element = state->selection_stack[i];
if(element->flag & STITCH_STITCHABLE){
- UvElement *element_iter = state->element_map->vert[(*(&element->face->v1 + element->tfindex))->tmp.l];
- for(;element_iter;){
- /* determine if uv stitchable */
- if(element_iter->separate && element_iter->flag & STITCH_STITCHABLE){
- MTFace *mt;
- efa = element_iter->face;
- mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
-
- /* propagate to coincident uvs */
- do{
- efa = element_iter->face;
- mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
-
- element_iter->flag |= STITCH_PROCESSED;
- /* either flush to preview or to the MTFace, if final */
- if(final){
- mt->uv[element_iter->tfindex][0] = final_position[i].uv[0];
- mt->uv[element_iter->tfindex][1] = final_position[i].uv[1];
-
- uvedit_uv_select(scene, efa, mt, element_iter->tfindex);
- }else if(efa->tmp.l != STITCH_NO_PREVIEW){
- if(efa->v4){
- *(preview->preview_quads+efa->tmp.l + element_iter->tfindex*2) = final_position[i].uv[0];
- *(preview->preview_quads+efa->tmp.l + element_iter->tfindex*2 + 1) = final_position[i].uv[1];
- }else{
- *(preview->preview_tris+efa->tmp.l + element_iter->tfindex*2) = final_position[i].uv[0];
- *(preview->preview_tris+efa->tmp.l + element_iter->tfindex*2 + 1) = final_position[i].uv[1];
- }
- }
+ UvElement *element_iter = element;
+ /* propagate to coincident uvs */
+ do{
+ MTFace *mt;
- /* end of calculations, keep only the selection flag */
- if( (!state->snap_islands) || ((!stitch_midpoints) && (element_iter->island == state->static_island))) {
- element_iter->flag &= STITCH_SELECTED;
- }
+ efa = element_iter->face;
+ mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
- element_iter = element_iter->next;
- }while(element_iter && !element_iter->separate);
+ element_iter->flag |= STITCH_PROCESSED;
+ /* either flush to preview or to the MTFace, if final */
+ if(final){
+ mt->uv[element_iter->tfindex][0] = final_position[i].uv[0];
+ mt->uv[element_iter->tfindex][1] = final_position[i].uv[1];
+
+ uvedit_uv_select(scene, efa, mt, element_iter->tfindex);
+ }else if(efa->tmp.l != STITCH_NO_PREVIEW){
+ if(efa->v4){
+ *(preview->preview_quads+efa->tmp.l + element_iter->tfindex*2) = final_position[i].uv[0];
+ *(preview->preview_quads+efa->tmp.l + element_iter->tfindex*2 + 1) = final_position[i].uv[1];
+ }else{
+ *(preview->preview_tris+efa->tmp.l + element_iter->tfindex*2) = final_position[i].uv[0];
+ *(preview->preview_tris+efa->tmp.l + element_iter->tfindex*2 + 1) = final_position[i].uv[1];
+ }
+ }
- continue;
+ /* end of calculations, keep only the selection flag */
+ if( (!state->snap_islands) || ((!stitch_midpoints) && (element_iter->island == state->static_island))) {
+ element_iter->flag &= STITCH_SELECTED;
}
+
element_iter = element_iter->next;
- }
+ }while(element_iter && !element_iter->separate);
}
}
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 110ac59edc9..efe6c4d2586 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -120,6 +120,7 @@ typedef struct Image {
#define IMA_DEPRECATED 64
#define IMA_OLD_PREMUL 128
#define IMA_CM_PREDIVIDE 256
+#define IMA_USED_FOR_RENDER 512
/* Image.tpageflag */
#define IMA_TILES 1
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index da7c314a0b4..c75cdf525b0 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1969,6 +1969,10 @@ static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "add", "ED_mesh_vertices_add");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
+
+ func= RNA_def_function(srna, "remove", "ED_mesh_vertices_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX);
}
/* mesh.edges */
@@ -1987,7 +1991,11 @@ static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "add", "ED_mesh_edges_add");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to add", 0, INT_MAX);
+
+ func= RNA_def_function(srna, "remove", "ED_mesh_edges_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to remove", 0, INT_MAX);
}
/* mesh.faces */
@@ -2010,7 +2018,11 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "add", "ED_mesh_faces_add");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to add", 0, INT_MAX);
+
+ func= RNA_def_function(srna, "remove", "ED_mesh_faces_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to remove", 0, INT_MAX);
}
/* mesh.loops */
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index dd0a0f308ce..2f585f91d44 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -210,4 +210,8 @@ int RE_bake_shade_all_selected(struct Render *re, int type, struct Object *actob
struct Image *RE_bake_shade_get_image(void);
void RE_bake_ibuf_filter(struct ImBuf *ibuf, char *mask, const int filter);
+#define BAKE_RESULT_OK 0
+#define BAKE_RESULT_NO_OBJECTS 1
+#define BAKE_RESULT_FEEDBACK_LOOP 2
+
#endif /* RE_SHADER_EXT_H */
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 0b6e1b8ee01..2d64828b6b3 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -131,6 +131,8 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
return retval;
ibuf= BKE_image_get_ibuf(ima, &tex->iuser);
+
+ ima->flag|= IMA_USED_FOR_RENDER;
}
if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
return retval;
@@ -1441,6 +1443,8 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
return retval;
ibuf= BKE_image_get_ibuf(ima, &tex->iuser);
+
+ ima->flag|= IMA_USED_FOR_RENDER;
}
if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
return retval;
@@ -1812,6 +1816,8 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
ibuf->rect-= (ibuf->x*ibuf->y);
+
+ ima->flag|= IMA_USED_FOR_RENDER;
}
void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *result)
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 773af96671a..2d3837acbfa 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -2440,6 +2440,11 @@ static int get_next_bake_face(BakeShade *bs)
if(ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
continue;
+ if(ima->flag & IMA_USED_FOR_RENDER) {
+ ima->id.flag &= ~LIB_DOIT;
+ continue;
+ }
+
/* find the image for the first time? */
if(ima->id.flag & LIB_DOIT) {
ima->id.flag &= ~LIB_DOIT;
@@ -2584,7 +2589,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
BakeShade *handles;
ListBase threads;
Image *ima;
- int a, vdone=0, usemask=0;
+ int a, vdone=0, usemask=0, result=BAKE_RESULT_OK;
/* initialize render global */
R= *re;
@@ -2601,6 +2606,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
for(ima= G.main->image.first; ima; ima= ima->id.next) {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
ima->id.flag |= LIB_DOIT;
+ ima->flag&= ~IMA_USED_FOR_RENDER;
if(ibuf) {
ibuf->userdata = NULL; /* use for masking if needed */
if(ibuf->rect_float)
@@ -2659,6 +2665,9 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
if((ima->id.flag & LIB_DOIT)==0) {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ if(ima->flag & IMA_USED_FOR_RENDER)
+ result= BAKE_RESULT_FEEDBACK_LOOP;
+
if(!ibuf)
continue;
@@ -2679,7 +2688,10 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
BLI_end_threads(&threads);
- return vdone;
+ if(vdone==0)
+ result= BAKE_RESULT_NO_OBJECTS;
+
+ return result;
}
struct Image *RE_bake_shade_get_image(void)
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 452c027ffa0..388d9214124 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -329,6 +329,9 @@ void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count)
void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count){}
void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_faces_remove(struct Mesh *mesh, struct ReportList *reports, int count){}
void ED_mesh_material_link(struct Mesh *mesh, struct Material *ma){}
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me){return 0;}