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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-30 13:31:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-30 13:31:11 +0400
commit9e5b28cd42a3cf87ac76e3b27b52dce08071d244 (patch)
treeeb14ff117faf3f6c524ea0a09389da313044d105 /source
parent274080025d315dc08f9291bddc6d4235ed0fc8e0 (diff)
parentc9edbab08a4854ad6e79abdfaaee65e0f9301ac0 (diff)
svn merge ^/trunk/blender -r42261:42290
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_deform.h13
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/intern/action.c14
-rw-r--r--source/blender/blenkernel/intern/anim.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c10
-rw-r--r--source/blender/blenkernel/intern/brush.c10
-rw-r--r--source/blender/blenkernel/intern/camera.c10
-rw-r--r--source/blender/blenkernel/intern/curve.c10
-rw-r--r--source/blender/blenkernel/intern/deform.c266
-rw-r--r--source/blender/blenkernel/intern/image.c20
-rw-r--r--source/blender/blenkernel/intern/lamp.c10
-rw-r--r--source/blender/blenkernel/intern/lattice.c10
-rw-r--r--source/blender/blenkernel/intern/library.c6
-rw-r--r--source/blender/blenkernel/intern/material.c22
-rw-r--r--source/blender/blenkernel/intern/mball.c10
-rw-r--r--source/blender/blenkernel/intern/mesh.c8
-rw-r--r--source/blender/blenkernel/intern/object.c20
-rw-r--r--source/blender/blenkernel/intern/particle.c10
-rw-r--r--source/blender/blenkernel/intern/speaker.c10
-rw-r--r--source/blender/blenkernel/intern/texture.c26
-rw-r--r--source/blender/blenkernel/intern/world.c10
-rw-r--r--source/blender/blenloader/intern/readfile.c32
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/interface/interface_panel.c5
-rw-r--r--source/blender/editors/object/object_constraint.c2
-rw-r--r--source/blender/editors/object/object_transform.c6
-rw-r--r--source/blender/editors/object/object_vgroup.c14
-rw-r--r--source/blender/editors/render/render_opengl.c39
-rw-r--r--source/blender/editors/screen/area.c37
-rw-r--r--source/blender/editors/space_clip/clip_draw.c25
-rw-r--r--source/blender/editors/space_image/image_draw.c21
-rw-r--r--source/blender/editors/space_node/drawnode.c57
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c24
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_space.c13
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c47
-rw-r--r--source/blender/python/intern/bpy_library.c9
-rw-r--r--source/blender/python/intern/bpy_props.c2
-rw-r--r--source/blender/python/mathutils/mathutils.c8
-rw-r--r--source/blender/python/mathutils/mathutils.h40
-rw-r--r--source/blender/python/mathutils/mathutils_Color.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c5
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c22
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h6
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c19
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c29
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.h2
-rw-r--r--source/blender/render/intern/source/convertblender.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp2
54 files changed, 562 insertions, 426 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index a64ebe56c9c..50a1331d7ab 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 260
-#define BLENDER_SUBVERSION 5
+#define BLENDER_SUBVERSION 6
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 3e643fe961c..ed8ea691134 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -52,13 +52,16 @@ void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob);
struct MDeformWeight *defvert_find_index(const struct MDeformVert *dv, const int defgroup);
struct MDeformWeight *defvert_verify_index(struct MDeformVert *dv, const int defgroup);
+void defvert_remove_index(struct MDeformVert *dvert, int defgroup, struct MDeformWeight *dw);
-float defvert_find_weight(const struct MDeformVert *dvert, const int group_num);
-float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, int group_num);
+float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup);
+float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup);
-void defvert_copy(struct MDeformVert *dvert_r, const struct MDeformVert *dvert);
-void defvert_sync(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, int use_verify);
-void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, const int *flip_map, const int flip_map_len, const int use_verify);
+void defvert_copy(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src);
+void defvert_copy_index(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const int defgroup);
+void defvert_sync(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, int use_verify);
+void defvert_sync_mapped(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src,
+ const int *flip_map, const int flip_map_len, const int use_verify);
void defvert_remap (struct MDeformVert *dvert, int *map);
void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
void defvert_normalize(struct MDeformVert *dvert);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index ade055ac457..e8d6c85664b 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -49,7 +49,7 @@ void *alloc_libblock(struct ListBase *lb, short type, const char *name);
void *copy_libblock(struct ID *id);
void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action);
-void BKE_id_lib_local_paths(struct Main *bmain, struct ID *id);
+void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
void id_lib_extern(struct ID *id);
void BKE_library_filepath_set(struct Library *lib, const char *filepath);
void id_us_plus(struct ID *id);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 5fb03b7bbd0..767401a55ef 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -92,8 +92,8 @@ bAction *add_empty_action(const char name[])
/* temp data for make_local_action */
typedef struct tMakeLocalActionContext {
- bAction *act; /* original action */
- bAction *actn; /* new action */
+ bAction *act; /* original action */
+ bAction *act_new; /* new action */
int is_lib; /* some action users were libraries */
int is_local; /* some action users were not libraries */
@@ -117,9 +117,9 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
if (adt->action == mlac->act) {
if (id->lib == NULL) {
- adt->action = mlac->actn;
+ adt->action = mlac->act_new;
- id_us_plus(&mlac->actn->id);
+ id_us_plus(&mlac->act_new->id);
id_us_min(&mlac->act->id);
}
}
@@ -146,10 +146,10 @@ void make_local_action(bAction *act)
id_clear_lib_data(bmain, &act->id);
}
else if (mlac.is_local && mlac.is_lib) {
- mlac.actn= copy_action(act);
- mlac.actn->id.us= 0;
+ mlac.act_new= copy_action(act);
+ mlac.act_new->id.us= 0;
- BKE_id_lib_local_paths(bmain, &mlac.actn->id);
+ BKE_id_lib_local_paths(bmain, act->id.lib, &mlac.act_new->id);
BKE_animdata_main_cb(bmain, make_localact_apply_cb, &mlac);
}
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 67bd1ec18aa..0d63c161ccc 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -758,7 +758,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, int animated)
{
extern int enable_cu_speed; /* object.c */
- Object copyob = {{NULL}};
+ Object copyob;
int cfrao = scene->r.cfra;
int dupend = ob->dupend;
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index a9c29728650..2157bd5999b 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -158,17 +158,17 @@ void make_local_armature(bArmature *arm)
id_clear_lib_data(bmain, &arm->id);
}
else if(is_local && is_lib) {
- bArmature *armn= copy_armature(arm);
- armn->id.us= 0;
+ bArmature *arm_new= copy_armature(arm);
+ arm_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &armn->id);
+ BKE_id_lib_local_paths(bmain, arm->id.lib, &arm_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == arm) {
if(ob->id.lib==NULL) {
- ob->data= armn;
- armn->id.us++;
+ ob->data= arm_new;
+ arm_new->id.us++;
arm->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 5303baddbca..7fac273ef77 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -224,17 +224,17 @@ void make_local_brush(Brush *brush)
}
}
else if(is_local && is_lib) {
- Brush *brushn= copy_brush(brush);
- brushn->id.us= 1; /* only keep fake user */
- brushn->id.flag |= LIB_FAKEUSER;
+ Brush *brush_new= copy_brush(brush);
+ brush_new->id.us= 1; /* only keep fake user */
+ brush_new->id.flag |= LIB_FAKEUSER;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &brush->id);
+ BKE_id_lib_local_paths(bmain, brush->id.lib, &brush_new->id);
for(scene= bmain->scene.first; scene; scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
if(scene->id.lib==NULL) {
- paint_brush_set(&scene->toolsettings->imapaint.paint, brushn);
+ paint_brush_set(&scene->toolsettings->imapaint.paint, brush_new);
}
}
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 08e8a80750e..2bd973d7799 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -108,18 +108,18 @@ void make_local_camera(Camera *cam)
id_clear_lib_data(bmain, &cam->id);
}
else if(is_local && is_lib) {
- Camera *camn= copy_camera(cam);
+ Camera *cam_new= copy_camera(cam);
- camn->id.us= 0;
+ cam_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &camn->id);
+ BKE_id_lib_local_paths(bmain, cam->id.lib, &cam_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == cam) {
if(ob->id.lib==NULL) {
- ob->data= camn;
- camn->id.us++;
+ ob->data= cam_new;
+ cam_new->id.us++;
cam->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index ccafb65312a..1bee8eaa023 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -275,16 +275,16 @@ void make_local_curve(Curve *cu)
extern_local_curve(cu);
}
else if(is_local && is_lib) {
- Curve *cun= copy_curve(cu);
- cun->id.us= 0;
+ Curve *cu_new= copy_curve(cu);
+ cu_new->id.us= 0;
- BKE_id_lib_local_paths(bmain, &cun->id);
+ BKE_id_lib_local_paths(bmain, cu->id.lib, &cu_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==cu) {
if(ob->id.lib==NULL) {
- ob->data= cun;
- cun->id.us++;
+ ob->data= cu_new;
+ cu_new->id.us++;
cu->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 9539e6a4bfa..6947bf05890 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -48,7 +48,7 @@
#include "BLI_cellalloc.h"
-void defgroup_copy_list (ListBase *outbase, ListBase *inbase)
+void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
{
bDeformGroup *defgroup, *defgroupn;
@@ -60,7 +60,7 @@ void defgroup_copy_list (ListBase *outbase, ListBase *inbase)
}
}
-bDeformGroup *defgroup_duplicate (bDeformGroup *ingroup)
+bDeformGroup *defgroup_duplicate(bDeformGroup *ingroup)
{
bDeformGroup *outgroup;
@@ -68,7 +68,7 @@ bDeformGroup *defgroup_duplicate (bDeformGroup *ingroup)
return NULL;
outgroup=MEM_callocN(sizeof(bDeformGroup), "copy deformGroup");
-
+
/* For now, just copy everything over. */
memcpy (outgroup, ingroup, sizeof(bDeformGroup));
@@ -78,59 +78,85 @@ bDeformGroup *defgroup_duplicate (bDeformGroup *ingroup)
}
/* copy & overwrite weights */
-void defvert_copy (MDeformVert *dvert_r, const MDeformVert *dvert)
+void defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src)
{
- if(dvert_r->totweight == dvert->totweight) {
- if(dvert->totweight)
- memcpy(dvert_r->dw, dvert->dw, dvert->totweight * sizeof(MDeformWeight));
+ if (dvert_dst->totweight == dvert_src->totweight) {
+ if (dvert_src->totweight)
+ memcpy(dvert_dst->dw, dvert_src->dw, dvert_src->totweight * sizeof(MDeformWeight));
}
else {
- if(dvert_r->dw)
- BLI_cellalloc_free(dvert_r->dw);
+ if (dvert_dst->dw)
+ BLI_cellalloc_free(dvert_dst->dw);
- if(dvert->totweight)
- dvert_r->dw= BLI_cellalloc_dupalloc(dvert->dw);
+ if (dvert_src->totweight)
+ dvert_dst->dw= BLI_cellalloc_dupalloc(dvert_src->dw);
else
- dvert_r->dw= NULL;
+ dvert_dst->dw= NULL;
+
+ dvert_dst->totweight = dvert_src->totweight;
+ }
+}
+
+/* copy an index from one dvert to another
+ * - do nothing if neither are set.
+ * - add destination weight if needed.
+ */
+void defvert_copy_index(MDeformVert *dvert_dst, const MDeformVert *dvert_src, const int defgroup)
+{
+ MDeformWeight *dw_src, *dw_dst;
+
+ dw_src= defvert_find_index(dvert_src, defgroup);
+
+ if (dw_src) {
+ /* source is valid, verify destination */
+ dw_dst= defvert_verify_index(dvert_dst, defgroup);
+ dw_dst->weight= dw_src->weight;
+ }
+ else {
+ /* source was NULL, assign zero, could also remove */
+ dw_dst= defvert_find_index(dvert_dst, defgroup);
- dvert_r->totweight = dvert->totweight;
+ if (dw_dst) {
+ dw_dst->weight= 0.0f;
+ }
}
}
/* only sync over matching weights, don't add or remove groups
* warning, loop within loop.
*/
-void defvert_sync (MDeformVert *dvert_r, const MDeformVert *dvert, int use_verify)
+void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, int use_verify)
{
- if(dvert->totweight && dvert_r->totweight) {
+ if (dvert_src->totweight && dvert_dst->totweight) {
int i;
- MDeformWeight *dw;
- for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) {
- MDeformWeight *dw_r;
- if(use_verify) dw_r= defvert_verify_index(dvert_r, dw->def_nr);
- else dw_r= defvert_find_index(dvert_r, dw->def_nr);
-
- if(dw_r) {
- dw_r->weight= dw->weight;
+ MDeformWeight *dw_src;
+ for (i=0, dw_src=dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
+ MDeformWeight *dw_dst;
+ if (use_verify) dw_dst= defvert_verify_index(dvert_dst, dw_src->def_nr);
+ else dw_dst= defvert_find_index(dvert_dst, dw_src->def_nr);
+
+ if (dw_dst) {
+ dw_dst->weight= dw_src->weight;
}
}
}
}
/* be sure all flip_map values are valid */
-void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const int *flip_map, const int flip_map_len, const int use_verify)
+void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src,
+ const int *flip_map, const int flip_map_len, const int use_verify)
{
- if (dvert->totweight && dvert_r->totweight) {
+ if (dvert_src->totweight && dvert_dst->totweight) {
int i;
- MDeformWeight *dw;
- for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) {
- if (dw->def_nr < flip_map_len) {
- MDeformWeight *dw_r;
- if(use_verify) dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]);
- else dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]);
-
- if(dw_r) {
- dw_r->weight= dw->weight;
+ MDeformWeight *dw_src;
+ for (i=0, dw_src=dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
+ if (dw_src->def_nr < flip_map_len) {
+ MDeformWeight *dw_dst;
+ if (use_verify) dw_dst= defvert_verify_index(dvert_dst, flip_map[dw_src->def_nr]);
+ else dw_dst= defvert_find_index(dvert_dst, flip_map[dw_src->def_nr]);
+
+ if (dw_dst) {
+ dw_dst->weight= dw_src->weight;
}
}
}
@@ -138,18 +164,18 @@ void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const
}
/* be sure all flip_map values are valid */
-void defvert_remap (MDeformVert *dvert, int *map)
+void defvert_remap(MDeformVert *dvert, int *map)
{
MDeformWeight *dw;
int i;
- for(i=0, dw=dvert->dw; i<dvert->totweight; i++, dw++) {
+ for (i=0, dw=dvert->dw; i<dvert->totweight; i++, dw++) {
dw->def_nr= map[dw->def_nr];
}
}
-void defvert_normalize (MDeformVert *dvert)
+void defvert_normalize(MDeformVert *dvert)
{
- if(dvert->totweight<=0) {
+ if (dvert->totweight<=0) {
/* nothing */
}
else if (dvert->totweight==1) {
@@ -159,30 +185,30 @@ void defvert_normalize (MDeformVert *dvert)
int i;
float tot= 0.0f;
MDeformWeight *dw;
- for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++)
+ for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++)
tot += dw->weight;
- if(tot > 0.0f) {
- for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++)
+ if (tot > 0.0f) {
+ for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++)
dw->weight /= tot;
}
}
}
-void defvert_flip (MDeformVert *dvert, const int *flip_map, const int flip_map_len)
+void defvert_flip(MDeformVert *dvert, const int *flip_map, const int flip_map_len)
{
MDeformWeight *dw;
int i;
- for(dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++) {
- if((dw->def_nr < flip_map_len) && (flip_map[dw->def_nr] >= 0)) {
+ for (dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++) {
+ if ((dw->def_nr < flip_map_len) && (flip_map[dw->def_nr] >= 0)) {
dw->def_nr= flip_map[dw->def_nr];
}
}
}
-bDeformGroup *defgroup_find_name (Object *ob, const char *name)
+bDeformGroup *defgroup_find_name(Object *ob, const char *name)
{
/* return a pointer to the deform group with this name
* or return NULL otherwise.
@@ -197,7 +223,7 @@ bDeformGroup *defgroup_find_name (Object *ob, const char *name)
return NULL;
}
-int defgroup_name_index (Object *ob, const char *name)
+int defgroup_name_index(Object *ob, const char *name)
{
/* Return the location of the named deform group within the list of
* deform groups. This function is a combination of defgroup_find_index and
@@ -206,8 +232,8 @@ int defgroup_name_index (Object *ob, const char *name)
*/
bDeformGroup *curdef;
int def_nr;
-
- if(name && name[0] != '\0') {
+
+ if (name && name[0] != '\0') {
for (curdef=ob->defbase.first, def_nr=0; curdef; curdef=curdef->next, def_nr++) {
if (!strcmp(curdef->name, name))
return def_nr;
@@ -217,7 +243,7 @@ int defgroup_name_index (Object *ob, const char *name)
return -1;
}
-int defgroup_find_index (Object *ob, bDeformGroup *dg)
+int defgroup_find_index(Object *ob, bDeformGroup *dg)
{
/* Fetch the location of this deform group
* within the linked list of deform groups.
@@ -253,7 +279,7 @@ int defgroup_find_index (Object *ob, bDeformGroup *dg)
* constant for this)
*/
if (eg == NULL) return -1;
-
+
return def_nr;
}
@@ -262,7 +288,7 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
{
int totdg= *flip_map_len= BLI_countlist(&ob->defbase);
- if(totdg==0) {
+ if (totdg==0) {
return NULL;
}
else {
@@ -275,16 +301,16 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
}
for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
- if(map[i] == -1) { /* may be calculated previously */
+ if (map[i] == -1) { /* may be calculated previously */
/* incase no valid value is found, use this */
- if(use_default)
+ if (use_default)
map[i]= i;
flip_side_name(name, dg->name, FALSE);
- if(strcmp(name, dg->name)) {
+ if (strcmp(name, dg->name)) {
flip_num= defgroup_name_index(ob, name);
- if(flip_num >= 0) {
+ if (flip_num >= 0) {
map[i]= flip_num;
map[flip_num]= i; /* save an extra lookup */
}
@@ -300,7 +326,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in
{
int totdg= *flip_map_len= BLI_countlist(&ob->defbase);
- if(totdg==0) {
+ if (totdg==0) {
return NULL;
}
else {
@@ -316,10 +342,10 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in
dg= BLI_findlink(&ob->defbase, defgroup);
flip_side_name(name, dg->name, FALSE);
- if(strcmp(name, dg->name)) {
+ if (strcmp(name, dg->name)) {
flip_num= defgroup_name_index(ob, name);
- if(flip_num >= 0) {
+ if (flip_num >= 0) {
map[defgroup]= flip_num;
map[flip_num]= defgroup;
}
@@ -334,11 +360,11 @@ int defgroup_flip_index(Object *ob, int index, int use_default)
bDeformGroup *dg= BLI_findlink(&ob->defbase, index);
int flip_index = -1;
- if(dg) {
+ if (dg) {
char name[sizeof(dg->name)];
flip_side_name(name, dg->name, 0);
- if(strcmp(name, dg->name))
+ if (strcmp(name, dg->name))
flip_index= defgroup_name_index(ob, name);
}
@@ -348,7 +374,7 @@ int defgroup_flip_index(Object *ob, int index, int use_default)
static int defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *ob)
{
bDeformGroup *curdef;
-
+
for (curdef = ob->defbase.first; curdef; curdef=curdef->next) {
if (dg!=curdef) {
if (!strcmp(curdef->name, name)) {
@@ -366,7 +392,7 @@ static int defgroup_unique_check(void *arg, const char *name)
return defgroup_find_name_dupe(name, data->dg, data->ob);
}
-void defgroup_unique_name (bDeformGroup *dg, Object *ob)
+void defgroup_unique_name(bDeformGroup *dg, Object *ob)
{
struct {Object *ob; void *dg;} data;
data.ob= ob;
@@ -378,7 +404,7 @@ void defgroup_unique_name (bDeformGroup *dg, Object *ob)
/* finds the best possible flipped name. For renaming; check for unique names afterwards */
/* if strip_number: removes number extensions
* note: dont use sizeof() for 'name' or 'from_name' */
-void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number)
+void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number)
{
int len;
char prefix[MAX_VGROUP_NAME]= ""; /* The part before the facing */
@@ -388,15 +414,15 @@ void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP
char *index=NULL;
len= BLI_strnlen(from_name, MAX_VGROUP_NAME);
- if(len<3) return; // we don't do names like .R or .L
+ if (len < 3) return; // we don't do names like .R or .L
BLI_strncpy(name, from_name, MAX_VGROUP_NAME);
/* We first check the case with a .### extension, let's find the last period */
- if(isdigit(name[len-1])) {
+ if (isdigit(name[len-1])) {
index= strrchr(name, '.'); // last occurrence
if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever!
- if(strip_number==0)
+ if (strip_number==0)
BLI_strncpy(number, index, sizeof(number));
*index= 0;
len= BLI_strnlen(name, MAX_VGROUP_NAME);
@@ -408,7 +434,7 @@ void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP
#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_')
/* first case; separator . - _ with extensions r R l L */
- if( IS_SEPARATOR(name[len-2]) ) {
+ if (IS_SEPARATOR(name[len-2]) ) {
switch(name[len-1]) {
case 'l':
prefix[len-1]= 0;
@@ -429,7 +455,7 @@ void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP
}
}
/* case; beginning with r R l L , with separator after it */
- else if( IS_SEPARATOR(name[1]) ) {
+ else if (IS_SEPARATOR(name[1]) ) {
switch(name[0]) {
case 'l':
strcpy(replace, "r");
@@ -453,14 +479,14 @@ void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP
break;
}
}
- else if(len > 5) {
+ else if (len > 5) {
/* hrms, why test for a separator? lets do the rule 'ultimate left or right' */
index = BLI_strcasestr(prefix, "right");
if (index==prefix || index==prefix+len-5) {
- if(index[0]=='r')
+ if (index[0]=='r')
strcpy (replace, "left");
else {
- if(index[1]=='I')
+ if (index[1]=='I')
strcpy (replace, "LEFT");
else
strcpy (replace, "Left");
@@ -471,10 +497,10 @@ void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP
else {
index = BLI_strcasestr(prefix, "left");
if (index==prefix || index==prefix+len-4) {
- if(index[0]=='l')
+ if (index[0]=='l')
strcpy (replace, "right");
else {
- if(index[1]=='E')
+ if (index[1]=='E')
strcpy (replace, "RIGHT");
else
strcpy (replace, "Right");
@@ -490,30 +516,32 @@ void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP
BLI_snprintf (name, MAX_VGROUP_NAME, "%s%s%s%s", prefix, replace, suffix, number);
}
-float defvert_find_weight(const struct MDeformVert *dvert, const int group_num)
+float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup)
{
- MDeformWeight *dw= defvert_find_index(dvert, group_num);
+ MDeformWeight *dw= defvert_find_index(dvert, defgroup);
return dw ? dw->weight : 0.0f;
}
-float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, int group_num)
+float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup)
{
- if(group_num == -1 || dvert == NULL)
+ if (defgroup == -1 || dvert == NULL)
return 1.0f;
- return defvert_find_weight(dvert+index, group_num);
+ return defvert_find_weight(dvert+index, defgroup);
}
MDeformWeight *defvert_find_index(const MDeformVert *dvert, const int defgroup)
{
- if(dvert && defgroup >= 0) {
+ if (dvert && defgroup >= 0) {
MDeformWeight *dw = dvert->dw;
int i;
- for(i=dvert->totweight; i>0; i--, dw++)
- if(dw->def_nr == defgroup)
+ for (i=dvert->totweight; i>0; i--, dw++) {
+ if (dw->def_nr == defgroup) {
return dw;
+ }
+ }
}
return NULL;
@@ -521,30 +549,74 @@ MDeformWeight *defvert_find_index(const MDeformVert *dvert, const int defgroup)
/* Ensures that mv has a deform weight entry for the specified defweight group */
/* Note this function is mirrored in editmesh_tools.c, for use for editvertices */
-MDeformWeight *defvert_verify_index(MDeformVert *dv, const int defgroup)
+MDeformWeight *defvert_verify_index(MDeformVert *dvert, const int defgroup)
{
- MDeformWeight *newdw;
+ MDeformWeight *dw_new;
/* do this check always, this function is used to check for it */
- if(!dv || defgroup < 0)
+ if (!dvert || defgroup < 0)
return NULL;
- newdw= defvert_find_index(dv, defgroup);
- if(newdw)
- return newdw;
+ dw_new= defvert_find_index(dvert, defgroup);
+ if (dw_new)
+ return dw_new;
- newdw= BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
- if(dv->dw) {
- memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
- BLI_cellalloc_free(dv->dw);
+ dw_new= BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight");
+ if (dvert->dw) {
+ memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
+ BLI_cellalloc_free(dvert->dw);
}
- dv->dw= newdw;
- newdw += dv->totweight;
- newdw->weight= 0.0f;
- newdw->def_nr= defgroup;
+ dvert->dw= dw_new;
+ dw_new += dvert->totweight;
+ dw_new->weight= 0.0f;
+ dw_new->def_nr= defgroup;
/* Group index */
- dv->totweight++;
+ dvert->totweight++;
+
+ return dw_new;
+}
+
+/* Removes the given vertex from the vertex group, specified either by its defgrp_idx,
+ * or directly by its MDeformWeight pointer, if dw is not NULL.
+ * WARNING: This function frees the given MDeformWeight, do not use it afterward! */
+void defvert_remove_index(MDeformVert *dvert, int defgroup, MDeformWeight *dw)
+{
+ MDeformWeight *dw_new;
+ int i;
+
+ /* Get index of removed MDeformWeight. */
+ if (dw == NULL) {
+ dw = dvert->dw;
+ for (i = dvert->totweight; i > 0; i--, dw++) {
+ if (dw->def_nr == defgroup)
+ break;
+ }
+ i--;
+ }
+ else {
+ i = dw - dvert->dw;
+ /* Security check! */
+ if(i < 0 || i >= dvert->totweight)
+ return;
+ }
- return newdw;
+ dvert->totweight--;
+ /* If there are still other deform weights attached to this vert then remove
+ * this deform weight, and reshuffle the others.
+ */
+ if (dvert->totweight) {
+ dw_new = BLI_cellalloc_malloc(sizeof(MDeformWeight)*(dvert->totweight), __func__);
+ if (dvert->dw){
+ memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*i);
+ memcpy(dw_new+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
+ BLI_cellalloc_free(dvert->dw);
+ }
+ dvert->dw = dw_new;
+ }
+ else {
+ /* If there are no other deform weights left then just remove this one. */
+ BLI_cellalloc_free(dvert->dw);
+ dvert->dw = NULL;
+ }
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index c7f74f37a2d..fb734ea4f3d 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -385,19 +385,19 @@ void make_local_image(struct Image *ima)
extern_local_image(ima);
}
else if(is_local && is_lib) {
- Image *iman= copy_image(ima);
+ Image *ima_new= copy_image(ima);
- iman->id.us= 0;
+ ima_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &iman->id);
+ BKE_id_lib_local_paths(bmain, ima->id.lib, &ima_new->id);
tex= bmain->tex.first;
while(tex) {
if(tex->id.lib==NULL) {
if(tex->ima==ima) {
- tex->ima = iman;
- iman->id.us++;
+ tex->ima = ima_new;
+ ima_new->id.us++;
ima->id.us--;
}
}
@@ -407,8 +407,8 @@ void make_local_image(struct Image *ima)
while(brush) {
if(brush->id.lib==NULL) {
if(brush->clone.image==ima) {
- brush->clone.image = iman;
- iman->id.us++;
+ brush->clone.image = ima_new;
+ ima_new->id.us++;
ima->id.us--;
}
}
@@ -429,11 +429,11 @@ void make_local_image(struct Image *ima)
for(a=0; a<me->totface; a++, tface++) {
if(tface->tpage == ima) {
- tface->tpage = iman;
- if(iman->id.us == 0) {
+ tface->tpage = ima_new;
+ if(ima_new->id.us == 0) {
tface->tpage->id.us= 1;
}
- id_lib_extern((ID*)iman);
+ id_lib_extern((ID*)ima_new);
}
}
}
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 4edd032dc04..6b4cdc70aea 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -184,19 +184,19 @@ void make_local_lamp(Lamp *la)
id_clear_lib_data(bmain, &la->id);
}
else if(is_local && is_lib) {
- Lamp *lan= copy_lamp(la);
- lan->id.us= 0;
+ Lamp *la_new= copy_lamp(la);
+ la_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &lan->id);
+ BKE_id_lib_local_paths(bmain, la->id.lib, &la_new->id);
ob= bmain->object.first;
while(ob) {
if(ob->data==la) {
if(ob->id.lib==NULL) {
- ob->data= lan;
- lan->id.us++;
+ ob->data= la_new;
+ la_new->id.us++;
la->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 7c9e2be4493..4f02fdd1f46 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -271,17 +271,17 @@ void make_local_lattice(Lattice *lt)
id_clear_lib_data(bmain, &lt->id);
}
else if(is_local && is_lib) {
- Lattice *ltn= copy_lattice(lt);
- ltn->id.us= 0;
+ Lattice *lt_new= copy_lattice(lt);
+ lt_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &ltn->id);
+ BKE_id_lib_local_paths(bmain, lt->id.lib, &lt_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==lt) {
if(ob->id.lib==NULL) {
- ob->data= ltn;
- ltn->id.us++;
+ ob->data= lt_new;
+ lt_new->id.us++;
lt->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 4155551763e..28524668bd3 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -136,9 +136,9 @@
* from id_make_local() but then the make local functions would not be self
* contained.
* also note that the id _must_ have a library - campbell */
-void BKE_id_lib_local_paths(Main *bmain, ID *id)
+void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
{
- char *bpath_user_data[2]= {bmain->name, (id)->lib->filepath};
+ char *bpath_user_data[2]= {bmain->name, lib->filepath};
bpath_traverse_id(bmain, id,
bpath_relocate_visitor,
@@ -1278,7 +1278,7 @@ int new_id(ListBase *lb, ID *id, const char *tname)
don't have other library users. */
void id_clear_lib_data(Main *bmain, ID *id)
{
- BKE_id_lib_local_paths(bmain, id);
+ BKE_id_lib_local_paths(bmain, id->lib, id);
id->lib= NULL;
id->flag= LIB_LOCAL;
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index ecf74b1d8e1..60ae86063e8 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -364,12 +364,12 @@ void make_local_material(Material *ma)
}
/* Both user and local, so copy. */
else if(is_local && is_lib) {
- Material *man= copy_material(ma);
+ Material *ma_new= copy_material(ma);
- man->id.us= 0;
+ ma_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &man->id);
+ BKE_id_lib_local_paths(bmain, ma->id.lib, &ma_new->id);
/* do objects */
ob= bmain->object.first;
@@ -378,8 +378,8 @@ void make_local_material(Material *ma)
for(a=0; a<ob->totcol; a++) {
if(ob->mat[a]==ma) {
if(ob->id.lib==NULL) {
- ob->mat[a]= man;
- man->id.us++;
+ ob->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
@@ -394,8 +394,8 @@ void make_local_material(Material *ma)
for(a=0; a<me->totcol; a++) {
if(me->mat[a]==ma) {
if(me->id.lib==NULL) {
- me->mat[a]= man;
- man->id.us++;
+ me->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
@@ -410,8 +410,8 @@ void make_local_material(Material *ma)
for(a=0; a<cu->totcol; a++) {
if(cu->mat[a]==ma) {
if(cu->id.lib==NULL) {
- cu->mat[a]= man;
- man->id.us++;
+ cu->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
@@ -426,8 +426,8 @@ void make_local_material(Material *ma)
for(a=0; a<mb->totcol; a++) {
if(mb->mat[a]==ma) {
if(mb->id.lib==NULL) {
- mb->mat[a]= man;
- man->id.us++;
+ mb->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 3e3f16dcfa3..0883ec121d6 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -174,17 +174,17 @@ void make_local_mball(MetaBall *mb)
extern_local_mball(mb);
}
else if(is_local && is_lib) {
- MetaBall *mbn= copy_mball(mb);
- mbn->id.us= 0;
+ MetaBall *mb_new= copy_mball(mb);
+ mb_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &mbn->id);
+ BKE_id_lib_local_paths(bmain, mb->id.lib, &mb_new->id);
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->data == mb) {
if(ob->id.lib==NULL) {
- ob->data= mbn;
- mbn->id.us++;
+ ob->data= mb_new;
+ mb_new->id.us++;
mb->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 5b12425ef10..b683d74d5f7 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -655,15 +655,15 @@ void make_local_mesh(Mesh *me)
expand_local_mesh(me);
}
else if(local && lib) {
- Mesh *men= copy_mesh(me);
- men->id.us= 0;
+ Mesh *me_new= copy_mesh(me);
+ me_new->id.us= 0;
- BKE_id_lib_local_paths(bmain, &men->id);
+ BKE_id_lib_local_paths(bmain, me->id.lib, &me_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(me == ob->data) {
if(ob->id.lib==NULL) {
- set_mesh(ob, men);
+ set_mesh(ob, me_new);
}
}
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ffa2a36dcf6..79857c7658c 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -121,6 +121,7 @@ void clear_workob(Object *workob)
memset(workob, 0, sizeof(Object));
workob->size[0]= workob->size[1]= workob->size[2]= 1.0f;
+ workob->dsize[0]= workob->dsize[1]= workob->dsize[2]= 1.0f;
workob->rotmode= ROT_MODE_EUL;
}
@@ -775,6 +776,7 @@ Object *add_only_object(int type, const char *name)
ob->col[3]= 1.0;
ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
+ ob->dsize[0]= ob->dsize[1]= ob->dsize[2]= 1.0;
/* objects should default to having Euler XYZ rotations,
* but rotations default to quaternions
@@ -1233,12 +1235,12 @@ void make_local_object(Object *ob)
extern_local_object(ob);
}
else if(is_local && is_lib) {
- Object *obn= copy_object(ob);
+ Object *ob_new= copy_object(ob);
- obn->id.us= 0;
+ ob_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &obn->id);
+ BKE_id_lib_local_paths(bmain, ob->id.lib, &ob_new->id);
sce= bmain->scene.first;
while(sce) {
@@ -1246,8 +1248,8 @@ void make_local_object(Object *ob)
base= sce->base.first;
while(base) {
if(base->object==ob) {
- base->object= obn;
- obn->id.us++;
+ base->object= ob_new;
+ ob_new->id.us++;
ob->id.us--;
}
base= base->next;
@@ -1442,7 +1444,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
void object_scale_to_mat3(Object *ob, float mat[][3])
{
float vec[3];
- add_v3_v3v3(vec, ob->size, ob->dsize);
+ mul_v3_v3v3(vec, ob->size, ob->dsize);
size_to_mat3( mat,vec);
}
@@ -1604,7 +1606,11 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const
}
sub_v3_v3(ob->loc, ob->dloc);
- sub_v3_v3(ob->size, ob->dsize);
+
+ if (ob->dsize[0] != 0.0f) ob->size[0] /= ob->dsize[0];
+ if (ob->dsize[1] != 0.0f) ob->size[1] /= ob->dsize[1];
+ if (ob->dsize[2] != 0.0f) ob->size[2] /= ob->dsize[2];
+
/* object_mat3_to_rot handles delta rotations */
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index d61541155bf..56d29467ac7 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3645,19 +3645,19 @@ void make_local_particlesettings(ParticleSettings *part)
expand_local_particlesettings(part);
}
else if(is_local && is_lib) {
- ParticleSettings *partn= psys_copy_settings(part);
- partn->id.us= 0;
+ ParticleSettings *part_new= psys_copy_settings(part);
+ part_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &partn->id);
+ BKE_id_lib_local_paths(bmain, part->id.lib, &part_new->id);
/* do objects */
for(ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys;
for(psys= ob->particlesystem.first; psys; psys=psys->next){
if(psys->part==part && ob->id.lib==0) {
- psys->part= partn;
- partn->id.us++;
+ psys->part= part_new;
+ part_new->id.us++;
part->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index a14233e9179..d2c8a8031ee 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -106,19 +106,19 @@ void make_local_speaker(Speaker *spk)
id_clear_lib_data(bmain, &spk->id);
}
else if(is_local && is_lib) {
- Speaker *spkn= copy_speaker(spk);
- spkn->id.us= 0;
+ Speaker *spk_new= copy_speaker(spk);
+ spk_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &spkn->id);
+ BKE_id_lib_local_paths(bmain, spk->id.lib, &spk_new->id);
ob= bmain->object.first;
while(ob) {
if(ob->data==spk) {
if(ob->id.lib==NULL) {
- ob->data= spkn;
- spkn->id.us++;
+ ob->data= spk_new;
+ spk_new->id.us++;
spk->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index a67a61c7638..13205326dd2 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -973,20 +973,20 @@ void make_local_texture(Tex *tex)
extern_local_texture(tex);
}
else if(is_local && is_lib) {
- Tex *texn= copy_texture(tex);
+ Tex *tex_new= copy_texture(tex);
- texn->id.us= 0;
+ tex_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &texn->id);
+ BKE_id_lib_local_paths(bmain, tex->id.lib, &tex_new->id);
ma= bmain->mat.first;
while(ma) {
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
if(ma->id.lib==NULL) {
- ma->mtex[a]->tex= texn;
- texn->id.us++;
+ ma->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -998,8 +998,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a] && la->mtex[a]->tex==tex) {
if(la->id.lib==NULL) {
- la->mtex[a]->tex= texn;
- texn->id.us++;
+ la->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -1011,8 +1011,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
if(wrld->id.lib==NULL) {
- wrld->mtex[a]->tex= texn;
- texn->id.us++;
+ wrld->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -1023,8 +1023,8 @@ void make_local_texture(Tex *tex)
while(br) {
if(br->mtex.tex==tex) {
if(br->id.lib==NULL) {
- br->mtex.tex= texn;
- texn->id.us++;
+ br->mtex.tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -1035,8 +1035,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) {
if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
if(pa->id.lib==NULL) {
- pa->mtex[a]->tex= texn;
- texn->id.us++;
+ pa->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 1d6972b9d61..b3f1e140829 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -190,17 +190,17 @@ void make_local_world(World *wrld)
id_clear_lib_data(bmain, &wrld->id);
}
else if(is_local && is_lib) {
- World *wrldn= copy_world(wrld);
- wrldn->id.us= 0;
+ World *wrld_new= copy_world(wrld);
+ wrld_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &wrldn->id);
+ BKE_id_lib_local_paths(bmain, wrld->id.lib, &wrld_new->id);
for(sce= bmain->scene.first; sce; sce= sce->id.next) {
if(sce->world == wrld) {
if(sce->id.lib==NULL) {
- sce->world= wrldn;
- wrldn->id.us++;
+ sce->world= wrld_new;
+ wrld_new->id.us++;
wrld->id.us--;
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index aa44eca0605..cd07bb30d3a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -12049,7 +12049,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- /* put compatibility code here until next subversion bump */
if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) {
Object *ob;
@@ -12066,8 +12065,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- /* put compatibility code here until next subversion bump */
-
if (main->versionfile < 256) {
bScreen *sc;
ScrArea *sa;
@@ -12686,16 +12683,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- /* put compatibility code here until next subversion bump */
+ if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 6))
{
Scene *sce;
MovieClip *clip;
bScreen *sc;
for(sce = main->scene.first; sce; sce = sce->id.next) {
- if (sce->r.im_format.depth == 0) {
- do_versions_image_settings_2_60(sce);
- }
+ do_versions_image_settings_2_60(sce);
}
for (clip= main->movieclip.first; clip; clip= clip->id.next) {
@@ -12722,6 +12717,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
+
+ {
+ Object *ob;
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ /* convert delta addition into delta scale */
+ int i;
+ for (i= 0; i < 3; i++) {
+ if ( (ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */
+ (ob->size[i] == 0.0f)) /* cant scale the dsize to give a non zero result, so fallback to 1.0f */
+ {
+ ob->dsize[i]= 1.0f;
+ }
+ else {
+ ob->size[i]= (ob->size[i] + ob->dsize[i]) / ob->size[i];
+ }
+ }
+ }
+ }
+ }
+
+ /* put compatibility code here until next subversion bump */
+ {
+ /* nothing! */
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 05537004927..e0ff5cddf85 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -65,6 +65,7 @@ void ED_region_header_init(struct ARegion *ar);
void ED_region_header(const struct bContext *C, struct ARegion *ar);
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
void region_scissor_winrct(struct ARegion *ar, struct rcti *winrct);
+void ED_region_info_draw(struct ARegion *ar, const char *text, int block, float alpha);
/* spaces */
void ED_spacetypes_init(void);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 38b0c2f6d38..1edfa2f4ea6 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -455,6 +455,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
hrect= *rect;
if(dir == 'h') {
hrect.xmin= rect->xmin+pnl_icons;
+ hrect.ymin += 2.0f/block->aspect;
uiStyleFontDraw(&style->paneltitle, &hrect, activename);
}
else {
@@ -519,9 +520,9 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
maxx -= 5.0f/block->aspect;
glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- fdrawline(minx, y+1, maxx, y+1);
- glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
fdrawline(minx, y, maxx, y);
+ glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
+ fdrawline(minx, y-1, maxx, y-1);
glDisable(GL_BLEND);
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 40d52e0b261..2a45a7df735 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -766,7 +766,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
where_is_pose(scene, ob);
}
else if (ob) {
- Object workob = {{NULL}};
+ Object workob;
/* use what_does_parent to find inverse - just like for normal parenting */
what_does_parent(scene, ob, &workob);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index b4fee991bb2..9d8112c323a 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -189,15 +189,15 @@ static void object_clear_scale(Object *ob)
{
/* clear scale factors which are not locked */
if ((ob->protectflag & OB_LOCK_SCALEX)==0) {
- ob->dsize[0]= 0.0f;
+ ob->dsize[0]= 1.0f;
ob->size[0]= 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEY)==0) {
- ob->dsize[1]= 0.0f;
+ ob->dsize[1]= 1.0f;
ob->size[1]= 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEZ)==0) {
- ob->dsize[2]= 0.0f;
+ ob->dsize[2]= 1.0f;
ob->size[2]= 1.0f;
}
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 94328259dc3..6e3fab0385f 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1577,13 +1577,21 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
}
}
else {
- /* dvert should always be the target */
+ /* dvert should always be the target, only swaps pointer */
if(sel_mirr) {
SWAP(MDeformVert *, dvert, dvert_mirr);
}
- if(mirror_weights)
- defvert_copy(dvert, dvert_mirr);
+ if(mirror_weights) {
+ if (all_vgroups) {
+ defvert_copy(dvert, dvert_mirr);
+ }
+ else {
+ defvert_copy_index(dvert, dvert_mirr, act_vgroup);
+ }
+ }
+
+ /* flip map already modified for 'all_vgroups' */
if(flip_vgroups) {
defvert_flip(dvert, flip_map, flip_map_len);
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 3a2d9f137d7..35b21c626ed 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -123,17 +123,6 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
rr= RE_AcquireResultRead(oglrender->re);
- /* note on color management:
- * looked into how best to deal with color management here and found heres how it should work.
- *
- * OpenGL materials etc are color corrected, so a float buffer from the graphics card is
- * color corrected, without running any conversion functions.
- *
- * With color correction disabled blender expects the rr->rectf to be non-color managed so
- * just do a direct copy from the byte array to the rectf with no conversion too.
- * notice IMB_float_from_rect has the profile set so no conversion is done.
- */
-
if(view_context) {
GPU_offscreen_bind(oglrender->ofs); /* bind */
@@ -208,13 +197,32 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
BKE_stamp_buf(scene, camera, NULL, rr->rectf, rr->rectx, rr->recty, 4);
+ /* note on color management:
+ *
+ * OpenGL renders into sRGB colors, but render buffers are expected to be
+ * linear if color management is enabled. So we convert to linear here, so
+ * the conversion back to bytes using the color management flag can make it
+ * sRGB again, and so that e.g. openexr saving also saves the correct linear
+ * float buffer. */
+
+ if(oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
+ float *rctf = rr->rectf;
+ int i;
+
+ for (i = oglrender->sizex * oglrender->sizey; i > 0; i--, rctf+=4) {
+ rctf[0]= srgb_to_linearrgb(rctf[0]);
+ rctf[1]= srgb_to_linearrgb(rctf[1]);
+ rctf[2]= srgb_to_linearrgb(rctf[2]);
+ }
+ }
+
RE_ReleaseResult(oglrender->re);
/* update byte from float buffer */
ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
if(ibuf) {
- image_buffer_rect_update(NULL, rr, ibuf, NULL);
+ image_buffer_rect_update(scene, rr, ibuf, NULL);
if(oglrender->write_still) {
char name[FILE_MAX];
@@ -307,15 +315,18 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->scene->customdata_mask_modal= ED_view3d_datamask(oglrender->scene, oglrender->v3d);
}
+ /* create render */
+ oglrender->re= RE_NewRender(scene->id.name);
+
/* create image and image user */
oglrender->ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
BKE_image_signal(oglrender->ima, NULL, IMA_SIGNAL_FREE);
+ BKE_image_backup_render(oglrender->scene, oglrender->ima);
oglrender->iuser.scene= scene;
oglrender->iuser.ok= 1;
- /* create render and render result */
- oglrender->re= RE_NewRender(scene->id.name);
+ /* create render result */
RE_InitState(oglrender->re, NULL, &scene->r, NULL, sizex, sizey, NULL);
rr= RE_AcquireResultWrite(oglrender->re);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 24c26109502..7aacd9f7b86 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1596,7 +1596,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
if(pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
/* for enabled buttons */
panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
- triangle, UI_UNIT_Y+style->panelspace, UI_UNIT_Y, 1, style);
+ triangle, UI_UNIT_Y+style->panelspace+2, UI_UNIT_Y, 1, style);
pt->draw_header(C, panel);
@@ -1776,3 +1776,38 @@ int ED_area_headersize(void)
{
return UI_UNIT_Y+6;
}
+
+void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
+{
+ const int header_height = 18;
+ uiStyle *style= UI_GetStyle();
+ int fontid= style->widget.uifont_id;
+ rcti rect;
+
+ BLF_size(fontid, 11.0f, 72);
+
+ /* background box */
+ rect= ar->winrct;
+ rect.xmin= 0;
+ rect.ymin= ar->winrct.ymax - ar->winrct.ymin - header_height;
+
+ if(block) {
+ rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
+ }
+ else {
+ rect.xmax= rect.xmin + BLF_width(fontid, text) + 24;
+ }
+
+ rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f(0.0f, 0.0f, 0.0f, alpha);
+ glRecti(rect.xmin, rect.ymin, rect.xmax+1, rect.ymax+1);
+ glDisable(GL_BLEND);
+
+ /* text */
+ UI_ThemeColor(TH_TEXT_HI);
+ BLF_position(fontid, 12, rect.ymin + 5, 0.0f);
+ BLF_draw(fontid, text, strlen(text));
+}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index a53da4ce006..3f9ec3f3c82 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -204,29 +204,8 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
strcpy(str, "Locked");
}
- if(str[0]) {
- uiStyle *style= UI_GetStyle();
- int fontid= style->widget.uifont_id;
- int fontwidth;
-
- BLF_size(fontid, 11.0f, 72);
-
- if(block)
- fontwidth= ar->winx;
- else
- fontwidth= BLF_width(fontid, str);
-
- glEnable(GL_BLEND);
-
- glColor4f(0.0f, 0.0f, 0.0f, 0.6f);
- glRecti(0, ar->winy-17, fontwidth+12, ar->winy);
-
- glColor3f(1.0f, 1.0f, 1.0f);
- BLF_position(fontid, 6.0f, ar->winy-13.0f, 0.0f);
- BLF_draw(fontid, str, strlen(str));
-
- glDisable(GL_BLEND);
- }
+ if(str[0])
+ ED_region_info_draw(ar, str, block, 0.6f);
}
static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 77ac577792c..dc712e286a1 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -63,6 +63,7 @@
#include "ED_gpencil.h"
#include "ED_image.h"
+#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -99,29 +100,11 @@ static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage)
static void draw_render_info(Scene *scene, Image *ima, ARegion *ar)
{
RenderResult *rr;
- rcti rect;
- float colf[3];
rr= BKE_image_acquire_renderresult(scene, ima);
if(rr && rr->text) {
- rect= ar->winrct;
- rect.xmin= 0;
- rect.ymin= ar->winrct.ymax - ar->winrct.ymin - HEADER_HEIGHT;
- rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
- rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
-
- /* clear header rect */
- UI_GetThemeColor3fv(TH_BACK, colf);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glColor4f(colf[0]+0.1f, colf[1]+0.1f, colf[2]+0.1f, 0.5f);
- glRecti(rect.xmin, rect.ymin, rect.xmax, rect.ymax+1);
- glDisable(GL_BLEND);
-
- UI_ThemeColor(TH_TEXT_HI);
-
- UI_DrawString(12, rect.ymin + 5, rr->text);
+ ED_region_info_draw(ar, rr->text, 1, 0.25);
}
BKE_image_release_renderresult(scene, ima);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 4e9ac08d8c8..bd5292e5154 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2595,18 +2595,32 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
glEnd();
}
- UI_ThemeColor(th_col1);
+ /* XXX using GL_LINES for shaded node lines is a workaround
+ * for Intel hardware, this breaks with GL_LINE_STRIP and
+ * changing color in begin/end blocks.
+ */
glLineWidth(1.5f);
-
- glBegin(GL_LINE_STRIP);
- for(i=0; i<=LINK_RESOL; i++) {
- if(do_shaded) {
+ if(do_shaded) {
+ glBegin(GL_LINES);
+ for(i=0; i<LINK_RESOL; i++) {
UI_ThemeColorBlend(th_col1, th_col2, spline_step);
+ glVertex2fv(coord_array[i]);
+
+ UI_ThemeColorBlend(th_col1, th_col2, spline_step+dist);
+ glVertex2fv(coord_array[i+1]);
+
spline_step += dist;
}
- glVertex2fv(coord_array[i]);
+ glEnd();
+ }
+ else {
+ UI_ThemeColor(th_col1);
+ glBegin(GL_LINE_STRIP);
+ for(i=0; i<=LINK_RESOL; i++) {
+ glVertex2fv(coord_array[i]);
+ }
+ glEnd();
}
- glEnd();
glDisable(GL_LINE_SMOOTH);
@@ -2663,14 +2677,31 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
UI_ThemeColor(th_col1);
glLineWidth(1.5f);
- glBegin(GL_LINE_STRIP);
- for (i=0; i < LINK_RESOL; ++i) {
- float t= (float)i/(float)(LINK_RESOL-1);
- if(do_shaded)
+ /* XXX using GL_LINES for shaded node lines is a workaround
+ * for Intel hardware, this breaks with GL_LINE_STRIP and
+ * changing color in begin/end blocks.
+ */
+ if(do_shaded) {
+ glBegin(GL_LINES);
+ for (i=0; i < LINK_RESOL-1; ++i) {
+ float t= (float)i/(float)(LINK_RESOL-1);
UI_ThemeColorBlend(th_col1, th_col2, t);
- glVertex2f((1.0f-t)*coord_array[0][0]+t*coord_array[1][0], (1.0f-t)*coord_array[0][1]+t*coord_array[1][1]);
+ glVertex2f((1.0f-t)*coord_array[0][0]+t*coord_array[1][0], (1.0f-t)*coord_array[0][1]+t*coord_array[1][1]);
+
+ t= (float)(i+1)/(float)(LINK_RESOL-1);
+ UI_ThemeColorBlend(th_col1, th_col2, t);
+ glVertex2f((1.0f-t)*coord_array[0][0]+t*coord_array[1][0], (1.0f-t)*coord_array[0][1]+t*coord_array[1][1]);
+ }
+ glEnd();
+ }
+ else {
+ glBegin(GL_LINE_STRIP);
+ for (i=0; i < LINK_RESOL; ++i) {
+ float t= (float)i/(float)(LINK_RESOL-1);
+ glVertex2f((1.0f-t)*coord_array[0][0]+t*coord_array[1][0], (1.0f-t)*coord_array[0][1]+t*coord_array[1][1]);
+ }
+ glEnd();
}
- glEnd();
glDisable(GL_LINE_SMOOTH);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index f4e46d0255d..09a125692d2 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -307,10 +307,15 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
}
}
-static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
if (tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
- id_clear_lib_data(NULL, tselem->id);
+ /* if the ID type has no special local function,
+ * just clear the lib */
+ if (id_make_local(tselem->id, FALSE) == FALSE) {
+ Main *bmain= CTX_data_main(C);
+ id_clear_lib_data(bmain, tselem->id);
+ }
}
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 5dfb9cfb5b6..3f979787a1f 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1506,6 +1506,10 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
(bgpic->view & (1<<rv3d->view)) || /* check agaist flags */
(rv3d->persp==RV3D_CAMOB && bgpic->view == (1<<RV3D_VIEW_CAMERA))
) {
+ /* disable individual images */
+ if((bgpic->flag&V3D_BGPIC_DISABLED))
+ continue;
+
freeibuf= NULL;
if(bgpic->source==V3D_BGPIC_IMAGE) {
ima= bgpic->ima;
@@ -2643,28 +2647,10 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar)
{
- rcti rect;
- const int header_height = 18;
-
if(!rv3d->render_engine || !rv3d->render_engine->text)
return;
-
- /* background box */
- rect= ar->winrct;
- rect.xmin= 0;
- rect.ymin= ar->winrct.ymax - ar->winrct.ymin - header_height;
- rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
- rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glColor4f(0.0f, 0.0f, 0.0f, 0.25f);
- glRecti(rect.xmin, rect.ymin, rect.xmax+1, rect.ymax+1);
- glDisable(GL_BLEND);
-
- /* text */
- UI_ThemeColor(TH_TEXT_HI);
- UI_DrawString(12, rect.ymin + 5, rv3d->render_engine->text);
+ ED_region_info_draw(ar, rv3d->render_engine->text, 1, 0.25);
}
/* warning: this function has duplicate drawing in ED_view3d_draw_offscreen() */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 93f4b209712..50136fdcc99 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -308,6 +308,7 @@ typedef struct View3D {
/* may want to use 1 for select ?*/
#define V3D_BGPIC_EXPANDED 2
#define V3D_BGPIC_CAMERACLIP 4
+#define V3D_BGPIC_DISABLED 8
/* BGPic->source */
/* may want to use 1 for select ?*/
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 495a83f4bbe..f0a008b4939 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1234,7 +1234,7 @@ static void rna_def_background_image(BlenderRNA *brna)
static EnumPropertyItem bgpic_source_items[] = {
{V3D_BGPIC_IMAGE, "IMAGE", 0, "Image", ""},
- {V3D_BGPIC_MOVIE, "MOVIE", 0, "Movie", ""},
+ {V3D_BGPIC_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1311,6 +1311,11 @@ static void rna_def_background_image(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_CAMERACLIP);
RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_BGPIC_DISABLED);
+ RNA_def_property_ui_text(prop, "Show Background Image", "Show this image as background");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
}
static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
@@ -2612,6 +2617,12 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
prop= RNA_def_property(srna, "active_operator", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "op");
RNA_def_property_ui_text(prop, "Active Operator", "");
+
+ /* keep this for compatibility with existing presets,
+ not exposed in c++ api because of keyword conflict */
+ prop= RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "op");
+ RNA_def_property_ui_text(prop, "Active Operator", "");
}
static void rna_def_space_info(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index c2a9ae7555d..e206000f41d 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -240,51 +240,6 @@ static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float we
dv->totweight++;
}
-/* Removes the given vertex from the vertex group, specified either by its defgrp_idx,
- * or directly by its MDeformWeight pointer, if dw is not NULL.
- * WARNING: This function frees the given MDeformWeight, do not use it afterward! */
-static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw)
-{
- /* TODO, move this into deform.c as a generic function. */
- MDeformWeight *newdw;
- int i;
-
- /* Get index of removed MDeformWeight. */
- if(dw == NULL) {
- dw = dv->dw;
- for (i = dv->totweight; i > 0; i--, dw++) {
- if (dw->def_nr == defgrp_idx)
- break;
- }
- i--;
- }
- else {
- i = dw - dv->dw;
- /* Security check! */
- if(i < 0 || i >= dv->totweight)
- return;
- }
-
- dv->totweight--;
- /* If there are still other deform weights attached to this vert then remove
- * this deform weight, and reshuffle the others.
- */
- if(dv->totweight) {
- newdw = MEM_mallocN(sizeof(MDeformWeight)*(dv->totweight), "defvert_remove_from_group, new deformWeight");
- if(dv->dw){
- memcpy(newdw, dv->dw, sizeof(MDeformWeight)*i);
- memcpy(newdw+i, dv->dw+i+1, sizeof(MDeformWeight)*(dv->totweight-i));
- MEM_freeN(dv->dw);
- }
- dv->dw = newdw;
- }
- /* If there are no other deform weights left then just remove this one. */
- else {
- MEM_freeN(dv->dw);
- dv->dw = NULL;
- }
-}
-
/* Applies weights to given vgroup (defgroup), and optionnaly add/remove vertices from the group.
* If dws is not NULL, it must be an array of MDeformWeight pointers of same length as weights (and
@@ -309,7 +264,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
/* If the vertex is in this vgroup, remove it if needed, or just update it. */
if(dw != NULL) {
if(do_rem && w < rem_thresh) {
- defvert_remove_from_group(dv, defgrp_idx, dw);
+ defvert_remove_index(dv, defgrp_idx, dw);
}
else {
dw->weight = w;
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index d7c7a1e846f..a6426a02e18 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -265,8 +265,8 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
/* create a dummy */
self_from= PyObject_New(BPy_Library, &bpy_lib_Type);
- BLI_strncpy(self_from->relpath, self->relpath, sizeof(BPy_Library));
- BLI_strncpy(self_from->abspath, self->abspath, sizeof(BPy_Library));
+ BLI_strncpy(self_from->relpath, self->relpath, sizeof(self_from->relpath));
+ BLI_strncpy(self_from->abspath, self->abspath, sizeof(self_from->abspath));
self_from->blo_handle= NULL;
self_from->flag= 0;
@@ -396,6 +396,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
return NULL;
}
else {
+ Library *lib= mainl->curlib; /* newly added lib, assign before append end */
BLO_library_append_end(NULL, mainl, &(self->blo_handle), 0, self->flag);
BLO_blendhandle_close(self->blo_handle);
self->blo_handle= NULL;
@@ -406,9 +407,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
/* append, rather than linking */
if ((self->flag & FILE_LINK)==0) {
- Library *lib= BLI_findstring(&G.main->library, self->abspath, offsetof(Library, name));
- if (lib) BKE_library_make_local(bmain, lib, 1);
- else BLI_assert(!"cant find name of just added library!");
+ BKE_library_make_local(bmain, lib, 1);
}
}
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 39ad80169d2..c0d796669d6 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -233,7 +233,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
static int bpy_prop_callback_check(PyObject *py_func, int argcount)
{
- if (py_func) {
+ if (py_func && py_func != Py_None) {
if (!PyFunction_Check(py_func)) {
PyErr_Format(PyExc_TypeError,
"update keyword: expected a function type, not a %.200s",
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index f0fe69259fe..121c5e26e73 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -39,7 +39,9 @@
PyDoc_STRVAR(M_Mathutils_doc,
"This module provides access to matrices, eulers, quaternions and vectors."
);
-static int mathutils_array_parse_fast(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
+static int mathutils_array_parse_fast(float *array,
+ int array_min, int array_max,
+ PyObject *value, const char *error_prefix)
{
PyObject *value_fast= NULL;
PyObject *item;
@@ -72,7 +74,9 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max
i= size;
do {
i--;
- if (((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
+ if ( ((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
+ PyErr_Occurred())
+ {
PyErr_Format(PyExc_TypeError,
"%.200s: sequence index %d expected a number, "
"found '%.200s' type, ",
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index b50535bd709..a8170b8145c 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -40,16 +40,18 @@
extern char BaseMathObject_Wrapped_doc[];
extern char BaseMathObject_Owner_doc[];
-#define BASE_MATH_MEMBERS(_data) \
- PyObject_VAR_HEAD \
- float *_data; /* array of data (alias), wrapped status depends on wrapped status */ \
- PyObject *cb_user; /* if this vector references another object, otherwise NULL, *Note* this owns its reference */ \
- unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */ \
- unsigned char cb_subtype; /* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */ \
- unsigned char wrapped; /* wrapped data type? */ \
+#define BASE_MATH_MEMBERS(_data) \
+ PyObject_VAR_HEAD \
+ float *_data; /* array of data (alias), wrapped status depends on wrapped status */ \
+ PyObject *cb_user; /* if this vector references another object, otherwise NULL, \
+ * *Note* this owns its reference */ \
+ unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */ \
+ unsigned char cb_subtype; /* subtype: location, rotation... \
+ * to avoid defining many new functions for every attribute of the same type */ \
+ unsigned char wrapped /* wrapped data type? */ \
typedef struct {
- BASE_MATH_MEMBERS(data)
+ BASE_MATH_MEMBERS(data);
} BaseMathObject;
/* types */
@@ -80,11 +82,11 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
typedef struct Mathutils_Callback Mathutils_Callback;
-typedef int (*BaseMathCheckFunc)(BaseMathObject *); /* checks the user is still valid */
-typedef int (*BaseMathGetFunc)(BaseMathObject *, int); /* gets the vector from the user */
-typedef int (*BaseMathSetFunc)(BaseMathObject *, int); /* sets the users vector values once the vector is modified */
-typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, int); /* same as above but only for an index */
-typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, int); /* same as above but only for an index */
+typedef int (*BaseMathCheckFunc)(BaseMathObject *); /* checks the user is still valid */
+typedef int (*BaseMathGetFunc)(BaseMathObject *, int); /* gets the vector from the user */
+typedef int (*BaseMathSetFunc)(BaseMathObject *, int); /* sets the users vector values once its modified */
+typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, int); /* same as above but only for an index */
+typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, int); /* same as above but only for an index */
struct Mathutils_Callback {
BaseMathCheckFunc check;
@@ -102,10 +104,14 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index);
int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index);
/* since this is called so often avoid where possible */
-#define BaseMath_ReadCallback(_self) (((_self)->cb_user ? _BaseMathObject_ReadCallback((BaseMathObject *)_self):0))
-#define BaseMath_WriteCallback(_self) (((_self)->cb_user ?_BaseMathObject_WriteCallback((BaseMathObject *)_self):0))
-#define BaseMath_ReadIndexCallback(_self, _index) (((_self)->cb_user ? _BaseMathObject_ReadIndexCallback((BaseMathObject *)_self, _index):0))
-#define BaseMath_WriteIndexCallback(_self, _index) (((_self)->cb_user ? _BaseMathObject_WriteIndexCallback((BaseMathObject *)_self, _index):0))
+#define BaseMath_ReadCallback(_self) \
+ (((_self)->cb_user ? _BaseMathObject_ReadCallback((BaseMathObject *)_self):0))
+#define BaseMath_WriteCallback(_self) \
+ (((_self)->cb_user ?_BaseMathObject_WriteCallback((BaseMathObject *)_self):0))
+#define BaseMath_ReadIndexCallback(_self, _index) \
+ (((_self)->cb_user ? _BaseMathObject_ReadIndexCallback((BaseMathObject *)_self, _index):0))
+#define BaseMath_WriteIndexCallback(_self, _index) \
+ (((_self)->cb_user ? _BaseMathObject_WriteIndexCallback((BaseMathObject *)_self, _index):0))
/* utility func */
int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix);
diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h
index f218d653ec9..7e8a99089ad 100644
--- a/source/blender/python/mathutils/mathutils_Color.h
+++ b/source/blender/python/mathutils/mathutils_Color.h
@@ -39,7 +39,7 @@ extern PyTypeObject color_Type;
#define ColorObject_Check(_v) PyObject_TypeCheck((_v), &color_Type)
typedef struct {
- BASE_MATH_MEMBERS(col)
+ BASE_MATH_MEMBERS(col);
} ColorObject;
/*struct data contains a pointer to the actual data that the
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 9bf6687fb5e..7e769da14cb 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -264,8 +264,11 @@ static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value, "euler.make_compatible(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value,
+ "euler.make_compatible(other), invalid 'other' arg") == -1)
+ {
return NULL;
+ }
compatible_eul(self->eul, teul);
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index 5760d08e1f6..130384a1792 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -39,7 +39,7 @@ extern PyTypeObject euler_Type;
#define EulerObject_Check(_v) PyObject_TypeCheck((_v), &euler_Type)
typedef struct {
- BASE_MATH_MEMBERS(eul)
+ BASE_MATH_MEMBERS(eul);
unsigned char order; /* rotation order */
} EulerObject;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 2f62f7141cf..ea636ef52fb 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -125,7 +125,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
switch(PyTuple_GET_SIZE(args)) {
case 0:
- return (PyObject *) Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type);
+ return Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type);
case 1:
{
PyObject *arg= PyTuple_GET_ITEM(args, 0);
@@ -478,7 +478,9 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
int vec_size= (matSize == 2 ? 2 : 3);
float tvec[4];
- if (mathutils_array_parse(tvec, vec_size, vec_size, axis, "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1) {
+ if (mathutils_array_parse(tvec, vec_size, vec_size, axis,
+ "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1)
+ {
return NULL;
}
@@ -827,12 +829,12 @@ static PyObject *Matrix_to_4x4(MatrixObject *self)
return NULL;
if (self->col_size==4 && self->row_size==4) {
- return (PyObject *)Matrix_CreatePyObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
+ return Matrix_CreatePyObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
}
else if (self->col_size==3 && self->row_size==3) {
float mat[4][4];
copy_m4_m3(mat, (float (*)[3])self->contigPtr);
- return (PyObject *)Matrix_CreatePyObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
+ return Matrix_CreatePyObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
}
/* TODO, 2x2 matrix */
@@ -1133,7 +1135,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
return NULL;
}
- return (PyObject*)Matrix_CreatePyObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
+ return Matrix_CreatePyObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
}
/*---------------------------matrix.determinant() ----------------*/
@@ -1286,7 +1288,7 @@ static PyObject *Matrix_copy(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- return (PyObject*)Matrix_CreatePyObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
+ return Matrix_CreatePyObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
}
/*----------------------------print object (internal)-------------*/
@@ -1470,7 +1472,9 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
/*parse each sub sequence*/
PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i);
- if (mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item, "matrix[begin:end] = value assignment") < 0) {
+ if (mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item,
+ "matrix[begin:end] = value assignment") < 0)
+ {
return -1;
}
}
@@ -1956,7 +1960,9 @@ self->matrix[1][1] = self->contigPtr[4] */
(i.e. it was allocated elsewhere by MEM_mallocN())
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
(i.e. it must be created here with PyMEM_malloc())*/
-PyObject *Matrix_CreatePyObject(float *mat, const unsigned short rowSize, const unsigned short colSize, int type, PyTypeObject *base_type)
+PyObject *Matrix_CreatePyObject(float *mat,
+ const unsigned short rowSize, const unsigned short colSize,
+ int type, PyTypeObject *base_type)
{
MatrixObject *self;
int x, row, col;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index d1984d7299d..6dfcbb1faf9 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -39,7 +39,7 @@ extern PyTypeObject matrix_Type;
#define MATRIX_MAX_DIM 4
typedef struct {
- BASE_MATH_MEMBERS(contigPtr)
+ BASE_MATH_MEMBERS(contigPtr);
float *matrix[MATRIX_MAX_DIM]; /* ptr to the contigPtr (accessor) */
unsigned short row_size;
unsigned short col_size;
@@ -51,7 +51,9 @@ be stored in py_data) or be a wrapper for data allocated through
blender (stored in blend_data). This is an either/or struct not both*/
/*prototypes*/
-PyObject *Matrix_CreatePyObject(float *mat, const unsigned short row_size, const unsigned short col_size, int type, PyTypeObject *base_type);
+PyObject *Matrix_CreatePyObject(float *mat,
+ const unsigned short row_size, const unsigned short col_size,
+ int type, PyTypeObject *base_type);
PyObject *Matrix_CreatePyObject_cb(PyObject *user, int row_size, int col_size, int cb_type, int cb_subtype);
extern int mathutils_matrix_vector_cb_index;
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 44cd28a7c3d..cf817003a98 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -218,8 +218,11 @@ static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
+ "Quaternion.dot(other), invalid 'other' arg") == -1)
+ {
return NULL;
+ }
return PyFloat_FromDouble(dot_qtqt(self->quat, tquat));
}
@@ -241,8 +244,11 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.difference(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
+ "Quaternion.difference(other), invalid 'other' arg") == -1)
+ {
return NULL;
+ }
rotation_between_quats_to_quat(quat, self->quat, tquat);
@@ -276,8 +282,11 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.slerp(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
+ "Quaternion.slerp(other), invalid 'other' arg") == -1)
+ {
return NULL;
+ }
if (fac > 1.0f || fac < 0.0f) {
PyErr_SetString(PyExc_ValueError,
@@ -982,7 +991,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos
quat__axis_angle_sanitize(axis, NULL);
- return (PyObject *) Vector_CreatePyObject(axis, 3, Py_NEW, NULL);
+ return Vector_CreatePyObject(axis, 3, Py_NEW, NULL);
}
static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
@@ -1054,7 +1063,7 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec
PyObject *ret_dummy= quat_func(ret);
if (ret_dummy) {
Py_DECREF(ret_dummy);
- return (PyObject *)ret;
+ return ret;
}
else { /* error */
Py_DECREF(ret);
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h
index a34720769fa..edd5ec55312 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.h
+++ b/source/blender/python/mathutils/mathutils_Quaternion.h
@@ -39,7 +39,7 @@ extern PyTypeObject quaternion_Type;
#define QuaternionObject_Check(_v) PyObject_TypeCheck((_v), &quaternion_Type)
typedef struct {
- BASE_MATH_MEMBERS(quat)
+ BASE_MATH_MEMBERS(quat);
} QuaternionObject;
/*struct data contains a pointer to the actual data that the
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 1dff33887e3..9d1a22adb12 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -589,10 +589,10 @@ PyDoc_STRVAR(Vector_angle_doc,
);
static PyObject *Vector_angle(VectorObject *self, PyObject *args)
{
- const int size= self->size;
+ const int size= MIN2(self->size, 3); /* 4D angle makes no sense */
float tvec[MAX_DIMENSIONS];
PyObject *value;
- double dot = 0.0f, test_v1 = 0.0f, test_v2 = 0.0f;
+ double dot= 0.0f, dot_self= 0.0f, dot_other= 0.0f;
int x;
PyObject *fallback= NULL;
@@ -602,14 +602,18 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (mathutils_array_parse(tvec, size, size, value, "Vector.angle(other), invalid 'other' arg") == -1)
+ /* don't use clamped size, rule of thumb is vector sizes must match,
+ * even though n this case 'w' is ignored */
+ if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.angle(other), invalid 'other' arg") == -1)
return NULL;
for (x = 0; x < size; x++) {
- test_v1 += (double)(self->vec[x] * self->vec[x]);
- test_v2 += (double)(tvec[x] * tvec[x]);
+ dot_self += (double)self->vec[x] * (double)self->vec[x];
+ dot_other += (double)tvec[x] * (double)tvec[x];
+ dot += (double)self->vec[x] * (double)tvec[x];
}
- if (!test_v1 || !test_v2) {
+
+ if (!dot_self || !dot_other) {
/* avoid exception */
if (fallback) {
Py_INCREF(fallback);
@@ -623,13 +627,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
}
}
- //dot product
- for (x = 0; x < self->size; x++) {
- dot += (double)(self->vec[x] * tvec[x]);
- }
- dot /= (sqrt(test_v1) * sqrt(test_v2));
-
- return PyFloat_FromDouble(saacos(dot));
+ return PyFloat_FromDouble(saacos(dot / (sqrt(dot_self) * sqrt(dot_other))));
}
PyDoc_STRVAR(Vector_rotation_difference_doc,
@@ -1755,7 +1753,10 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
size_from= axis_from;
}
- else if (PyErr_Clear(), (size_from=mathutils_array_parse(vec_assign, 2, 4, value, "mathutils.Vector.**** = swizzle assignment")) == -1) {
+ else if ( (PyErr_Clear()), /* run but ignore the result */
+ (size_from=mathutils_array_parse(vec_assign, 2, 4, value,
+ "mathutils.Vector.**** = swizzle assignment")) == -1)
+ {
return -1;
}
diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h
index c1550aabb25..0f7fa174d18 100644
--- a/source/blender/python/mathutils/mathutils_Vector.h
+++ b/source/blender/python/mathutils/mathutils_Vector.h
@@ -39,7 +39,7 @@ extern PyTypeObject vector_Type;
#define VectorObject_Check(_v) PyObject_TypeCheck((_v), &vector_Type)
typedef struct {
- BASE_MATH_MEMBERS(vec)
+ BASE_MATH_MEMBERS(vec);
unsigned char size; /* vec size 2,3 or 4 */
} VectorObject;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index e6e098ce0ce..95c40508e86 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -2391,7 +2391,7 @@ static void do_displacement(Render *re, ObjectRen *obr, float mat[][4], float im
/* Object Size with parenting */
obt=obr->ob;
while(obt){
- add_v3_v3v3(temp, obt->size, obt->dsize);
+ mul_v3_v3v3(temp, obt->size, obt->dsize);
scale[0]*=temp[0]; scale[1]*=temp[1]; scale[2]*=temp[2];
obt=obt->parent;
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 26f59189e47..fa6521b3ec0 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1289,7 +1289,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemL(col, "Links", ICON_NONE);
uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
- uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-260");
+ uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-261");
uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual");
uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 7699e86f19f..2f5125a63dd 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -765,7 +765,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
{
KX_GameObject* gameObj = (KX_GameObject*)parentList->GetValue(g);
Object* blenderObject = gameObj->GetBlenderObject();
- if (blenderObject && blenderObject->parent==NULL && gameObj->GetPhysicsController() != NULL)
+ if (blenderObject && blenderObject->parent==NULL && gameObj->IsDynamic())
{
//KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();