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:
authorCampbell Barton <ideasman42@gmail.com>2011-12-23 12:41:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-23 12:41:53 +0400
commit4ced91da47ec1e95d71beef07b218fd0290ff68a (patch)
tree5f96c6268e194dd4cabcbe33efdc2fd226652cab /source/blender
parent87a34772003413bd402ea380ce5d8d7c3f3a6337 (diff)
parentac498a6b64ea2f034aa0177894fb25d0401e327b (diff)
svn merge ^/trunk/blender -r42778:42839
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/BLF_translation.h5
-rw-r--r--source/blender/blenfont/intern/blf_lang.c20
-rw-r--r--source/blender/blenfont/intern/blf_translation.c45
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c15
-rw-r--r--source/blender/blenkernel/intern/fcurve.c5
-rw-r--r--source/blender/blenkernel/intern/idprop.c6
-rw-r--r--source/blender/blenkernel/intern/ipo.c9
-rw-r--r--source/blender/blenkernel/intern/movieclip.c9
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c3
-rw-r--r--source/blender/blenkernel/intern/tracking.c4
-rw-r--r--source/blender/blenkernel/intern/unit.c10
-rw-r--r--source/blender/blenlib/BLI_md5.h45
-rw-r--r--source/blender/blenlib/CMakeLists.txt2
-rw-r--r--source/blender/blenlib/intern/md5.c (renamed from source/blender/imbuf/intern/md5.c)102
-rw-r--r--source/blender/blenlib/intern/path_util.c8
-rw-r--r--source/blender/blenloader/CMakeLists.txt1
-rw-r--r--source/blender/blenloader/SConscript2
-rw-r--r--source/blender/blenloader/intern/readfile.c33
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c2
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_handlers.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c15
-rw-r--r--source/blender/editors/interface/interface_widgets.c8
-rw-r--r--source/blender/editors/object/object_edit.c48
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_modifier.c13
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c15
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c36
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c13
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c6
-rw-r--r--source/blender/editors/space_view3d/drawobject.c84
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/editors/transform/transform_conversions.c34
-rw-r--r--source/blender/editors/transform/transform_snap.c7
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c20
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h3
-rw-r--r--source/blender/gpu/intern/gpu_draw.c2
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c17
-rw-r--r--source/blender/gpu/intern/gpu_material.c1
-rw-r--r--source/blender/imbuf/CMakeLists.txt2
-rw-r--r--source/blender/imbuf/intern/md5.h119
-rw-r--r--source/blender/imbuf/intern/thumbs.c9
-rw-r--r--source/blender/makesdna/DNA_genfile.h20
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h3
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c160
-rw-r--r--source/blender/makesdna/intern/makesdna.c22
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/intern/makesrna.c1
-rw-r--r--source/blender/makesrna/intern/rna_access.c59
-rw-r--r--source/blender/makesrna/intern/rna_define.c5
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_material.c4
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c5
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c1
-rw-r--r--source/blender/makesrna/intern/rna_rna.c19
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c47
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c31
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c3
-rw-r--r--source/blender/python/generic/bgl.c1
-rw-r--r--source/blender/python/intern/bpy_rna_array.c69
-rw-r--r--source/blender/python/intern/gpu.c16
-rw-r--r--source/blender/python/mathutils/mathutils.c1
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c279
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c28
-rw-r--r--source/blender/render/intern/raytrace/rayobject_octree.cpp2
-rw-r--r--source/blender/render/intern/source/convertblender.c10
-rw-r--r--source/blender/render/intern/source/pixelshading.c1
-rw-r--r--source/blender/render/intern/source/rayshade.c2
-rw-r--r--source/blender/render/intern/source/renderdatabase.c6
-rw-r--r--source/blender/render/intern/source/shadeoutput.c2
-rw-r--r--source/blender/render/intern/source/strand.c1
-rw-r--r--source/blender/render/intern/source/volumetric.c4
77 files changed, 1089 insertions, 524 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index ddbc9a6a760..ce53b76da01 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -33,6 +33,8 @@
#ifndef BLF_TRANSLATION_H
#define BLF_TRANSLATION_H
+#define TEXT_DOMAIN_NAME "blender"
+
/* blf_translation.c */
#ifdef WITH_INTERNATIONAL
@@ -40,7 +42,8 @@ unsigned char *BLF_get_unifont(int *unifont_size);
void BLF_free_unifont(void);
#endif
-const char* BLF_gettext(const char *msgid);
+const char *BLF_gettext(const char *msgid);
+const char *BLF_pgettext(const char *context, const char *message);
/* blf_lang.c */
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 2ba23e501b4..71e4fba94f6 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -58,7 +58,6 @@
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
-#define DOMAIN_NAME "blender"
#define SYSTEM_ENCODING_DEFAULT "UTF-8"
#define FONT_SIZE_DEFAULT 12
@@ -86,7 +85,7 @@ static const char *locales[] = {
"Chinese (Traditional)_China.1252", "zh_TW",
"russian", "ru_RU",
"croatian", "hr_HR",
- "serbian", "sr_RS",
+ "serbian", "sr",
"ukrainian", "uk_UA",
"polish", "pl_PL",
"romanian", "ro_RO",
@@ -96,7 +95,8 @@ static const char *locales[] = {
"korean", "ko_KR",
"nepali", "ne_NP",
"persian", "fa_PE",
- "indonesian", "id_ID"
+ "indonesian", "id_ID",
+ "serbian (latin)", "sr@latin",
};
void BLF_lang_init(void)
@@ -189,6 +189,12 @@ void BLF_lang_set(const char *str)
if (locreturn == NULL) {
printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
+
+ /* fallback to default settings */
+ locreturn= setlocale(LC_ALL, "");
+ BLI_setenv("LANG", default_locale);
+ BLI_setenv("LANGUAGE", default_locale);
+
ok= 0;
}
@@ -204,15 +210,15 @@ void BLF_lang_set(const char *str)
setlocale(LC_NUMERIC, "C");
- textdomain(DOMAIN_NAME);
- bindtextdomain(DOMAIN_NAME, global_messagepath);
- bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name);
+ textdomain(TEXT_DOMAIN_NAME);
+ bindtextdomain(TEXT_DOMAIN_NAME, global_messagepath);
+ bind_textdomain_codeset(TEXT_DOMAIN_NAME, global_encoding_name);
}
void BLF_lang_encoding(const char *str)
{
BLI_strncpy(global_encoding_name, str, sizeof(global_encoding_name));
- /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */
+ /* bind_textdomain_codeset(TEXT_DOMAIN_NAME, encoding_name); */
}
#else /* ! WITH_INTERNATIONAL */
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index fe14f5d4d1c..1d82abcf32d 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -29,9 +29,19 @@
*/
#include <stdlib.h>
+#include <string.h>
#ifdef WITH_INTERNATIONAL
#include <libintl.h>
+#include <locale.h>
+
+#define GETTEXT_CONTEXT_GLUE "\004"
+
+/* needed for windows version of gettext */
+#ifndef LC_MESSAGES
+# define LC_MESSAGES 1729
+#endif
+
#endif
#include "MEM_guardedalloc.h"
@@ -91,6 +101,40 @@ const char* BLF_gettext(const char *msgid)
#endif
}
+const char *BLF_pgettext(const char *context, const char *message)
+{
+#ifdef WITH_INTERNATIONAL
+ char static_msg_ctxt_id[1024];
+ char *dynamic_msg_ctxt_id = NULL;
+ char *msg_ctxt_id;
+ const char *translation;
+
+ size_t overall_length = strlen(context) + strlen(message) + sizeof(GETTEXT_CONTEXT_GLUE) + 1;
+
+ if (overall_length > sizeof(static_msg_ctxt_id)) {
+ dynamic_msg_ctxt_id = malloc(overall_length);
+ msg_ctxt_id = dynamic_msg_ctxt_id;
+ }
+ else {
+ msg_ctxt_id = static_msg_ctxt_id;
+ }
+
+ sprintf(msg_ctxt_id, "%s%s%s", context, GETTEXT_CONTEXT_GLUE, message);
+
+ translation = (char*)dcgettext(TEXT_DOMAIN_NAME, msg_ctxt_id, LC_MESSAGES);
+
+ if (dynamic_msg_ctxt_id)
+ free(dynamic_msg_ctxt_id);
+
+ if (translation == msg_ctxt_id)
+ translation = message;
+
+ return translation;
+#else
+ return message;
+#endif
+}
+
int BLF_translate_iface(void)
{
#ifdef WITH_INTERNATIONAL
@@ -132,4 +176,3 @@ const char *BLF_translate_do_tooltip(const char *msgid)
return msgid;
#endif
}
-
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 4eaf49dc679..e17566b7d55 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1704,7 +1704,7 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
/* sort the base list on dependency order */
void DAG_scene_sort(Main *bmain, Scene *sce)
{
- DagNode *node;
+ DagNode *node, *rootnode;
DagNodeQueue *nqueue;
DagAdjList *itA;
int time;
@@ -1726,11 +1726,10 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
time = 1;
- node = sce->theDag->DagNode.first;
-
- node->color = DAG_GRAY;
+ rootnode = sce->theDag->DagNode.first;
+ rootnode->color = DAG_GRAY;
time++;
- push_stack(nqueue,node);
+ push_stack(nqueue,rootnode);
while(nqueue->count) {
@@ -2848,10 +2847,8 @@ void DAG_pose_sort(Object *ob)
for(node = dag->DagNode.first; node; node= node->next)
node->color = DAG_WHITE;
- node = dag->DagNode.first;
-
- node->color = DAG_GRAY;
- push_stack(nqueue, node);
+ rootnode->color = DAG_GRAY;
+ push_stack(nqueue, rootnode);
while(nqueue->count) {
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index b9947c506d1..318165af804 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1414,10 +1414,7 @@ void driver_free_variable (ChannelDriver *driver, DriverVar *dvar)
DRIVER_TARGETS_LOOPER_END
/* remove the variable from the driver */
- if (driver)
- BLI_freelinkN(&driver->variables, dvar);
- else
- MEM_freeN(dvar);
+ BLI_freelinkN(&driver->variables, dvar);
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index a44957ddc01..d9fe0138784 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -692,7 +692,11 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
case IDP_ARRAY:
{
/*for now, we only support float and int and double arrays*/
- if (val->array.type == IDP_FLOAT || val->array.type == IDP_INT || val->array.type == IDP_DOUBLE || val->array.type == IDP_GROUP) {
+ if ( (val->array.type == IDP_FLOAT) ||
+ (val->array.type == IDP_INT) ||
+ (val->array.type == IDP_DOUBLE) ||
+ (val->array.type == IDP_GROUP) )
+ {
prop = MEM_callocN(sizeof(IDProperty), "IDProperty array");
prop->subtype = val->array.type;
if (val->array.len)
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 622ec093a3f..9890a2629fc 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -909,8 +909,10 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
if (array_index)
*array_index= dummy_index;
}
-
+
+ /* 'buf' _must_ be initialized in this block */
/* append preceding bits to path */
+ /* note, strings are not escapted and they should be! */
if ((actname && actname[0]) && (constname && constname[0])) {
/* Constraint in Pose-Channel */
sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
@@ -918,6 +920,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
else if (actname && actname[0]) {
if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) {
/* Actionified "Object" IPO's... no extra path stuff needed */
+ buf[0]= '\0'; /* empty string */
}
else if ((blocktype == ID_KE) && strcmp(actname, "Shape")==0) {
/* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */
@@ -936,8 +939,10 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
/* Sequence names in Scene */
sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
}
- else
+ else {
buf[0]= '\0'; /* empty string */
+ }
+
BLI_dynstr_append(path, buf);
/* need to add dot before property if there was anything precceding this */
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 75d8ec584e8..7b2cfd46d33 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -372,7 +372,10 @@ static MovieClip *movieclip_alloc(const char *name)
BKE_tracking_init_settings(&clip->tracking);
clip->proxy.build_size_flag= IMB_PROXY_25;
- clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN|IMB_TC_FREE_RUN|IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
+ clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
+ IMB_TC_FREE_RUN |
+ IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN |
+ IMB_TC_RECORD_RUN_NO_GAPS;
clip->proxy.quality= 90;
return clip;
@@ -985,9 +988,9 @@ void unlink_movieclip(Main *bmain, MovieClip *clip)
}
for(ob= bmain->object.first; ob; ob= ob->id.next) {
- bConstraint *con= ob->constraints.first;
+ bConstraint *con;
- for (con= ob->constraints.first; con; con= con->next) {
+ for(con= ob->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 421764f7191..4b2195cda9f 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2652,6 +2652,9 @@ static int cgdm_adjacent_grid(CCGSubSurf *ss, int *gridOffset, CCGFace *f, int S
break;
}
}
+
+ if(numEdges == 0)
+ return -1;
fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, adjf));
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 83adfa12236..04e8c3df077 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1288,8 +1288,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
MEM_freeN(image_new);
}
- coords_correct= !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2);
- if(coords_correct && !onbound && (tracked || !context->disable_failed)) {
+ coords_correct= !onbound && !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2);
+ if(coords_correct && (tracked || !context->disable_failed)) {
if(context->first_time) {
#pragma omp critical
{
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index aa914998a72..81c526e45a6 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -299,7 +299,8 @@ static bUnitDef *unit_best_fit(double value, bUnitCollection *usys, bUnitDef *un
if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
continue;
- if (value_abs >= unit->scalar*(1.0-EPS)) /* scale down scalar so 1cm doesnt convert to 10mm because of float error */
+ /* scale down scalar so 1cm doesnt convert to 10mm because of float error */
+ if (value_abs >= unit->scalar*(1.0-EPS))
return unit;
}
@@ -481,11 +482,14 @@ static int ch_is_op(char op)
}
}
-static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit, const char *replace_str)
+static int unit_scale_str(char *str, int len_max, char *str_tmp,
+ double scale_pref, bUnitDef *unit, const char *replace_str)
{
char *str_found;
- if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) { /* XXX - investigate, does not respect len_max properly */
+ if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) {
+ /* XXX - investigate, does not respect len_max properly */
+
int len, len_num, len_name, len_move, found_ofs;
found_ofs = (int)(str_found-str);
diff --git a/source/blender/blenlib/BLI_md5.h b/source/blender/blenlib/BLI_md5.h
new file mode 100644
index 00000000000..afcc3cdfa3e
--- /dev/null
+++ b/source/blender/blenlib/BLI_md5.h
@@ -0,0 +1,45 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BLI_MD5_H
+#define BLI_MD5_H
+
+/** \file BLI_md5.h
+ * \ingroup bli
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
+ result is always in little endian byte order, so that a byte-wise
+ output yields to the wanted ASCII representation of the message
+ digest. */
+
+void *md5_buffer(const char *buffer, size_t len, void *resblock);
+
+/* Compute MD5 message digest for bytes read from STREAM. The
+ resulting message digest number will be written into the 16 bytes
+ beginning at RESBLOCK. */
+
+int md5_stream(FILE *stream, void *resblock);
+
+#endif
+
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index da7801e350a..a439f4eeeca 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -72,6 +72,7 @@ set(SRC
intern/math_rotation.c
intern/math_vector.c
intern/math_vector_inline.c
+ intern/md5.c
intern/noise.c
intern/path_util.c
intern/pbvh.c
@@ -123,6 +124,7 @@ set(SRC
BLI_math_matrix.h
BLI_math_rotation.h
BLI_math_vector.h
+ BLI_md5.h
BLI_memarena.h
BLI_mempool.h
BLI_noise.h
diff --git a/source/blender/imbuf/intern/md5.c b/source/blender/blenlib/intern/md5.c
index 2192fa32f19..25582a5f750 100644
--- a/source/blender/imbuf/intern/md5.c
+++ b/source/blender/blenlib/intern/md5.c
@@ -21,12 +21,82 @@
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>. */
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
#include <sys/types.h>
-# include <stdlib.h>
-# include <string.h>
+#if defined HAVE_LIMITS_H || defined _LIBC
+# include <limits.h>
+#endif
+
+/* The following contortions are an attempt to use the C preprocessor
+ to determine an unsigned integral type that is 32 bits wide. An
+ alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
+ doing that would require that the configure script compile and *run*
+ the resulting executable. Locally running cross-compiled executables
+ is usually not possible. */
+
+#if defined __STDC__ && __STDC__
+# define UINT_MAX_32_BITS 4294967295U
+#else
+# define UINT_MAX_32_BITS 0xFFFFFFFF
+#endif
+
+/* If UINT_MAX isn't defined, assume it's a 32-bit type.
+ This should be valid for all systems GNU cares about because
+ that doesn't include 16-bit systems, and only modern systems
+ (that certainly have <limits.h>) have 64+-bit integral types. */
+
+#ifndef UINT_MAX
+# define UINT_MAX UINT_MAX_32_BITS
+#endif
+
+#if UINT_MAX == UINT_MAX_32_BITS
+ typedef unsigned int md5_uint32;
+#else
+# if USHRT_MAX == UINT_MAX_32_BITS
+ typedef unsigned short md5_uint32;
+# else
+# if ULONG_MAX == UINT_MAX_32_BITS
+ typedef unsigned long md5_uint32;
+# else
+ /* The following line is intended to evoke an error.
+ Using #error is not portable enough. */
+ "Cannot determine unsigned 32-bit data type."
+# endif
+# endif
+#endif
+
+/* Structure to save state of computation between the single steps. */
+struct md5_ctx
+{
+ md5_uint32 A;
+ md5_uint32 B;
+ md5_uint32 C;
+ md5_uint32 D;
+};
+
+/*
+ * The following three functions are build up the low level used in
+ * the functions `md5_stream' and `md5_buffer'.
+ */
+
+/* Initialize structure containing state of computation.
+ (RFC 1321, 3.3: Step 3) */
+static void md5_init_ctx(struct md5_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+ initialzation function update the context for the next LEN bytes
+ starting at BUFFER.
+ It is necessary that LEN is a multiple of 64!!! */
+static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx);
+
+/* Put result from CTX in first 16 bytes following RESBUF. The result is
+ always in little endian byte order, so that a byte-wise output yields
+ to the wanted ASCII representation of the message digest. */
+static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf);
-#include "md5.h"
#ifdef __BIG_ENDIAN__
# define SWAP(n) \
@@ -43,9 +113,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
-void
-md5_init_ctx (ctx)
- struct md5_ctx *ctx;
+static void md5_init_ctx(struct md5_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
@@ -55,10 +123,7 @@ md5_init_ctx (ctx)
/* Put result from CTX in first 16 bytes following RESBUF. The result must
be in little endian byte order. */
-void *
-md5_read_ctx (ctx, resbuf)
- const struct md5_ctx *ctx;
- void *resbuf;
+static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -71,10 +136,7 @@ md5_read_ctx (ctx, resbuf)
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
-int
-md5_stream (stream, resblock)
- FILE *stream;
- void *resblock;
+int md5_stream(FILE *stream, void *resblock)
{
/* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096
@@ -154,11 +216,7 @@ md5_stream (stream, resblock)
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
-void *
-md5_buffer (buffer, len, resblock)
- const char *buffer;
- size_t len;
- void *resblock;
+void *md5_buffer(const char *buffer, size_t len, void *resblock)
{
struct md5_ctx ctx;
char restbuf[64 + 72];
@@ -207,11 +265,7 @@ md5_buffer (buffer, len, resblock)
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 64 == 0. */
-void
-md5_process_block (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
+void md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index e79d850caa5..9adb39f09ef 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -317,7 +317,7 @@ void BLI_uniquename(ListBase *list, void *vlink, const char defname[], char deli
void BLI_cleanup_path(const char *relabase, char *dir)
{
- short a;
+ ptrdiff_t a;
char *start, *eind;
if (relabase) {
BLI_path_abs(dir, relabase);
@@ -1416,7 +1416,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
{
size_t path_len= strlen(path);
size_t ext_len= strlen(ext);
- size_t a;
+ ssize_t a;
for(a= path_len - 1; a >= 0; a--) {
if (ELEM3(path[a], '.', '/', '\\')) {
@@ -1424,7 +1424,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
}
}
- if (path[a] != '.') {
+ if ((a < 0) || (path[a] != '.')) {
a= path_len;
}
@@ -1440,7 +1440,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
{
size_t path_len= strlen(path);
size_t ext_len= strlen(ext);
- size_t a;
+ ssize_t a;
/* first check the extension is alread there */
if ( (ext_len <= path_len) &&
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 9cf721738a7..35271f7b873 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../nodes
../render/extern/include
../../../intern/guardedalloc
+ ../imbuf
)
set(INC_SYS
diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript
index 57075ac3bcf..20b560744b3 100644
--- a/source/blender/blenloader/SConscript
+++ b/source/blender/blenloader/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c')
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
incs += ' ../makesdna ../editors/include'
-incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh'
+incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh ../imbuf'
incs += ' ' + env['BF_ZLIB_INC']
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1c554cdcf9a..9695b90593b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -141,6 +141,8 @@
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
#include "BKE_sound.h"
+#include "IMB_imbuf.h" // for proxy / timecode versioning stuff
+
#include "NOD_socket.h"
//XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
@@ -10771,8 +10773,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
void *olddata = ob->data;
ob->data = me;
- if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) /* XXX - library meshes crash on loading most yoFrankie levels, the multires pointer gets invalid - Campbell */
+ /* XXX - library meshes crash on loading most yoFrankie levels,
+ * the multires pointer gets invalid - Campbell */
+ if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
multires_load_old(ob, me);
+ }
ob->data = olddata;
}
@@ -12670,10 +12675,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
clip->aspy= 1.0f;
}
- /* XXX: a bit hacky, probably include imbuf and use real constants are nicer */
- clip->proxy.build_tc_flag= 7;
+ clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
+ IMB_TC_FREE_RUN |
+ IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
+
if(clip->proxy.build_size_flag==0)
- clip->proxy.build_size_flag= 1;
+ clip->proxy.build_size_flag= IMB_PROXY_25;
if(clip->proxy.quality==0)
clip->proxy.quality= 90;
@@ -12813,6 +12820,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
scene->gm.exitkey = 218; // Blender key code for ESC
}
}
+ {
+ MovieClip *clip;
+ for(clip= main->movieclip.first; clip; clip= clip->id.next) {
+ clip->proxy.build_tc_flag|= IMB_TC_RECORD_RUN_NO_GAPS;
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@ -14343,7 +14356,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
expand_main(fd, mainptr);
- /* dang FileData... now new libraries need to be appended to original filedata, it is not a good replacement for the old global (ton) */
+ /* dang FileData... now new libraries need to be appended to original filedata,
+ * it is not a good replacement for the old global (ton) */
while( fd->mainlist.first ) {
Main *mp= fd->mainlist.first;
BLI_remlink(&fd->mainlist, mp);
@@ -14365,8 +14379,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
ID *idn= id->next;
if(id->flag & LIB_READ) {
BLI_remlink(lbarray[a], id);
- BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
- if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+ BKE_reportf(basefd->reports, RPT_ERROR,
+ "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
+ BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+ if (!G.background && basefd->reports) {
+ printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
+ BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
+ }
change_idid_adr(mainlist, basefd, id, NULL);
MEM_freeN(id);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 8c699c840dc..a21c394a81e 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -496,7 +496,7 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
break;
/* store this level as the 'old' level now */
- prevLevel= level; // XXX: prevLevel is unused
+ // prevLevel= level; // XXX: prevLevel is unused
}
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index fe6aed77462..45b715c406a 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2205,12 +2205,12 @@ size_t ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_m
/* only filter data if there's somewhere to put it */
if (data && anim_data) {
- Object *obact= (ac) ? ac->obact : NULL;
/* firstly filter the data */
switch (datatype) {
case ANIMCONT_ACTION: /* 'Action Editor' */
{
+ Object *obact= ac->obact;
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = (saction)? &saction->ads : NULL;
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 1bad61be324..4948073f9c6 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -904,7 +904,9 @@ void uiEndBlock(const bContext *C, uiBlock *block)
/* handle pending stuff */
if(block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
ui_block_do_align(block);
- if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
+ if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
+ ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
+ }
if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
/* after keymaps! */
@@ -1901,7 +1903,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
if(softmin < (double)but->hardmin)
softmin= (double)but->hardmin;
}
- else if(value_max-1e-10 > softmax) {
+ if(value_max-1e-10 > softmax) {
if(value_max < 0.0)
softmax= -soft_range_round_down(-value_max, -softmax);
else
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6ebfddff5c1..900cbbd5cbf 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -5247,7 +5247,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
highlight when not in a popup menu, we remove because data used in
button below popup might have been removed by action of popup. Needs
a more reliable solution... */
- if(state != BUTTON_STATE_HIGHLIGHT || but->block->handle)
+ if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
ui_check_but(but);
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index b6c1606ec6b..63f6309163e 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -681,7 +681,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
static int modifier_can_delete(ModifierData *md)
{
- // fluid particle modifier can't be deleted here
+ /* fluid particle modifier can't be deleted here */
if(md->type == eModifierType_ParticleSystem)
if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
return 0;
@@ -689,14 +689,16 @@ static int modifier_can_delete(ModifierData *md)
return 1;
}
-// Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab
+/* Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
static int modifier_is_simulation(ModifierData *md)
{
- // Physic Tab
- if(ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint)) {
+ /* Physic Tab */
+ if (ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke,
+ eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint))
+ {
return 1;
}
- // Particle Tab
+ /* Particle Tab */
else if (md->type == eModifierType_ParticleSystem) {
return 2;
}
@@ -705,7 +707,8 @@ static int modifier_is_simulation(ModifierData *md)
}
}
-static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex)
+static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
+ ModifierData *md, int index, int cageIndex, int lastCageIndex)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
PointerRNA ptr;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 0da4d3895e0..d8a34262e81 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1795,7 +1795,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
{
/* gouraud triangle fan */
float radstep, ang= 0.0f;
- float centx, centy, radius;
+ float centx, centy, radius, cursor_radius;
float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
int a, tot= 32;
int color_profile = but->block->color_profile;
@@ -1864,12 +1864,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
if(but->flag & UI_BUT_COLOR_CUBIC)
- radius= (1.0f - powf(1.0f - hsvo[1], 3.0f)) *radius;
+ cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
else
- radius= hsvo[1] * radius;
+ cursor_radius = hsvo[1];
+ radius= CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
-
}
/* ************ custom buttons, old stuff ************** */
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0a41b473390..e4b27f58e05 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -2179,3 +2179,51 @@ void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+
+static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Object *ob=ED_object_active_context(C);
+
+ CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ if(ob != ob_iter) {
+ ob_iter->gameflag = ob->gameflag;
+ ob_iter->gameflag2 = ob->gameflag2;
+ ob_iter->inertia = ob->inertia;
+ ob_iter->formfactor = ob->formfactor;;
+ ob_iter->damping = ob->damping;
+ ob_iter->rdamping = ob->rdamping;
+ ob_iter->min_vel = ob->min_vel;
+ ob_iter->max_vel = ob->max_vel;
+ ob_iter->obstacleRad = ob->obstacleRad;
+ ob_iter->mass = ob->mass;
+ ob_iter->anisotropicFriction[0] = ob->anisotropicFriction[0];
+ ob_iter->anisotropicFriction[1] = ob->anisotropicFriction[1];
+ ob_iter->anisotropicFriction[2] = ob->anisotropicFriction[2];
+ ob_iter->collision_boundtype = ob->collision_boundtype;
+ ob_iter->margin = ob->margin;
+ ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
+ if(ob->restrictflag & OB_RESTRICT_RENDER)
+ ob_iter->restrictflag |= OB_RESTRICT_RENDER;
+ else
+ ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
+ }
+ }
+ CTX_DATA_END;
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Game Physics Properties to Selected";
+ ot->description = "Copy game physics properties to other selected objects";
+ ot->idname= "OBJECT_OT_game_physics_copy";
+
+ /* api callbacks */
+ ot->exec= game_physics_copy_exec;
+ ot->poll= ED_operator_object_active_editable;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 035d2dfcff8..29c6350452c 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -92,6 +92,7 @@ void OBJECT_OT_game_property_remove(struct wmOperatorType *ot);
void OBJECT_OT_game_property_copy(struct wmOperatorType *ot);
void OBJECT_OT_game_property_clear(struct wmOperatorType *ot);
void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot);
+void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot);
/* object_select.c */
void OBJECT_OT_select_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index a140888a602..c5de274c464 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -655,7 +655,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= ED_object_active_context(C);
- EnumPropertyItem *item= NULL, *md_item;
+ EnumPropertyItem *item= NULL, *md_item, *group_item= NULL;
ModifierTypeInfo *mti;
int totitem= 0, a;
@@ -675,6 +675,17 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
(ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
continue;
}
+ else {
+ group_item= md_item;
+ md_item= NULL;
+
+ continue;
+ }
+
+ if(group_item) {
+ RNA_enum_item_add(&item, &totitem, group_item);
+ group_item= NULL;
+ }
RNA_enum_item_add(&item, &totitem, md_item);
}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 8fd852278d3..f6b4656af7e 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -189,6 +189,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_game_property_copy);
WM_operatortype_append(OBJECT_OT_game_property_clear);
WM_operatortype_append(OBJECT_OT_logic_bricks_copy);
+ WM_operatortype_append(OBJECT_OT_game_physics_copy);
WM_operatortype_append(OBJECT_OT_shape_key_add);
WM_operatortype_append(OBJECT_OT_shape_key_remove);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index d1791ba6ee9..59181aba6e4 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1816,7 +1816,9 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
return 1;
*/
- if((bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) || (bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]) ) {
+ if ( (bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) ||
+ (bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]) )
+ {
return 1;
}
@@ -2816,7 +2818,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
p4[0] = bucket_bounds.xmax; p4[1] = bucket_bounds.ymin;
if (mf->v4) {
- if( isect_point_quad_v2(p1, v1, v2, v3, v4) || isect_point_quad_v2(p2, v1, v2, v3, v4) || isect_point_quad_v2(p3, v1, v2, v3, v4) || isect_point_quad_v2(p4, v1, v2, v3, v4) ||
+ if ( isect_point_quad_v2(p1, v1, v2, v3, v4) ||
+ isect_point_quad_v2(p2, v1, v2, v3, v4) ||
+ isect_point_quad_v2(p3, v1, v2, v3, v4) ||
+ isect_point_quad_v2(p4, v1, v2, v3, v4) ||
+
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3) || isect_line_line_v2(p1, p2, v3, v4)) ||
(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3) || isect_line_line_v2(p2, p3, v3, v4)) ||
@@ -2827,7 +2833,10 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
}
}
else {
- if( isect_point_tri_v2(p1, v1, v2, v3) || isect_point_tri_v2(p2, v1, v2, v3) || isect_point_tri_v2(p3, v1, v2, v3) || isect_point_tri_v2(p4, v1, v2, v3) ||
+ if ( isect_point_tri_v2(p1, v1, v2, v3) ||
+ isect_point_tri_v2(p2, v1, v2, v3) ||
+ isect_point_tri_v2(p3, v1, v2, v3) ||
+ isect_point_tri_v2(p4, v1, v2, v3) ||
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3)) ||
(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3)) ||
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 9fdf59b0349..cdfb1f971ac 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -592,7 +592,12 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
float pen_flip = cache->pen_flip ? -1 : 1;
float invert = cache->invert ? -1 : 1;
float accum = integrate_overlap(brush);
- float overlap = (brush->flag & BRUSH_SPACE_ATTEN && brush->flag & BRUSH_SPACE && !(brush->flag & BRUSH_ANCHORED)) && (brush->spacing < 100) ? 1.0f/accum : 1; // spacing is integer percentage of radius, divide by 50 to get normalized diameter
+ /* spacing is integer percentage of radius, divide by 50 to get
+ normalized diameter */
+ float overlap = (brush->flag & BRUSH_SPACE_ATTEN &&
+ brush->flag & BRUSH_SPACE &&
+ !(brush->flag & BRUSH_ANCHORED) &&
+ (brush->spacing < 100)) ? 1.0f/accum : 1;
float flip = dir * invert * pen_flip;
switch(brush->sculpt_tool){
@@ -1716,7 +1721,9 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
/* this calculates flatten center and area normal together,
amortizing the memory bandwidth and loop overhead to calculate both at the same time */
-static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float an[3], float fc[3])
+static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
+ PBVHNode **nodes, int totnode,
+ float an[3], float fc[3])
{
SculptSession *ss = ob->sculpt;
int n;
@@ -2588,7 +2595,9 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
/* Flip all the editdata across the axis/axes specified by symm. Used to
calculate multiple modifications to the mesh when symmetry is enabled. */
-static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float UNUSED(feather))
+static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
+ const char axis, const float angle,
+ const float UNUSED(feather))
{
(void)sd; /* unused */
@@ -2620,7 +2629,9 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
mul_m4_v3(cache->symm_rot_mat, cache->grab_delta_symmetry);
}
-static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, const char symm, const int axis, const float feather)
+static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush,
+ const char symm, const int axis,
+ const float feather)
{
SculptSession *ss = ob->sculpt;
int i;
@@ -2954,7 +2965,10 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
cache->original = 1;
}
- if(ELEM8(brush->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
+ if(ELEM8(brush->sculpt_tool,
+ SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
+ SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
+ SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
if(!(brush->flag & BRUSH_ACCUMULATE))
cache->original = 1;
@@ -3038,7 +3052,9 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
}
/* Initialize the stroke cache variants from operator properties */
-static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, struct PaintStroke *stroke, PointerRNA *ptr)
+static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
+ struct PaintStroke *stroke,
+ PointerRNA *ptr)
{
SculptSession *ss = ob->sculpt;
StrokeCache *cache = ss->cache;
@@ -3095,7 +3111,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
cache->radius_squared = cache->radius*cache->radius;
- if(!(brush->flag & BRUSH_ANCHORED || ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
+ if(!(brush->flag & BRUSH_ANCHORED ||
+ ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK,
+ SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
copy_v2_v2(cache->tex_mouse, cache->mouse);
if ( (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) &&
@@ -3137,7 +3155,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
if (!hit)
copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
- cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke), cache->true_location, cache->pixel_radius);
+ cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke),
+ cache->true_location,
+ cache->pixel_radius);
cache->radius_squared = cache->radius*cache->radius;
copy_v3_v3(sd->anchored_location, cache->true_location);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 30a7abd3c0b..9b1bd1d7b31 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -221,12 +221,17 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
{
/* can't rename rna datablocks entries */
- if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
- ;
- else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+ /* do nothing */;
+ }
+ else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
+ TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+ {
BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
- else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
+ }
+ else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
+ }
else if(tselem->id->lib) {
// XXX error_libdata();
}
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index e728267f45f..bf570c929cc 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -823,8 +823,12 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
- if(!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) && !(soops->flag & SO_HIDE_RESTRICTCOLS) && fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)
+ if ( !ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) &&
+ !(soops->flag & SO_HIDE_RESTRICTCOLS) &&
+ (fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX))
+ {
return OPERATOR_CANCELLED;
+ }
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 851d6c1174a..ea3fe09ff69 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2685,8 +2685,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
}
}
-static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
- Object *ob, BMEditMesh *em, UnitSettings *unit)
+static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitSettings *unit)
{
Mesh *me= ob->data;
float v1[3], v2[3], v3[3], vmid[3], fvec[3];
@@ -2709,11 +2708,6 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
else if (grid < 1.0f) conv_float= "%.4g";
else if (grid < 10.0f) conv_float= "%.3g";
else conv_float= "%.2g";
-
- if(v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0)
- glDisable(GL_DEPTH_TEST);
-
- if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0f);
if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
BMEdge *eed;
@@ -2836,43 +2830,52 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
}
}
}
+}
- /* useful for debugging index vs shape key index */
-#if 0
- {
- BMIter iter;
- BMVert *eve;
- int j=0;
+static void draw_em_indices(BMEditMesh *em)
+{
+ BMEdge *e;
+ BMFace *f;
+ BMVert *v;
+ int i;
+ char val[32];
+ float pos[3];
+ unsigned char col[4];
- UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
+ BMIter iter;
+ BMesh *bm= em->bm;
- if(CustomData_has_layer(&em->bm->vdata, CD_SHAPE_KEYINDEX)) {
- int *keyi;
- BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- keyi = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
- if(keyi && *keyi != ORIGINDEX_NONE) {
- sprintf(val, "%d:%d", j, *keyi);
- }
- else {
- sprintf(val, "%d", j);
- }
- view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
- i++;
- }
+ /* For now, reuse appropriate theme colors from stats text colors */
+ i= 0;
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
+ BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
+ if (BM_TestHFlag(v, BM_SELECT)) {
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
- else {
- BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- sprintf(val, "%d", j);
- view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
- j++;
- }
+ i++;
+ }
+
+ i= 0;
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
+ BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+ if (BM_TestHFlag(e, BM_SELECT)) {
+ sprintf(val, "%d", i);
+ mid_v3_v3v3(pos, e->v1->co, e->v2->co);
+ view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
+ i++;
}
-#endif
- if(v3d->zbuf) {
- glEnable(GL_DEPTH_TEST);
- bglPolygonOffset(rv3d->dist, 0.0f);
+ i= 0;
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
+ BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
+ if (BM_TestHFlag(f, BM_SELECT)) {
+ BM_Compute_Face_CenterMean(bm, f, pos);
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ }
+ i++;
}
}
@@ -3050,7 +3053,12 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if ( (me->drawflag & (ME_DRAWEXTRA_EDGELEN|ME_DRAWEXTRA_FACEAREA|ME_DRAWEXTRA_FACEANG)) &&
!(v3d->flag2 & V3D_RENDER_OVERRIDE))
{
- draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit);
+ draw_em_measure_stats(v3d, ob, em, &scene->unit);
+ }
+
+ if ((G.f & G_DEBUG) && (me->drawflag & ME_DRAWEXTRA_INDICES) &&
+ !(v3d->flag2 & V3D_RENDER_OVERRIDE)) {
+ draw_em_indices(em);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 739e7f186fe..597adcf4193 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -277,7 +277,7 @@ static int modeselect_addmode(char *str, const char *title, int id, int icon)
static char *view3d_modeselect_pup(Scene *scene)
{
Object *ob= OBACT;
- static char string[256];
+ static char string[512];
const char *title= IFACE_("Mode: %t");
char *str = string;
@@ -317,7 +317,10 @@ static char *view3d_modeselect_pup(Scene *scene)
str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
}
- if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) {
+ if ( ob->particlesystem.first ||
+ modifiers_findByType(ob, eModifierType_Cloth) ||
+ modifiers_findByType(ob, eModifierType_Softbody))
+ {
str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
}
(void)str;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c9aa727d365..56f4874fe30 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1725,7 +1725,11 @@ static int game_engine_exec(bContext *C, wmOperator *op)
game_set_commmandline_options(&startscene->gm);
- if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */
+ if((rv3d->persp == RV3D_CAMOB) &&
+ (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
+ (startscene->gm.stereoflag != STEREO_DOME))
+ {
+ /* Letterbox */
rctf cam_framef;
ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 4a7793b9e4a..e916ae3486d 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1556,8 +1556,10 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
* but for now just dont change handle types */
- if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0)
- testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */
+ if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
+ /* sets the handles based on their selection, do this after the data is copied to the TransData */
+ testhandlesNurb(nu);
+ }
}
else {
TransData *head, *tail;
@@ -3504,7 +3506,10 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
* then check if we're using auto-handles.
* - If so, change them auto-handles to aligned handles so that handles get affected too
*/
- if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
+ if ( ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(t->mode, TFM_ROTATION, TFM_RESIZE))
+ {
if (hdata && (sel1) && (sel3)) {
bezt->h1= HD_ALIGN;
bezt->h2= HD_ALIGN;
@@ -4200,7 +4205,10 @@ static void createTransSeqData(bContext *C, TransInfo *t)
int i;
for(i=0; i<3; i++) {
seq_user= *((&seq->seq1) + i);
- if (seq_user && (seq_user->flag & SELECT) && !(seq_user->flag & SEQ_LOCK) && !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL))) {
+ if ( seq_user && (seq_user->flag & SELECT) &&
+ !(seq_user->flag & SEQ_LOCK) &&
+ !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
+ {
seq->flag |= SELECT;
}
}
@@ -4499,7 +4507,8 @@ static int count_proportional_objects(TransInfo *t)
/* mark all children */
for (base= scene->base.first; base; base= base->next) {
/* all base not already selected or marked that is editable */
- if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
+ if ( (base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
mark_children(base->object);
}
@@ -4510,7 +4519,8 @@ static int count_proportional_objects(TransInfo *t)
Object *ob= base->object;
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
- if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
+ if ( (ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
/* used for flush, depgraph will change recalcs if needed :) */
@@ -4586,7 +4596,9 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
if (adt && adt->action) {
for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) {
fcu->flag &= ~FCURVE_SELECTED;
- insert_keyframe(reports, id, adt->action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
+ insert_keyframe(reports, id, adt->action,
+ (fcu->grp ? fcu->grp->name : NULL),
+ fcu->rna_path, fcu->array_index, cfra, flag);
}
}
}
@@ -5104,8 +5116,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
- else if(t->scene->basact && (ob = t->scene->basact->object) && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, ob)) {
- ;
+ else if ( (t->scene->basact) &&
+ (ob = t->scene->basact->object) &&
+ (ob->mode & OB_MODE_PARTICLE_EDIT) &&
+ PE_get_current(t->scene, ob))
+ {
+ /* do nothing */ ;
}
else { /* Objects */
int i, recalcObPaths=0;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index e108262758a..9ce4779616e 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1637,7 +1637,12 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
}
for ( base = FIRSTBASE; base != NULL; base = base->next ) {
- if ( BASE_VISIBLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) {
+ if ( (BASE_VISIBLE(v3d, base)) &&
+ (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 &&
+
+ ( (mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) ||
+ (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) )
+ {
Object *ob = base->object;
if (ob->transflag & OB_DUPLI)
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 33796b7c215..d623697921c 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -241,7 +241,12 @@ GPUFunction *GPU_lookup_function(const char *name)
return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);
}
-void GPU_extensions_exit(void)
+void GPU_codegen_init(void)
+{
+ GPU_code_generate_glsl_lib();
+}
+
+void GPU_codegen_exit(void)
{
extern Material defmaterial; // render module abuse...
@@ -253,8 +258,11 @@ void GPU_extensions_exit(void)
FUNCTION_HASH = NULL;
}
- if(glsl_material_library)
+ if(glsl_material_library) {
MEM_freeN(glsl_material_library);
+ glsl_material_library = NULL;
+ }
+
/*if(FUNCTION_PROTOTYPES) {
MEM_freeN(FUNCTION_PROTOTYPES);
FUNCTION_PROTOTYPES = NULL;
@@ -538,12 +546,8 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
BLI_dynstr_appendf(ds, ", gl_TexCoord[%d].st", input->texid);
}
else if (input->source == GPU_SOURCE_TEX_PIXEL) {
- if (input->link && input->link->output)
- codegen_convert_datatype(ds, input->link->output->type, input->type,
- "tmp", input->link->output->id);
- else
- codegen_convert_datatype(ds, input->link->output->type, input->type,
- "tex", input->texid);
+ codegen_convert_datatype(ds, input->link->output->type, input->type,
+ "tmp", input->link->output->id);
}
else if(input->source == GPU_SOURCE_BUILTIN)
BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin));
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index f52b5bb627e..85bf65232c1 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -178,6 +178,9 @@ void GPU_pass_unbind(GPUPass *pass);
void GPU_pass_free(GPUPass *pass);
+void GPU_codegen_init(void);
+void GPU_codegen_exit(void);
+
/* Material calls */
const char *GPU_builtin_name(GPUBuiltin builtin);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 2dcce996065..5d36ba169f3 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1069,7 +1069,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
/* setting do_alpha_after = 1 indicates this object needs to be
* drawn in a second alpha pass for improved blending */
- if(GMS.use_alpha_pass && !GMS.is_alpha_pass)
+ if(do_alpha_after && !GMS.is_alpha_pass)
if(ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
*do_alpha_after= 1;
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index eaa661a9dcf..c4ed88635b7 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -45,6 +45,7 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "gpu_codegen.h"
#include <stdlib.h>
#include <stdio.h>
@@ -85,6 +86,8 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
/* GPU Extensions */
+static int gpu_extensions_init = 0;
+
void GPU_extensions_disable(void)
{
GG.extdisabled = 1;
@@ -96,11 +99,11 @@ void GPU_extensions_init(void)
const char *vendor, *renderer;
/* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
- static char init= 0;
- if(init) return;
- init= 1;
+ if(gpu_extensions_init) return;
+ gpu_extensions_init= 1;
glewInit();
+ GPU_codegen_init();
/* glewIsSupported("GL_VERSION_2_0") */
@@ -112,8 +115,6 @@ void GPU_extensions_init(void)
if (!GLEW_ARB_vertex_shader) GG.glslsupport = 0;
if (!GLEW_ARB_fragment_shader) GG.glslsupport = 0;
- GPU_code_generate_glsl_lib();
-
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
@@ -188,6 +189,12 @@ void GPU_extensions_init(void)
#endif
}
+void GPU_extensions_exit(void)
+{
+ gpu_extensions_init = 0;
+ GPU_codegen_exit();
+}
+
int GPU_glsl_support(void)
{
return !GG.extdisabled && GG.glslsupport;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 250ea51f8c8..fb1d10b5491 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -972,7 +972,6 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link(mat, "mtex_mapping_ofs", texco, GPU_uniform(ofs), &texco);
talpha = 0;
- rgbnor = 0;
if(tex && tex->type == TEX_IMAGE && tex->ima) {
GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser), &tin, &trgb);
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index a03d6ce280d..4c8a79e6372 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -53,7 +53,6 @@ set(SRC
intern/indexer_dv.c
intern/iris.c
intern/jpeg.c
- intern/md5.c
intern/metadata.c
intern/module.c
intern/moviecache.c
@@ -96,7 +95,6 @@ set(SRC
intern/dds/Stream.h
intern/dds/dds_api.h
intern/imbuf.h
- intern/md5.h
intern/openexr/openexr_api.h
intern/openexr/openexr_multi.h
diff --git a/source/blender/imbuf/intern/md5.h b/source/blender/imbuf/intern/md5.h
deleted file mode 100644
index 79c480d8152..00000000000
--- a/source/blender/imbuf/intern/md5.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/** \file blender/imbuf/intern/md5.h
- * \ingroup imbuf
- */
-/* md5.h - Declaration of functions and data types used for MD5 sum
- computing library functions.
- Copyright (C) 1995 Free Software Foundation, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _MD5_H
-#define _MD5_H
-
-#include <stdio.h>
-
-#if defined HAVE_LIMITS_H || defined _LIBC
-# include <limits.h>
-#endif
-
-/* The following contortions are an attempt to use the C preprocessor
- to determine an unsigned integral type that is 32 bits wide. An
- alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
- doing that would require that the configure script compile and *run*
- the resulting executable. Locally running cross-compiled executables
- is usually not possible. */
-
-#if defined __STDC__ && __STDC__
-# define UINT_MAX_32_BITS 4294967295U
-#else
-# define UINT_MAX_32_BITS 0xFFFFFFFF
-#endif
-
-/* If UINT_MAX isn't defined, assume it's a 32-bit type.
- This should be valid for all systems GNU cares about because
- that doesn't include 16-bit systems, and only modern systems
- (that certainly have <limits.h>) have 64+-bit integral types. */
-
-#ifndef UINT_MAX
-# define UINT_MAX UINT_MAX_32_BITS
-#endif
-
-#if UINT_MAX == UINT_MAX_32_BITS
- typedef unsigned int md5_uint32;
-#else
-# if USHRT_MAX == UINT_MAX_32_BITS
- typedef unsigned short md5_uint32;
-# else
-# if ULONG_MAX == UINT_MAX_32_BITS
- typedef unsigned long md5_uint32;
-# else
- /* The following line is intended to evoke an error.
- Using #error is not portable enough. */
- "Cannot determine unsigned 32-bit data type."
-# endif
-# endif
-#endif
-
-#undef __P
-#if defined (__STDC__) && __STDC__
-#define __P(x) x
-#else
-#define __P(x) ()
-#endif
-
-/* Structure to save state of computation between the single steps. */
-struct md5_ctx
-{
- md5_uint32 A;
- md5_uint32 B;
- md5_uint32 C;
- md5_uint32 D;
-};
-
-/*
- * The following three functions are build up the low level used in
- * the functions `md5_stream' and `md5_buffer'.
- */
-
-/* Initialize structure containing state of computation.
- (RFC 1321, 3.3: Step 3) */
-void md5_init_ctx __P ((struct md5_ctx *ctx));
-
-/* Starting with the result of former calls of this function (or the
- initialzation function update the context for the next LEN bytes
- starting at BUFFER.
- It is necessary that LEN is a multiple of 64!!! */
-void md5_process_block __P ((const void *buffer, size_t len,
- struct md5_ctx *ctx));
-
-/* Put result from CTX in first 16 bytes following RESBUF. The result is
- always in little endian byte order, so that a byte-wise output yields
- to the wanted ASCII representation of the message digest. */
-void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
-
-
-/* Compute MD5 message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 16 bytes
- beginning at RESBLOCK. */
-int md5_stream __P ((FILE *stream, void *resblock));
-
-/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
- result is always in little endian byte order, so that a byte-wise
- output yields to the wanted ASCII representation of the message
- digest. */
-void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
-
-#endif
-
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 19eb917469d..808bcbed751 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -32,17 +32,18 @@
#include <stdio.h>
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
#include "MEM_guardedalloc.h"
+#include "BLI_blenlib.h"
+#include "BLI_md5.h"
+
+#include "BKE_utildefines.h"
+
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_thumbs.h"
#include "IMB_metadata.h"
-#include "md5.h"
-
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 4f8b2343a9f..83292d3d8f8 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -38,6 +38,23 @@ struct SDNA;
extern unsigned char DNAstr[]; /* DNA.c */
extern int DNAlen;
+typedef enum eSDNA_Type {
+ SDNA_TYPE_CHAR = 0,
+ SDNA_TYPE_UCHAR = 1,
+ SDNA_TYPE_SHORT = 2,
+ SDNA_TYPE_USHORT = 3,
+ SDNA_TYPE_INT = 4,
+ SDNA_TYPE_LONG = 5,
+ SDNA_TYPE_ULONG = 6,
+ SDNA_TYPE_FLOAT = 7,
+ SDNA_TYPE_DOUBLE = 8,
+ SDNA_TYPE_INT64 = 9
+ /* ,SDNA_TYPE_VOID = 10 */ /* nothing uses yet */
+} eSDNA_Type;
+
+/* define so switch statements don't complain */
+#define SDNA_TYPE_VOID 10
+
struct SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap);
void DNA_sdna_free(struct SDNA *sdna);
@@ -49,6 +66,7 @@ void *DNA_struct_reconstruct(struct SDNA *newsdna, struct SDNA *oldsdna, char *c
int DNA_elem_array_size(const char *astr, int len);
int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
-#endif
+int DNA_elem_type_size(const eSDNA_Type elem_nr);
+#endif
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index eea76f9d386..20517000068 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -179,6 +179,9 @@ typedef struct TFace {
#define ME_DRAWEXTRA_FACEAREA (1 << 11)
#define ME_DRAWEXTRA_FACEANG (1 << 12)
+/* debug only option */
+#define ME_DRAWEXTRA_INDICES (1 << 13)
+
/* old global flags:
#define G_DRAWEDGES (1 << 18)
#define G_DRAWFACES (1 << 7)
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 4704ac189dc..432205b1b5d 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -492,7 +492,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
for(nr=0; nr<sdna->nr_structs; nr++) {
sp= sdna->structs[nr];
if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
- sp[10]= 9;
+ sp[10]= SDNA_TYPE_VOID;
}
}
@@ -656,92 +656,87 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
return compflags;
}
-static void cast_elem(char *ctype, char *otype, const char *name, char *curdata, char *olddata)
+static eSDNA_Type sdna_type_nr(const char *dna_type)
+{
+ if ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0)) return SDNA_TYPE_CHAR;
+ else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR;
+ else if( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT;
+ else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT;
+ else if( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT;
+ else if( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG;
+ else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG;
+ else if( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT;
+ else if( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE;
+ else if( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64;
+ else return -1; /* invalid! */
+}
+
+static void cast_elem(const char *ctype, const char *otype, const char *name, char *curdata, char *olddata)
{
double val = 0.0;
- int arrlen, curlen=1, oldlen=1, ctypenr, otypenr;
-
+ int arrlen, curlen=1, oldlen=1;
+
+ eSDNA_Type ctypenr, otypenr;
+
arrlen= DNA_elem_array_size(name, strlen(name));
-
- /* define otypenr */
- if(strcmp(otype, "char")==0 || (strcmp(otype, "const char")==0)) otypenr= 0;
- else if((strcmp(otype, "uchar")==0) || (strcmp(otype, "unsigned char")==0)) otypenr= 1;
- else if(strcmp(otype, "short")==0) otypenr= 2;
- else if((strcmp(otype, "ushort")==0)||(strcmp(otype, "unsigned short")==0)) otypenr= 3;
- else if(strcmp(otype, "int")==0) otypenr= 4;
- else if(strcmp(otype, "long")==0) otypenr= 5;
- else if((strcmp(otype, "ulong")==0)||(strcmp(otype, "unsigned long")==0)) otypenr= 6;
- else if(strcmp(otype, "float")==0) otypenr= 7;
- else if(strcmp(otype, "double")==0) otypenr= 8;
- else return;
-
- /* define ctypenr */
- if(strcmp(ctype, "char")==0) ctypenr= 0;
- else if(strcmp(ctype, "const char")==0) ctypenr= 0;
- else if((strcmp(ctype, "uchar")==0)||(strcmp(ctype, "unsigned char")==0)) ctypenr= 1;
- else if(strcmp(ctype, "short")==0) ctypenr= 2;
- else if((strcmp(ctype, "ushort")==0)||(strcmp(ctype, "unsigned short")==0)) ctypenr= 3;
- else if(strcmp(ctype, "int")==0) ctypenr= 4;
- else if(strcmp(ctype, "long")==0) ctypenr= 5;
- else if((strcmp(ctype, "ulong")==0)||(strcmp(ctype, "unsigned long")==0)) ctypenr= 6;
- else if(strcmp(ctype, "float")==0) ctypenr= 7;
- else if(strcmp(ctype, "double")==0) ctypenr= 8;
- else return;
+
+ if ( (otypenr= sdna_type_nr(otype)) == -1 ||
+ (ctypenr= sdna_type_nr(ctype)) == -1 )
+ {
+ return;
+ }
/* define lengths */
- if(otypenr < 2) oldlen= 1;
- else if(otypenr < 4) oldlen= 2;
- else if(otypenr < 8) oldlen= 4;
- else oldlen= 8;
-
- if(ctypenr < 2) curlen= 1;
- else if(ctypenr < 4) curlen= 2;
- else if(ctypenr < 8) curlen= 4;
- else curlen= 8;
-
+ oldlen= DNA_elem_type_size(otypenr);
+ curlen= DNA_elem_type_size(ctypenr);
+
while(arrlen>0) {
switch(otypenr) {
- case 0:
+ case SDNA_TYPE_CHAR:
val= *olddata; break;
- case 1:
+ case SDNA_TYPE_UCHAR:
val= *( (unsigned char *)olddata); break;
- case 2:
+ case SDNA_TYPE_SHORT:
val= *( (short *)olddata); break;
- case 3:
+ case SDNA_TYPE_USHORT:
val= *( (unsigned short *)olddata); break;
- case 4:
+ case SDNA_TYPE_INT:
val= *( (int *)olddata); break;
- case 5:
+ case SDNA_TYPE_LONG:
val= *( (int *)olddata); break;
- case 6:
+ case SDNA_TYPE_ULONG:
val= *( (unsigned int *)olddata); break;
- case 7:
+ case SDNA_TYPE_FLOAT:
val= *( (float *)olddata); break;
- case 8:
+ case SDNA_TYPE_DOUBLE:
val= *( (double *)olddata); break;
+ case SDNA_TYPE_INT64:
+ val= *( (int64_t *)olddata); break;
}
switch(ctypenr) {
- case 0:
+ case SDNA_TYPE_CHAR:
*curdata= val; break;
- case 1:
+ case SDNA_TYPE_UCHAR:
*( (unsigned char *)curdata)= val; break;
- case 2:
+ case SDNA_TYPE_SHORT:
*( (short *)curdata)= val; break;
- case 3:
+ case SDNA_TYPE_USHORT:
*( (unsigned short *)curdata)= val; break;
- case 4:
+ case SDNA_TYPE_INT:
*( (int *)curdata)= val; break;
- case 5:
+ case SDNA_TYPE_LONG:
*( (int *)curdata)= val; break;
- case 6:
+ case SDNA_TYPE_ULONG:
*( (unsigned int *)curdata)= val; break;
- case 7:
+ case SDNA_TYPE_FLOAT:
if(otypenr<2) val/= 255;
*( (float *)curdata)= val; break;
- case 8:
+ case SDNA_TYPE_DOUBLE:
if(otypenr<2) val/= 255;
*( (double *)curdata)= val; break;
+ case SDNA_TYPE_INT64:
+ *( (int64_t *)curdata)= val; break;
}
olddata+= oldlen;
@@ -839,7 +834,8 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
return NULL;
}
-static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const char *name, char *curdata, short *old, char *olddata)
+static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
+ char *type, const char *name, char *curdata, short *old, char *olddata)
{
/* rules: test for NAME:
- name equal:
@@ -913,7 +909,8 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const cha
}
}
-static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur)
+static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
+ char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur)
{
/* Recursive!
* Per element from cur_struct, read data from old_struct.
@@ -1055,7 +1052,9 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
else {
- if( spc[0]==2 || spc[0]==3 ) { /* short-ushort */
+ if ( spc[0]==SDNA_TYPE_SHORT ||
+ spc[0]==SDNA_TYPE_USHORT )
+ {
/* exception: variable called blocktype/ipowin: derived from ID_ */
skip= 0;
@@ -1077,7 +1076,11 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
}
}
- else if(spc[0]>3 && spc[0]<8) { /* int-long-ulong-float */
+ else if ( (spc[0]==SDNA_TYPE_INT ||
+ spc[0]==SDNA_TYPE_LONG ||
+ spc[0]==SDNA_TYPE_ULONG ||
+ spc[0]==SDNA_TYPE_FLOAT))
+ {
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
@@ -1091,6 +1094,18 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
cpo+= 4;
}
}
+ else if ( (spc[0]==SDNA_TYPE_INT64)) {
+ mul= DNA_elem_array_size(name, strlen(name));
+ cpo= cur;
+ while(mul--) {
+ cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
+ cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
+ cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
+ cval= cpo[3]; cpo[3]= cpo[4]; cpo[4]= cval;
+
+ cpo+= 8;
+ }
+ }
}
}
cur+= elen;
@@ -1139,3 +1154,26 @@ int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const ch
return (int)((intptr_t)cp);
}
+int DNA_elem_type_size(const eSDNA_Type elem_nr)
+{
+ /* should containt all enum types */
+ switch (elem_nr) {
+ case SDNA_TYPE_CHAR:
+ case SDNA_TYPE_UCHAR:
+ return 1;
+ case SDNA_TYPE_SHORT:
+ case SDNA_TYPE_USHORT:
+ return 2;
+ case SDNA_TYPE_INT:
+ case SDNA_TYPE_LONG:
+ case SDNA_TYPE_ULONG:
+ case SDNA_TYPE_FLOAT:
+ return 4;
+ case SDNA_TYPE_DOUBLE:
+ case SDNA_TYPE_INT64:
+ return 8;
+ }
+
+ /* weak */
+ return 8;
+}
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 11ab9b1efcf..0c417e9f884 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -928,16 +928,18 @@ static int make_structDNA(char *baseDirectory, FILE *file)
/* insertion of all known types */
/* watch it: uint is not allowed! use in structs an unsigned int */
- add_type("char", 1); /* 0 */
- add_type("uchar", 1); /* 1 */
- add_type("short", 2); /* 2 */
- add_type("ushort", 2); /* 3 */
- add_type("int", 4); /* 4 */
- add_type("long", 4); /* 5 */ /* should it be 8 on 64 bits? */
- add_type("ulong", 4); /* 6 */
- add_type("float", 4); /* 7 */
- add_type("double", 8); /* 8 */
- add_type("void", 0); /* 9 */
+ /* watch it: sizes must match DNA_elem_type_size() */
+ add_type("char", 1); /* SDNA_TYPE_CHAR */
+ add_type("uchar", 1); /* SDNA_TYPE_UCHAR */
+ add_type("short", 2); /* SDNA_TYPE_SHORT */
+ add_type("ushort", 2); /* SDNA_TYPE_USHORT */
+ add_type("int", 4); /* SDNA_TYPE_INT */
+ add_type("long", 4); /* SDNA_TYPE_LONG */ /* should it be 8 on 64 bits? */
+ add_type("ulong", 4); /* SDNA_TYPE_ULONG */
+ add_type("float", 4); /* SDNA_TYPE_FLOAT */
+ add_type("double", 8); /* SDNA_TYPE_DOUBLE */
+ add_type("int64_t", 8); /* SDNA_TYPE_INT64 */
+ add_type("void", 0); /* SDNA_TYPE_VOID */
// the defines above shouldn't be output in the padding file...
firststruct = nr_types;
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 8e8dd559fb1..4fb08227fb6 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -175,6 +175,8 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
void RNA_def_property_srna(PropertyRNA *prop, const char *type);
void RNA_def_py_data(PropertyRNA *prop, void *py_data);
+void RNA_def_property_translation_context(PropertyRNA *prop, const char *context);
+
/* Function */
FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const char *call);
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index fbe9ed33063..90e68058d36 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -2229,6 +2229,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
fprintf(f, "%d,\n", prop->icon);
+ rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n\t");
fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 02b1fa300fb..c50e233c43f 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -486,8 +486,12 @@ static const char *rna_ensure_property_name(PropertyRNA *prop)
name= ((IDProperty*)prop)->name;
#ifdef WITH_INTERNATIONAL
- if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE))
- name= BLF_gettext(name);
+ if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) {
+ if(prop->translation_context)
+ name = BLF_pgettext(prop->translation_context, name);
+ else
+ name = BLF_gettext(name);
+ }
#endif
return name;
@@ -837,12 +841,17 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
PropertySubType subtype= rna_ensure_property(prop)->subtype;
/* get string to use for array index */
- if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE))
+ if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
return quatitem[index];
- else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
+ }
+ else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
+ PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
+ {
return vectoritem[index];
- else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA))
+ }
+ else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
return coloritem[index];
+ }
return '\0';
}
@@ -865,7 +874,9 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
return 3;
}
}
- else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) {
+ else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
+ PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
+ {
switch (name) {
case 'x':
return 0;
@@ -1187,8 +1198,12 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
}
for(i=0; nitem[i].identifier; i++) {
- if( nitem[i].name )
- nitem[i].name = BLF_gettext(nitem[i].name);
+ if( nitem[i].name ) {
+ if(prop->translation_context)
+ nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name);
+ else
+ nitem[i].name = BLF_gettext(nitem[i].name);
+ }
if( nitem[i].description )
nitem[i].description = BLF_gettext(nitem[i].description);
}
@@ -1519,7 +1534,8 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
/* find cache element for which key matches... */
for (uce = rna_updates_cache.first; uce; uce = uce->next) {
/* just match by id only for now, since most update calls that we'll encounter only really care about this */
- // TODO: later, the cache might need to have some nesting on L1 to cope better with these problems + some tagging to indicate we need this
+ /* TODO: later, the cache might need to have some nesting on L1 to cope better
+ * with these problems + some tagging to indicate we need this */
if (uce->ptr.id.data == ptr->id.data)
break;
}
@@ -4969,7 +4985,9 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle
return 0;
}
-static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type, char ftype, int len, void *dest, void *src, StructRNA *srna, const char *tid, const char *fid, const char *pid)
+static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type,
+ char ftype, int len, void *dest, void *src, StructRNA *srna,
+ const char *tid, const char *fid, const char *pid)
{
/* ptr is always a function pointer, prop always a parameter */
@@ -5055,7 +5073,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
}
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, an object of type %s was expected, passed an object of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
+ fprintf(stderr, "%s.%s: wrong type for parameter %s, "
+ "an object of type %s was expected, passed an object of type %s\n",
+ tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
return -1;
}
@@ -5080,7 +5100,10 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
ptype= RNA_property_pointer_type(ptr, prop);
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection of objects of type %s was expected, passed a collection of objects of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
+ fprintf(stderr, "%s.%s: wrong type for parameter %s, "
+ "a collection of objects of type %s was expected, "
+ "passed a collection of objects of type %s\n",
+ tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
return -1;
}
@@ -5159,7 +5182,10 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
if (len!=alen) {
err= -1;
- fprintf(stderr, "%s.%s: for parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
+ fprintf(stderr, "%s.%s: for parameter %s, "
+ "was expecting an array of %i elements, "
+ "passed %i elements instead\n",
+ tid, fid, pid, len, alen);
break;
}
@@ -5224,7 +5250,9 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
if (len!=alen) {
err= -1;
- fprintf(stderr, "%s.%s: for return parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
+ fprintf(stderr, "%s.%s: for return parameter %s, "
+ "was expecting an array of %i elements, passed %i elements instead\n",
+ tid, fid, pid, len, alen);
}
else {
switch (type) {
@@ -5278,7 +5306,8 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
return err;
}
-int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args)
+int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr,
+ const char *identifier, const char *format, va_list args)
{
FunctionRNA *func;
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index e55559c39dc..caf43793996 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1824,6 +1824,11 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
}
}
+void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
+{
+ prop->translation_context= context;
+}
+
/* Functions */
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 960d3155fd5..40157d390bc 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -147,6 +147,8 @@ struct PropertyRNA {
const char *description;
/* icon ID */
int icon;
+ /* context for translation */
+ const char *translation_context;
/* property type as it appears to the outside */
PropertyType type;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 40b6d5b96e4..8794914e727 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -415,8 +415,8 @@ static void rna_def_material_mtex(BlenderRNA *brna)
{MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""},
{MTEX_3TAP_BUMP, "BUMP_LOW_QUALITY", 0, "Low Quality", "Use 3 tap filtering"},
{MTEX_5TAP_BUMP, "BUMP_MEDIUM_QUALITY", 0, "Medium Quality", "Use 5 tap filtering"},
- {MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering. Requires OpenGL 3.0+. "
- "It will fall back on medium setting for other systems"},
+ {MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering (requires OpenGL 3.0+, "
+ "it will fall back on medium setting for other systems)"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_bump_space_items[] = {
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 1330c57974d..846fb751d7a 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2537,6 +2537,11 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ prop= RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_INDICES);
+ RNA_def_property_ui_text(prop, "Indices", "Displays the index numbers of selected vertices, edges, and faces");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
/* editflag */
prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index 3b1ac8f22c3..fbc6a0155f2 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -78,6 +78,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
{IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "Use images in the order they are recorded"},
{IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "Use global timestamp written by recording device"},
{IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)", "Interpolate a global timestamp using the record date and time written by recording device"},
+ {IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps", "Record run, but ignore timecode, changes in framerate or dropouts"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 9a141dde3db..676d5f2c44f 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -465,6 +465,20 @@ static int rna_Property_description_length(PointerRNA *ptr)
return prop->description ? strlen(prop->description) : 0;
}
+static void rna_Property_translation_context_get(PointerRNA *ptr, char *value)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, prop->translation_context ? prop->translation_context:"");
+}
+
+static int rna_Property_translation_context_length(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->translation_context ? strlen(prop->translation_context) : 0;
+}
+
static int rna_Property_type_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -1047,6 +1061,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");
+ prop= RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get", "rna_Property_translation_context_length", NULL);
+ RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property");
+
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, property_type_items);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index a193f5d0f33..51239cd55b1 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2117,7 +2117,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "exitkey");
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
- RNA_def_property_ui_text(prop, "Exit Key", "Sets the key that exits the Game Engine");
+ RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine");
RNA_def_property_update(prop, NC_SCENE, NULL);
// Do we need it here ? (since we already have it in World
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index f9b20d3ac78..c0a644f5758 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2607,40 +2607,43 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* hardcoded here, could become dynamic somehow */
/* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */
/* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */
+ /* Note: As this list is in alphabetical order, and not defined order,
+ * here is the highest define currently in use: 28 (serbian latin). */
static EnumPropertyItem language_items[] = {
- {0, "", 0, "Nearly done", ""},
- {0, "DEFAULT", 0, "Default (Default)", ""},
- {1, "ENGLISH", 0, "English (English)", "en_US"},
- {8, "FRENCH", 0, "French (Français)", "fr_FR"},
- {4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"},
+ { 0, "", 0, "Nearly done", ""},
+ { 0, "DEFAULT", 0, "Default (Default)", ""},
+ { 1, "ENGLISH", 0, "English (English)", "en_US"},
+ { 8, "FRENCH", 0, "French (Français)", "fr_FR"},
+ { 4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"},
{15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"},
{13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"},
- {9, "SPANISH", 0, "Spanish (Español)", "es"},
+ { 9, "SPANISH", 0, "Spanish (Español)", "es"},
{14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"},
- {0, "", 0, "In progress", ""},
- {2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
- {3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
- {5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
- {6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
- {7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
- {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
- {11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
- {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
- {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
- {17, "SERBIAN", 0, "Serbian (Српском језику)", "sr_RS"},
- {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
- {19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
- {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
+ { 0, "", 0, "In progress", ""},
/* using the utf8 flipped form of Arabic (العربية) */
{21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"},
+ {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
{22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},
+ {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
+ {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
+ {11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
+ { 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
+ { 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
+ { 5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
{23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},
+ {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
+ { 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
{24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"},
{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},
/* using the utf8 flipped form of Persian (فارسی) */
{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"},
- {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
- {0, NULL, 0, NULL, NULL}};
+ {19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
+ {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
+ {17, "SERBIAN", 0, "Serbian (Српски)", "sr"},
+ {28, "SERBIAN_LATIN", 0, "Serbian latin (Srpski latinica)", "sr@latin"},
+ { 7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
+ {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
+ { 0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 2a4b700ce1d..732a46cb8b6 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -399,29 +399,37 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(tdw);
return dm;
}
- indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
- memcpy(indices, tidx, sizeof(int) * numIdx);
- org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
+ if(numIdx != numVerts) {
+ indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
+ memcpy(indices, tidx, sizeof(int) * numIdx);
+ org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
+ memcpy(org_w, tw, sizeof(float) * numIdx);
+ dw = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGProximity Modifier, dw");
+ memcpy(dw, tdw, sizeof(MDeformWeight*) * numIdx);
+ MEM_freeN(tw);
+ MEM_freeN(tdw);
+ }
+ else {
+ org_w = tw;
+ dw = tdw;
+ }
new_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, new_w");
- memcpy(org_w, tw, sizeof(float) * numIdx);
- dw = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGProximity Modifier, dw");
- memcpy(dw, tdw, sizeof(MDeformWeight*) * numIdx);
MEM_freeN(tidx);
- MEM_freeN(tw);
- MEM_freeN(tdw);
/* Get our vertex coordinates. */
- {
+ v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
+ if(numIdx != numVerts) {
/* XXX In some situations, this code can be up to about 50 times more performant
* than simply using getVertCo for each affected vertex...
*/
float (*tv_cos)[3] = MEM_mallocN(sizeof(float[3]) * numVerts, "WeightVGProximity Modifier, tv_cos");
- v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
dm->getVertCos(dm, tv_cos);
for (i = 0; i < numIdx; i++)
copy_v3_v3(v_cos[i], tv_cos[indices[i]]);
MEM_freeN(tv_cos);
}
+ else
+ dm->getVertCos(dm, v_cos);
/* Compute wanted distances. */
if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) {
@@ -497,7 +505,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(org_w);
MEM_freeN(new_w);
MEM_freeN(dw);
- MEM_freeN(indices);
+ if(indices)
+ MEM_freeN(indices);
MEM_freeN(v_cos);
#if DO_PROFILE
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index cad85d33a66..3a783f0f32d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -47,7 +47,8 @@ static bNodeSocketTemplate cmp_node_alphaover_out[]= {
static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
- if(over[3]<=0.0f) {
+ /* Zero alpha values should still permit an add of RGB data */
+ if(over[3]<0.0f) {
copy_v4_v4(out, src);
}
else if(fac[0]==1.0f && over[3]>=1.0f) {
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index c2fd6036414..e32444976dd 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -1304,6 +1304,7 @@ PyObject *BPyInit_bgl(void)
PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
+ Py_INCREF((PyObject *)&BGL_bufferType);
#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 1d1cab1c66d..2a4c004d84c 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -36,6 +36,12 @@
#include "RNA_access.h"
+#define USE_MATHUTILS
+
+#ifdef USE_MATHUTILS
+# include "../mathutils/mathutils.h" /* so we can have mathutils callbacks */
+#endif
+
#define MAX_ARRAY_DIMENSION 10
typedef void (*ItemConvertFunc)(PyObject *, char *);
@@ -259,10 +265,47 @@ static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop,
/* validate type first because length validation may modify property array length */
- if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1)
- return -1;
- return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
+#ifdef USE_MATHUTILS
+ if (lvalue_dim == 0) { /* only valid for first level array */
+ if (MatrixObject_Check(rvalue)) {
+ MatrixObject *pymat= (MatrixObject *)rvalue;
+
+ if (BaseMath_ReadCallback(pymat) == -1)
+ return -1;
+
+ if (RNA_property_type(prop) != PROP_FLOAT) {
+ PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign to non float array",
+ error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
+ return -1;
+ }
+ else if (totdim != 2) {
+ PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign array with %d dimensions",
+ error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), totdim);
+ return -1;
+ }
+ else if (pymat->num_col != dimsize[0] || pymat->num_row != dimsize[1]) {
+ PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign dimension size mismatch, "
+ "is %dx%d, expected be %dx%d",
+ error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop),
+ pymat->num_col, pymat->num_row, dimsize[0], dimsize[1]);
+ return -1;
+ }
+ else {
+ *totitem= dimsize[0] * dimsize[1];
+ return 0;
+ }
+ }
+ }
+#endif /* USE_MATHUTILS */
+
+
+ {
+ if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1)
+ return -1;
+
+ return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
+ }
}
static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *prop,
@@ -305,6 +348,26 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
return NULL;
}
+
+#ifdef USE_MATHUTILS
+ if (dim == 0) {
+ if (MatrixObject_Check(seq)) {
+ MatrixObject *pymat= (MatrixObject *)seq;
+ size_t allocsize= pymat->num_col * pymat->num_row * sizeof(float);
+
+ /* read callback already done by validate */
+ /* since this is the first iteration we can assume data is allocated */
+ memcpy(data, pymat->matrix, allocsize);
+
+ /* not really needed but do for completeness */
+ data += allocsize;
+
+ return data;
+ }
+ }
+#endif /* USE_MATHUTILS */
+
+
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);
if (item) {
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index a155a7ec3d9..66e8ff510ef 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -145,6 +145,14 @@ PyInit_gpu(void)
PyObject_SetAttrString(d, #f, val); \
Py_DECREF(val)
+PyDoc_STRVAR(GPU_export_shader_doc,
+"export_shader(scene, material)\n"
+"\n"
+" Returns the GLSL shader that produces the visual effect of material in scene.\n"
+"\n"
+" :return: Dictionary defining the shader, uniforms and attributes.\n"
+" :rtype: Dict"
+);
static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
{
PyObject* pyscene;
@@ -279,11 +287,9 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
return result;
}
-static PyMethodDef meth_export_shader[] = {{ "export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS,
- "export_shader(scene,material)\n\n"
- "Returns the GLSL shader that produces the visual effect of material in scene.\n\n"
- ":return: Dictionary defining the shader, uniforms and attributes.\n"
- ":rtype: Dict"}};
+static PyMethodDef meth_export_shader[] = {
+ {"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc}
+};
PyObject* GPU_initPython(void)
{
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 1dfd7c574dd..1147930ff65 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -456,6 +456,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
Py_INCREF(item);
mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
+ mathutils_matrix_column_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_column_cb);
return submodule;
}
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 59aad37f746..de098ce8bd8 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -42,7 +42,7 @@ static PyObject *Matrix_copy(MatrixObject *self);
static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value);
static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self);
-/* matrix vector callbacks */
+/* matrix row callbacks */
int mathutils_matrix_vector_cb_index= -1;
static int mathutils_matrix_vector_check(BaseMathObject *bmo)
@@ -51,56 +51,56 @@ static int mathutils_matrix_vector_check(BaseMathObject *bmo)
return BaseMath_ReadCallback(self);
}
-static int mathutils_matrix_vector_get(BaseMathObject *bmo, int col)
+static int mathutils_matrix_vector_get(BaseMathObject *bmo, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
- int row;
+ int col;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- for (row=0; row < self->num_row; row++) {
- bmo->data[row] = MATRIX_ITEM(self, row, col);
+ for (col=0; col < self->num_col; col++) {
+ bmo->data[col] = MATRIX_ITEM(self, row, col);
}
return 0;
}
-static int mathutils_matrix_vector_set(BaseMathObject *bmo, int col)
+static int mathutils_matrix_vector_set(BaseMathObject *bmo, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
- int row;
+ int col;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- for (row=0; row < self->num_row; row++) {
- MATRIX_ITEM(self, row, col) = bmo->data[row];
+ for (col=0; col < self->num_col; col++) {
+ MATRIX_ITEM(self, row, col) = bmo->data[col];
}
(void)BaseMath_WriteCallback(self);
return 0;
}
-static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int col, int row)
+static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int row, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- bmo->data[row]= MATRIX_ITEM(self, row, col);
+ bmo->data[col]= MATRIX_ITEM(self, row, col);
return 0;
}
-static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int col, int row)
+static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int row, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- MATRIX_ITEM(self, row, col) = bmo->data[row];
+ MATRIX_ITEM(self, row, col) = bmo->data[col];
(void)BaseMath_WriteCallback(self);
return 0;
@@ -115,6 +115,87 @@ Mathutils_Callback mathutils_matrix_vector_cb = {
};
/* matrix vector callbacks, this is so you can do matrix[i][j] = val */
+/* matrix row callbacks */
+int mathutils_matrix_column_cb_index= -1;
+
+static int mathutils_matrix_column_check(BaseMathObject *bmo)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ return BaseMath_ReadCallback(self);
+}
+
+static int mathutils_matrix_column_get(BaseMathObject *bmo, int col)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ int num_row;
+ int row;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ /* for 'translation' size will always be '3' even on 4x4 vec */
+ num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
+
+ for (row = 0; row < num_row; row++) {
+ bmo->data[row] = MATRIX_ITEM(self, row, col);
+ }
+
+ return 0;
+}
+
+static int mathutils_matrix_column_set(BaseMathObject *bmo, int col)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ int num_row;
+ int row;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ /* for 'translation' size will always be '3' even on 4x4 vec */
+ num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
+
+ for (row = 0; row < num_row; row++) {
+ MATRIX_ITEM(self, row, col) = bmo->data[row];
+ }
+
+ (void)BaseMath_WriteCallback(self);
+ return 0;
+}
+
+static int mathutils_matrix_column_get_index(BaseMathObject *bmo, int col, int row)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ bmo->data[row]= MATRIX_ITEM(self, row, col);
+ return 0;
+}
+
+static int mathutils_matrix_column_set_index(BaseMathObject *bmo, int col, int row)
+{
+ MatrixObject *self= (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ MATRIX_ITEM(self, row, col) = bmo->data[row];
+
+ (void)BaseMath_WriteCallback(self);
+ return 0;
+}
+
+Mathutils_Callback mathutils_matrix_column_cb = {
+ mathutils_matrix_column_check,
+ mathutils_matrix_column_get,
+ mathutils_matrix_column_set,
+ mathutils_matrix_column_get_index,
+ mathutils_matrix_column_set_index
+};
+/* matrix column callbacks, this is so you can do matrix.translation = Vector() */
+
//----------------------------------mathutils.Matrix() -----------------
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
//create a new matrix type
@@ -134,15 +215,19 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *arg= PyTuple_GET_ITEM(args, 0);
+ /* Input is now as a sequence of rows so length of sequence
+ * is the number of rows */
/* -1 is an error, size checks will accunt for this */
- const unsigned short num_col= PySequence_Size(arg);
+ const unsigned short num_row= PySequence_Size(arg);
- if (num_col >= 2 && num_col <= 4) {
+ if (num_row >= 2 && num_row <= 4) {
PyObject *item= PySequence_GetItem(arg, 0);
- const unsigned short num_row= PySequence_Size(item);
+ /* Since each item is a row, number of items is the
+ * same as the number of columns */
+ const unsigned short num_col= PySequence_Size(item);
Py_XDECREF(item);
- if (num_row >= 2 && num_row <= 4) {
+ if (num_col >= 2 && num_col <= 4) {
/* sane row & col size, new matrix and assign as slice */
PyObject *matrix= Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, type);
if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
@@ -761,7 +846,8 @@ PyDoc_STRVAR(Matrix_resize_4x4_doc,
);
static PyObject *Matrix_resize_4x4(MatrixObject *self)
{
- int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
+ float mat[16];
+ int col;
if (self->wrapped==Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
@@ -784,30 +870,14 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
return NULL;
}
- /*move data to new spot in array + clean*/
- for (blank_rows = (4 - self->num_col); blank_rows > 0; blank_rows--) {
- for (x = 0; x < 4; x++) {
- index = (4 * (self->num_col + (blank_rows - 1))) + x;
- if (index == 10 || index == 15) {
- self->matrix[index] = 1.0f;
- }
- else {
- self->matrix[index] = 0.0f;
- }
- }
- }
- for (x = 1; x <= self->num_col; x++) {
- first_row_elem = (self->num_row * (self->num_col - x));
- curr_pos = (first_row_elem + (self->num_row -1));
- new_pos = (4 * (self->num_col - x)) + (curr_pos - first_row_elem);
- for (blank_columns = (4 - self->num_row); blank_columns > 0; blank_columns--) {
- self->matrix[new_pos + blank_columns] = 0.0f;
- }
- for ( ; curr_pos >= first_row_elem; curr_pos--) {
- self->matrix[new_pos] = self->matrix[curr_pos];
- new_pos--;
- }
+ unit_m4((float (*)[4])mat);
+
+ for (col = 0; col < self->num_col; col++) {
+ memcpy(mat + (4 * col), MATRIX_COL_PTR(self, col), self->num_row * sizeof(float));
}
+
+ copy_m4_m4((float (*)[4])self->matrix, (float (*)[4])mat);
+
self->num_col = 4;
self->num_row = 4;
@@ -1298,13 +1368,13 @@ static PyObject *Matrix_repr(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- for (col = 0; col < self->num_col; col++) {
- rows[col]= PyTuple_New(self->num_row);
- for (row = 0; row < self->num_row; row++) {
- PyTuple_SET_ITEM(rows[col], row, PyFloat_FromDouble(MATRIX_ITEM(self, row, col)));
+ for (row = 0; row < self->num_row; row++) {
+ rows[row]= PyTuple_New(self->num_col);
+ for (col = 0; col < self->num_col; col++) {
+ PyTuple_SET_ITEM(rows[row], col, PyFloat_FromDouble(MATRIX_ITEM(self, row, col)));
}
}
- switch (self->num_col) {
+ switch (self->num_row) {
case 2: return PyUnicode_FromFormat("Matrix((%R,\n"
" %R))", rows[0], rows[1]);
@@ -1402,44 +1472,48 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op)
sequence length*/
static int Matrix_len(MatrixObject *self)
{
- return (self->num_col);
+ return (self->num_row);
}
/*----------------------------object[]---------------------------
sequence accessor (get)
the wrapped vector gives direct access to the matrix data*/
-static PyObject *Matrix_item(MatrixObject *self, int i)
+static PyObject *Matrix_item(MatrixObject *self, int row)
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (i < 0 || i >= self->num_col) {
+ if (row < 0 || row >= self->num_row) {
PyErr_SetString(PyExc_IndexError,
"matrix[attribute]: "
"array index out of range");
return NULL;
}
- return Vector_CreatePyObject_cb((PyObject *)self, self->num_row, mathutils_matrix_vector_cb_index, i);
+ return Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_vector_cb_index, row);
}
/*----------------------------object[]-------------------------
sequence accessor (set) */
-static int Matrix_ass_item(MatrixObject *self, int i, PyObject *value)
+static int Matrix_ass_item(MatrixObject *self, int row, PyObject *value)
{
+ int col;
float vec[4];
if (BaseMath_ReadCallback(self) == -1)
return -1;
- if (i >= self->num_col || i < 0) {
+ if (row >= self->num_row || row < 0) {
PyErr_SetString(PyExc_IndexError,
- "matrix[attribute] = x: bad column");
+ "matrix[attribute] = x: bad row");
return -1;
}
- if (mathutils_array_parse(vec, self->num_row, self->num_row, value, "matrix[i] = value assignment") < 0) {
+ if (mathutils_array_parse(vec, self->num_col, self->num_col, value, "matrix[i] = value assignment") < 0) {
return -1;
}
- memcpy(MATRIX_COL_PTR(self, i), vec, self->num_row * sizeof(float));
+ /* Since we are assigning a row we cannot memcpy */
+ for (col = 0; col < self->num_col; col++) {
+ MATRIX_ITEM(self, row, col) = vec[col];
+ }
(void)BaseMath_WriteCallback(self);
return 0;
@@ -1456,14 +1530,14 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- CLAMP(begin, 0, self->num_col);
- CLAMP(end, 0, self->num_col);
+ CLAMP(begin, 0, self->num_row);
+ CLAMP(end, 0, self->num_row);
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
for (count= begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin,
- Vector_CreatePyObject_cb((PyObject *)self, self->num_row, mathutils_matrix_vector_cb_index, count));
+ Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_vector_cb_index, count));
}
@@ -1478,8 +1552,8 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
if (BaseMath_ReadCallback(self) == -1)
return -1;
- CLAMP(begin, 0, self->num_col);
- CLAMP(end, 0, self->num_col);
+ CLAMP(begin, 0, self->num_row);
+ CLAMP(end, 0, self->num_row);
begin = MIN2(begin, end);
/* non list/tuple cases */
@@ -1489,8 +1563,9 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
}
else {
const int size= end - begin;
- int i;
+ int row, col;
float mat[16];
+ float vec[4];
if (PySequence_Fast_GET_SIZE(value_fast) != size) {
Py_DECREF(value_fast);
@@ -1500,22 +1575,25 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
return -1;
}
+ memcpy(mat, self->matrix, self->num_col * self->num_row * sizeof(float));
+
/*parse sub items*/
- for (i = 0; i < size; i++) {
+ for (row = begin; row < end; row++) {
/*parse each sub sequence*/
- PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i);
+ PyObject *item= PySequence_Fast_GET_ITEM(value_fast, row - begin);
- if (mathutils_array_parse(&mat[i * self->num_row], self->num_row, self->num_row, item,
- "matrix[begin:end] = value assignment") < 0)
- {
+ if (mathutils_array_parse(vec, self->num_col, self->num_col, item, "matrix[begin:end] = value assignment") < 0)
return -1;
+
+ for (col = 0; col < self->num_col; col++) {
+ mat[col * self->num_row + row] = vec[col];
}
}
Py_DECREF(value_fast);
/*parsed well - now set in matrix*/
- memcpy(self->matrix + (begin * self->num_row), mat, sizeof(float) * (size * self->num_row));
+ memcpy(self->matrix, mat, self->num_col * self->num_row * sizeof(float));
(void)BaseMath_WriteCallback(self);
return 0;
@@ -1598,6 +1676,7 @@ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
{
float scalar;
+ int vec_size;
MatrixObject *mat1 = NULL, *mat2 = NULL;
@@ -1621,12 +1700,19 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
double dot = 0.0f;
int col, row, item;
+ if (mat1->num_col != mat2->num_row) {
+ PyErr_SetString(PyExc_ValueError,
+ "matrix1 * matrix2: matrix1 number of columns "
+ "and the matrix2 number of rows must be the same");
+ return NULL;
+ }
+
for (col = 0; col < mat2->num_col; col++) {
for (row = 0; row < mat1->num_row; row++) {
for (item = 0; item < mat1->num_col; item++) {
dot += MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col);
}
- mat[((col * mat1->num_row) + row)] = (float)dot;
+ mat[(col * mat1->num_row) + row] = (float)dot;
dot = 0.0f;
}
}
@@ -1640,7 +1726,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
}
}
else if (mat1) {
- /*VEC * MATRIX */
+ /* MATRIX * VECTOR */
if (VectorObject_Check(m2)) {
VectorObject *vec2= (VectorObject *)m2;
float tvec[4];
@@ -1650,7 +1736,14 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
return NULL;
}
- return Vector_CreatePyObject(tvec, vec2->size, Py_NEW, Py_TYPE(m2));
+ if (mat1->num_col == 4 && vec2->size == 3) {
+ vec_size = 3;
+ }
+ else {
+ vec_size = mat1->num_row;
+ }
+
+ return Vector_CreatePyObject(tvec, vec_size, Py_NEW, Py_TYPE(m2));
}
/*FLOAT/INT * MATRIX */
else if (((scalar= PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred())==0) {
@@ -1813,6 +1906,51 @@ static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure))
return PyLong_FromLong((long) self->num_row);
}
+static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure))
+{
+ PyObject *ret;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ /*must be 4x4 square matrix*/
+ if (self->num_row != 4 || self->num_col != 4) {
+ PyErr_SetString(PyExc_AttributeError,
+ "Matrix.translation: "
+ "inappropriate matrix size, must be 4x4");
+ return NULL;
+ }
+
+ ret = (PyObject *)Vector_CreatePyObject_cb((PyObject *)self, 3, mathutils_matrix_column_cb_index, 3);
+
+ return ret;
+}
+
+static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNUSED(closure))
+{
+ float tvec[3];
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ /*must be 4x4 square matrix*/
+ if (self->num_row != 4 || self->num_col != 4) {
+ PyErr_SetString(PyExc_AttributeError,
+ "Matrix.translation: "
+ "inappropriate matrix size, must be 4x4");
+ return -1;
+ }
+
+ if ((mathutils_array_parse(tvec, 3, 3, value, "Matrix.translation")) == -1)
+ return -1;
+
+ copy_v3_v3(((float (*)[4])self->matrix)[3], tvec);
+
+ (void)BaseMath_WriteCallback(self);
+
+ return 0;
+}
+
static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure))
{
float mat[3][3];
@@ -1876,6 +2014,7 @@ static PyGetSetDef Matrix_getseters[] = {
{(char *)"row_size", (getter)Matrix_getRowSize, (setter)NULL, (char *)"The row size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"col_size", (getter)Matrix_getColSize, (setter)NULL, (char *)"The column size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL},
+ {(char *)"translation", (getter)Matrix_translation_get, (setter)Matrix_translation_set, (char *)"The translation component of the matrix.\n\n:type: Vector", NULL},
{(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, (char *)"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index 91a276b648e..e7bfc06b98b 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -71,7 +71,9 @@ PyObject *Matrix_CreatePyObject(float *mat,
PyObject *Matrix_CreatePyObject_cb(PyObject *user, int num_col, int num_row, int cb_type, int cb_subtype);
extern int mathutils_matrix_vector_cb_index;
+extern int mathutils_matrix_column_cb_index;
extern struct Mathutils_Callback mathutils_matrix_vector_cb;
+extern struct Mathutils_Callback mathutils_matrix_column_cb;
void matrix_as_3x3(float mat[3][3], MatrixObject *self);
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index bd121b6177f..c31835cf7b5 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1540,6 +1540,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
float scalar;
+ int vec_size;
if VectorObject_Check(v1) {
vec1= (VectorObject *)v1;
@@ -1576,7 +1577,14 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
return NULL;
}
- return Vector_CreatePyObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1));
+ if (((MatrixObject *)v2)->num_row == 4 && vec1->size == 3) {
+ vec_size = 3;
+ }
+ else {
+ vec_size = ((MatrixObject *)v2)->num_col;
+ }
+
+ return Vector_CreatePyObject(tvec, vec_size, Py_NEW, Py_TYPE(vec1));
}
else if (QuaternionObject_Check(v2)) {
/* VEC * QUAT */
@@ -2603,7 +2611,7 @@ if len(unique) != len(items):
*/
/* ROW VECTOR Multiplication - Vector X Matrix
- * [x][y][z] * [1][4][7]
+ * [x][y][z] * [1][4][7]
* [2][5][8]
* [3][6][9]
* vector/matrix multiplication IS NOT COMMUTATIVE!!!! */
@@ -2611,18 +2619,18 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
{
float vec_cpy[MAX_DIMENSIONS];
double dot = 0.0f;
- int x, y, z= 0, vec_size= vec->size;
+ int row, col, z= 0, vec_size= vec->size;
if (mat->num_row != vec_size) {
- if (mat->num_row == 4 && vec_size != 3) {
+ if (mat->num_row == 4 && vec_size == 3) {
+ vec_cpy[3] = 1.0f;
+ }
+ else {
PyErr_SetString(PyExc_ValueError,
"vector * matrix: matrix column size "
"and the vector size must be the same");
return -1;
}
- else {
- vec_cpy[3] = 1.0f;
- }
}
if (BaseMath_ReadCallback(vec) == -1 || BaseMath_ReadCallback(mat) == -1)
@@ -2632,9 +2640,9 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
rvec[3] = 1.0f;
//muliplication
- for (x = 0; x < mat->num_col; x++) {
- for (y = 0; y < mat->num_row; y++) {
- dot += MATRIX_ITEM(mat, y, x) * vec_cpy[y];
+ for (col = 0; col < mat->num_col; col++) {
+ for (row = 0; row < mat->num_row; row++) {
+ dot += MATRIX_ITEM(mat, row, col) * vec_cpy[row];
}
rvec[z++] = (float)dot;
dot = 0.0f;
diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp
index 20202319d44..14b4a7bcf9f 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -978,7 +978,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
xo=ocx1; yo=ocy1; zo=ocz1;
- labdao= ddalabda= MIN3(labdax,labday,labdaz);
+ ddalabda= MIN3(labdax,labday,labdaz);
vec2[0]= ox1;
vec2[1]= oy1;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 146245aa191..c5033c55d55 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -592,7 +592,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
{
MemArena *arena= NULL;
VertexTangent **vtangents= NULL;
- int a, iCalcNewMethod;
+ int a;
if(do_nmap_tangent) {
arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena");
@@ -680,8 +680,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
}
}
- iCalcNewMethod = 1;
- if(iCalcNewMethod!=0 && do_nmap_tangent!=0)
+ if(do_nmap_tangent!=0)
{
SRenderMeshToTangent mesh2tangent;
SMikkTSpaceContext sContext;
@@ -701,11 +700,9 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
sInterface.m_getNormal = GetNormal;
sInterface.m_setTSpaceBasic = SetTSpace;
- // 0 if failed
- iCalcNewMethod = genTangSpaceDefault(&sContext);
+ genTangSpaceDefault(&sContext);
}
-
if(arena)
BLI_memarena_free(arena);
if(vtangents)
@@ -1068,7 +1065,6 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
mul_v3_fl(cross, width);
}
- else width= 1.0f;
if(ma->mode & MA_TANGENT_STR)
flag= R_SMOOTH|R_TANGENT;
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index b62484a6995..f261ec41746 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -176,7 +176,6 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
if(inpr<t) continue;
else {
t= inpr-t;
- i= 1.0;
soft= 1.0;
if(t<lar->spotbl && lar->spotbl!=0.0f) {
/* soft area */
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index b8c4b05de50..41bfcb55068 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -2010,7 +2010,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
samples++;
- if (qsa->type == SAMP_TYPE_HALTON) {
+ if (qsa && qsa->type == SAMP_TYPE_HALTON) {
/* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */
if (adapt_thresh > 0.0f && (samples > max_samples/2) ) {
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 25575fa965f..43761be9d71 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -1026,7 +1026,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0);
yn= tin*mtex->colfac;
- zn= tin*mtex->alphafac;
+ //zn= tin*mtex->alphafac;
if(mtex->mapto & MAP_COL) {
zn= 1.0f-yn;
@@ -1112,10 +1112,8 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
if(ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
if(ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
- if((ma->mode & MA_HALOTEX) && ma->mtex[0]){
+ if((ma->mode & MA_HALOTEX) && ma->mtex[0])
har->tex= 1;
- i=1;
- }
for(i=0; i<MAX_MTEX; i++)
if(ma->mtex[i] && (ma->septex & (1<<i))==0) {
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 4d654beb287..b99bab04b10 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -269,14 +269,12 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
if(p1[2]<-ladist) t1= t3;
}
else {
- ok1= 1;
t1= t3;
}
if(ok2) {
if(p2[2]<-ladist) t2= t3;
}
else {
- ok2= 1;
t2= t3;
}
}
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 775e338db5b..cdc185160d5 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -833,7 +833,6 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand sort arena");
firstseg= NULL;
- sortseg= sortsegments;
totsegment= 0;
/* for all object instances */
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index a46ef3888d8..3637c2de1fb 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -746,7 +746,6 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct
float tr[3] = {1.0,1.0,1.0};
Isect is= {{0}};
float *startco, *endco;
- int intersect_type = VOL_BOUNDS_DEPTH;
memset(shr, 0, sizeof(ShadeResult));
@@ -755,12 +754,11 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct
if (shi->flippednor) {
startco = last_is->start;
endco = shi->co;
- intersect_type = VOL_BOUNDS_SS;
}
/* trace to find a backface, the other side bounds of the volume */
/* (ray intersect ignores front faces here) */
- else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, intersect_type)) {
+ else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) {
startco = shi->co;
endco = hitco;
}