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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-12-28 02:12:46 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-12-28 02:12:46 +0400
commit0896a227232f741b6028219a208ae60e78515406 (patch)
tree2ad38505a7d5c960bdcd5537dbc6e319165ac118 /source
parent6bfbb26f329f8d98a0ae0844f2cee0ba92c90d53 (diff)
parent0059b8dd96bf065406441112f604e59f65d844d6 (diff)
Merged changes in the trunk up to revision 42902.
Conflicts resolved: source/blender/editors/space_view3d/drawobject.c source/blender/makesdna/DNA_mesh_types.h source/blender/python/intern/bpy.c
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/BLF_translation.h5
-rw-r--r--source/blender/blenfont/intern/blf_lang.c134
-rw-r--r--source/blender/blenfont/intern/blf_translation.c46
-rw-r--r--source/blender/blenkernel/BKE_customdata.h10
-rw-r--r--source/blender/blenkernel/BKE_global.h1
-rw-r--r--source/blender/blenkernel/BKE_modifier.h6
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h2
-rw-r--r--source/blender/blenkernel/BKE_node.h2
-rw-r--r--source/blender/blenkernel/BKE_texture.h2
-rw-r--r--source/blender/blenkernel/BKE_writeffmpeg.h2
-rw-r--r--source/blender/blenkernel/depsgraph_private.h2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c162
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c6
-rw-r--r--source/blender/blenkernel/intern/customdata.c48
-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/image.c2
-rw-r--r--source/blender/blenkernel/intern/ipo.c9
-rw-r--r--source/blender/blenkernel/intern/mesh.c26
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c2
-rw-r--r--source/blender/blenkernel/intern/modifier.c9
-rw-r--r--source/blender/blenkernel/intern/movieclip.c15
-rw-r--r--source/blender/blenkernel/intern/node.c47
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c3
-rw-r--r--source/blender/blenkernel/intern/texture.c4
-rw-r--r--source/blender/blenkernel/intern/tracking.c22
-rw-r--r--source/blender/blenkernel/intern/unit.c10
-rw-r--r--source/blender/blenkernel/intern/writeavi.c3
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c10
-rw-r--r--source/blender/blenlib/BLI_dynstr.h11
-rw-r--r--source/blender/blenlib/BLI_math_vector.h1
-rw-r--r--source/blender/blenlib/BLI_md5.h45
-rw-r--r--source/blender/blenlib/BLI_utildefines.h24
-rw-r--r--source/blender/blenlib/CMakeLists.txt2
-rw-r--r--source/blender/blenlib/intern/BLI_dynstr.c13
-rw-r--r--source/blender/blenlib/intern/bpath.c18
-rw-r--r--source/blender/blenlib/intern/math_vector.c9
-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/blenlib/intern/storage.c4
-rw-r--r--source/blender/blenloader/BLO_sys_types.h8
-rw-r--r--source/blender/blenloader/CMakeLists.txt1
-rw-r--r--source/blender/blenloader/SConscript2
-rw-r--r--source/blender/blenloader/intern/readfile.c98
-rw-r--r--source/blender/blenloader/intern/writefile.c15
-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/include/ED_mesh.h14
-rw-r--r--source/blender/editors/include/ED_view3d.h10
-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_panel.c1
-rw-r--r--source/blender/editors/interface/interface_regions.c23
-rw-r--r--source/blender/editors/interface/interface_templates.c19
-rw-r--r--source/blender/editors/interface/interface_widgets.c8
-rw-r--r--source/blender/editors/interface/view2d.c3
-rw-r--r--source/blender/editors/mesh/editface.c238
-rw-r--r--source/blender/editors/mesh/editmesh.c5
-rw-r--r--source/blender/editors/mesh/meshtools.c226
-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.c17
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/screen/screen_ops.c103
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c15
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h21
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c34
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c72
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c121
-rw-r--r--source/blender/editors/space_clip/clip_ops.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c3
-rw-r--r--source/blender/editors/space_node/node_buttons.c3
-rw-r--r--source/blender/editors/space_node/node_draw.c99
-rw-r--r--source/blender/editors/space_node/node_edit.c286
-rw-r--r--source/blender/editors/space_node/node_intern.h15
-rw-r--r--source/blender/editors/space_node/node_ops.c4
-rw-r--r--source/blender/editors/space_node/node_select.c204
-rw-r--r--source/blender/editors/space_node/node_state.c154
-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_text/text_ops.c1
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c35
-rw-r--r--source/blender/editors/space_view3d/drawobject.c143
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c10
-rw-r--r--source/blender/editors/transform/transform.c5
-rw-r--r--source/blender/editors/transform/transform.h11
-rw-r--r--source/blender/editors/transform/transform_conversions.c34
-rw-r--r--source/blender/editors/transform/transform_snap.c90
-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_defs.h3
-rw-r--r--source/blender/makesdna/DNA_genfile.h21
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h15
-rw-r--r--source/blender/makesdna/DNA_movieclip_types.h2
-rw-r--r--source/blender/makesdna/DNA_object_types.h4
-rw-r--r--source/blender/makesdna/DNA_scene_types.h7
-rw-r--r--source/blender/makesdna/DNA_world_types.h1
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c168
-rw-r--r--source/blender/makesdna/intern/makesdna.c23
-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_nodetree.c10
-rw-r--r--source/blender/makesrna/intern/rna_object.c4
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c18
-rw-r--r--source/blender/makesrna/intern/rna_rna.c19
-rw-r--r--source/blender/makesrna/intern/rna_scene.c18
-rw-r--r--source/blender/makesrna/intern/rna_space.c17
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c47
-rw-r--r--source/blender/makesrna/intern/rna_world.c1
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c4
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c2
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c2
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c4
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c18
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c4
-rw-r--r--source/blender/modifiers/intern/MOD_smooth.c5
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c12
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c12
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c56
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c58
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c111
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c3
-rw-r--r--source/blender/nodes/shader/node_shader_util.c2
-rw-r--r--source/blender/python/generic/bgl.c5
-rw-r--r--source/blender/python/generic/bpy_internal_import.c99
-rw-r--r--source/blender/python/generic/idprop_py_api.c6
-rw-r--r--source/blender/python/generic/py_capi_utils.c2
-rw-r--r--source/blender/python/intern/bpy.c76
-rw-r--r--source/blender/python/intern/bpy_app.c35
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c82
-rw-r--r--source/blender/python/intern/bpy_driver.c88
-rw-r--r--source/blender/python/intern/bpy_interface.c212
-rw-r--r--source/blender/python/intern/bpy_interface_atexit.c18
-rw-r--r--source/blender/python/intern/bpy_intern_string.c12
-rw-r--r--source/blender/python/intern/bpy_library.c92
-rw-r--r--source/blender/python/intern/bpy_operator.c150
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c34
-rw-r--r--source/blender/python/intern/bpy_props.c451
-rw-r--r--source/blender/python/intern/bpy_rna.c1944
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c82
-rw-r--r--source/blender/python/intern/bpy_rna_array.c328
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c33
-rw-r--r--source/blender/python/intern/bpy_traceback.c20
-rw-r--r--source/blender/python/intern/bpy_util.c32
-rw-r--r--source/blender/python/intern/gpu.c25
-rw-r--r--source/blender/python/mathutils/mathutils.c181
-rw-r--r--source/blender/python/mathutils/mathutils.h14
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c167
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c148
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c1263
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h48
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c184
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c1502
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.h3
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c378
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c60
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m35
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c4
-rw-r--r--source/blender/quicktime/quicktime_export.h2
-rw-r--r--source/blender/render/intern/raytrace/rayobject_octree.cpp2
-rw-r--r--source/blender/render/intern/source/convertblender.c24
-rw-r--r--source/blender/render/intern/source/external_engine.c5
-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/render_texture.c6
-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
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c4
-rw-r--r--source/creator/CMakeLists.txt4
-rw-r--r--source/creator/creator.c2
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp1
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h166
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp3
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h2
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp179
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.h3
-rw-r--r--source/gameengine/Converter/KX_ConvertSensors.cpp182
-rw-r--r--source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h1
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp17
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.h1
-rw-r--r--source/gameengine/Ketsji/KX_IPO_SGController.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h6
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h49
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp16
-rw-r--r--source/gameengine/Rasterizer/RAS_2DFilterManager.cpp2
-rw-r--r--source/tests/CMakeLists.txt5
-rw-r--r--source/tests/bl_pyapi_mathutils.py163
209 files changed, 7441 insertions, 5290 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..6c27beb14a7 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -32,6 +32,8 @@
#include <stdlib.h>
#include <string.h>
+#include "BKE_global.h"
+
#include "BLF_api.h"
#include "BLF_translation.h" /* own include */
@@ -58,7 +60,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
@@ -82,8 +83,13 @@ static const char *locales[] = {
"catalan", "ca_AD",
"czech", "cs_CZ",
"ptb", "pt_BR",
+#if defined (_WIN32) && !defined(FREE_WINDOWS)
"Chinese (Simplified)_China.1252", "zh_CN",
"Chinese (Traditional)_China.1252", "zh_TW",
+#else
+ "chs", "zh_CN",
+ "cht", "zh_TW",
+#endif
"russian", "ru_RU",
"croatian", "hr_HR",
"serbian", "sr_RS",
@@ -96,7 +102,8 @@ static const char *locales[] = {
"korean", "ko_KR",
"nepali", "ne_NP",
"persian", "fa_PE",
- "indonesian", "id_ID"
+ "indonesian", "id_ID",
+ "serbian (latin)", "sr_RS@latin",
};
void BLF_lang_init(void)
@@ -115,15 +122,50 @@ void BLF_lang_init(void)
}
+/* get LANG/LANGUAGE environment variable */
+static void get_language_variable(const char *varname, char *var, int maxlen)
+{
+ char *env= getenv(varname);
+
+ if(env) {
+ char *s;
+
+ /* store defaul locale */
+ BLI_strncpy(var, env, maxlen);
+
+ /* use first language as default */
+ s= strchr(var, ':');
+ if(s)
+ s[0]= 0;
+ }
+}
+
+/* get language to be used based on locale(which might be empty when using default language) and
+ * LANG environment variable
+ */
+static void get_language(const char *locale, const char *lang, char *language, int maxlen)
+{
+ if(locale[0]) {
+ BLI_strncpy(language, locale, maxlen);
+ }
+ else {
+ char *s;
+
+ BLI_strncpy(language, lang, maxlen);
+
+ s= strchr(language, '.');
+ if(s)
+ s[0]= 0;
+ }
+}
+
/* XXX WARNING!!! IN osx somehow the previous function call jumps in this one??? (ton, ppc) */
void BLF_lang_set(const char *str)
{
char *locreturn;
const char *short_locale;
int ok= 1;
-#if defined (_WIN32) && !defined(FREE_WINDOWS)
- const char *long_locale = locales[ 2 * U.language];
-#endif
+ const char *long_locale = locales[2 * U.language];
if((U.transopts&USER_DOTRANSLATE)==0)
return;
@@ -149,50 +191,72 @@ void BLF_lang_set(const char *str)
locreturn= setlocale(LC_ALL, long_locale);
if (locreturn == NULL) {
- printf("Could not change locale to %s\n", long_locale);
+ if(G.f & G_DEBUG)
+ printf("Could not change locale to %s\n", long_locale);
+
ok= 0;
}
#else
{
- const char *locale;
- static char default_locale[64]="\0";
+ static char default_lang[64]="\0";
+ static char default_language[64]="\0";
- if(default_locale[0]==0) {
- char *env_language= getenv("LANGUAGE");
+ if(default_lang[0]==0)
+ get_language_variable("LANG", default_lang, sizeof(default_lang));
- if(env_language) {
- char *s;
+ if(default_language[0]==0)
+ get_language_variable("LANGUAGE", default_language, sizeof(default_language));
- /* store defaul locale */
- BLI_strncpy(default_locale, env_language, sizeof(default_locale));
+ if(short_locale[0]) {
+ if(G.f & G_DEBUG)
+ printf("Setting LANG= and LANGUAGE to %s\n", short_locale);
- /* use first language as default */
- s= strchr(default_locale, ':');
- if(s) s[0]= 0;
- }
+ BLI_setenv("LANG", short_locale);
+ BLI_setenv("LANGUAGE", short_locale);
}
+ else {
+ if(G.f & G_DEBUG)
+ printf("Setting LANG=%s and LANGUAGE=%s\n", default_lang, default_language);
- if(short_locale[0])
- locale= short_locale;
- else
- locale= default_locale;
-
- BLI_setenv("LANG", locale);
- BLI_setenv("LANGUAGE", locale);
+ BLI_setenv("LANG", default_lang);
+ BLI_setenv("LANGUAGE", default_language);
+ }
- locreturn= setlocale(LC_ALL, locale);
+ locreturn= setlocale(LC_ALL, short_locale);
- if (locreturn == NULL) {
- char *short_locale_utf8= BLI_sprintfN("%s.UTF-8", short_locale);
+ if(locreturn == NULL) {
+ char *short_locale_utf8= NULL;
- locreturn= setlocale(LC_ALL, short_locale_utf8);
+ if(short_locale[0]) {
+ short_locale_utf8= BLI_sprintfN("%s.UTF-8", short_locale);
+ locreturn= setlocale(LC_ALL, short_locale_utf8);
+ }
if (locreturn == NULL) {
- printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
+ char language[65];
+
+ get_language(long_locale, default_lang, language, sizeof(language));
+
+ if(G.f & G_DEBUG) {
+ if(short_locale[0])
+ printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
+ else
+ printf("Could not reset locale\n");
+
+ printf("Fallback to LANG=%s and LANGUAGE=%s\n", default_lang, language);
+ }
+
+ /* fallback to default settings */
+ BLI_setenv("LANG", default_lang);
+ BLI_setenv("LANGUAGE", language);
+
+ locreturn= setlocale(LC_ALL, "");
+
ok= 0;
}
- MEM_freeN(short_locale_utf8);
+ if(short_locale_utf8)
+ MEM_freeN(short_locale_utf8);
}
}
#endif
@@ -204,15 +268,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..0ddb6549717 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,41 @@ 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
+ (void)context;
+ return message;
+#endif
+}
+
int BLF_translate_iface(void)
{
#ifdef WITH_INTERNATIONAL
@@ -132,4 +177,3 @@ const char *BLF_translate_do_tooltip(const char *msgid)
return msgid;
#endif
}
-
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index f6b4240a026..a4cef2d6862 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -38,10 +38,12 @@
extern "C" {
#endif
+#include "../blenloader/BLO_sys_types.h" /* XXX, should have a more generic include for this */
+
struct ID;
struct CustomData;
struct CustomDataLayer;
-typedef unsigned int CustomDataMask;
+typedef uint64_t CustomDataMask;
extern const CustomDataMask CD_MASK_BAREMESH;
extern const CustomDataMask CD_MASK_MESH;
@@ -65,6 +67,8 @@ extern const CustomDataMask CD_MASK_FACECORNERS;
#define CD_DUPLICATE 4 /* do a full copy of all layers, only allowed if source
has same number of elements */
+#define CD_TYPE_AS_MASK(_type) (CustomDataMask)(1 << (CustomDataMask)(_type))
+
/* initialises a CustomData object with the same layer setup as source.
* mask is a bitfield where (mask & (1 << (layer type))) indicates
* if a layer should be copied or not. alloctype must be one of the above. */
@@ -121,9 +125,9 @@ int CustomData_number_of_layers(const struct CustomData *data, int type);
/* duplicate data of a layer with flag NOFREE, and remove that flag.
* returns the layer data */
-void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type);
+void *CustomData_duplicate_referenced_layer(struct CustomData *data, const int type, const int totelem);
void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
- int type, const char *name);
+ const int type, const char *name, const int totelem);
/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is
* zero for the layer type, so only layer types specified by the mask
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 5ccdd7c04af..7668d5392da 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -141,6 +141,7 @@ typedef struct Global {
#define G_FILE_RECOVER (1 << 23)
#define G_FILE_RELATIVE_REMAP (1 << 24)
#define G_FILE_HISTORY (1 << 25)
+#define G_FILE_MESH_COMPAT (1 << 26) /* BMesh option to save as older mesh format */
/* G.windowstate */
#define G_WINDOWSTATE_USERDEF 0
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 84f8995b480..23073a2d8eb 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -65,6 +65,11 @@ typedef enum {
* unless it's a mesh and can be exploded -> curve can also emit particles
*/
eModifierTypeType_DeformOrConstruct,
+
+ /* Like eModifierTypeType_Nonconstructive, but does not affect the geometry
+ * of the object, rather some of its CustomData layers.
+ * E.g. UVProject and WeightVG modifiers. */
+ eModifierTypeType_NonGeometrical,
} ModifierTypeType;
typedef enum {
@@ -311,6 +316,7 @@ int modifier_supportsMapping(struct ModifierData *md);
int modifier_couldBeCage(struct Scene *scene, struct ModifierData *md);
int modifier_isCorrectableDeformed(struct ModifierData *md);
int modifier_sameTopology(ModifierData *md);
+int modifier_nonGeometrical(ModifierData *md);
int modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
void modifier_setError(struct ModifierData *md, const char *format, ...)
#ifdef __GNUC__
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 4d16df8afa3..b41f038941d 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -60,7 +60,7 @@ void BKE_movieclip_update_scopes(struct MovieClip *clip, struct MovieClipUser *u
void BKE_movieclip_get_cache_segments(struct MovieClip *clip, struct MovieClipUser *user, int *totseg_r, int **points_r);
-void BKE_movieclip_build_proxy_frame(struct MovieClip *clip, struct MovieDistortion *distortion,
+void BKE_movieclip_build_proxy_frame(struct MovieClip *clip, int clip_flag, struct MovieDistortion *distortion,
int cfra, int *build_sizes, int build_count, int undistorted);
#define TRACK_CLEAR_UPTO 0
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 378e5872791..6234308048b 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -305,8 +305,6 @@ void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sc
void ntreeMakeLocal(struct bNodeTree *ntree);
int ntreeHasType(struct bNodeTree *ntree, int type);
-void ntreeSocketUseFlags(struct bNodeTree *ntree);
-
void ntreeUpdateTree(struct bNodeTree *ntree);
/* XXX Currently each tree update call does call to ntreeVerifyNodes too.
* Some day this should be replaced by a decent depsgraph automatism!
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 52fa52a5899..7f321abf48e 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -67,7 +67,7 @@ void free_plugin_tex(struct PluginTex *pit);
void init_colorband(struct ColorBand *coba, int rangetype);
struct ColorBand *add_colorband(int rangetype);
-int do_colorband(struct ColorBand *coba, float in, float out[4]);
+int do_colorband(const struct ColorBand *coba, float in, float out[4]);
void colorband_table_RGBA(struct ColorBand *coba, float **array, int *size);
int vergcband(const void *a1, const void *a2);
struct CBData *colorband_element_add(struct ColorBand *coba, float position);
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 3263a1659f3..257ed0ba15f 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -72,7 +72,7 @@ extern int append_ffmpeg(struct RenderData *rd, int frame, int *pixels, int rect
void filepath_ffmpeg(char* string, struct RenderData* rd);
extern void ffmpeg_set_preset(struct RenderData *rd, int preset);
-extern void ffmpeg_verify_image_type(struct RenderData *rd);
+extern void ffmpeg_verify_image_type(struct RenderData *rd, struct ImageFormatData *imf);
extern struct IDProperty *ffmpeg_property_add(struct RenderData *Rd, const char *type, int opt_index, int parent_index);
extern int ffmpeg_property_add_string(struct RenderData *rd, const char *type, const char *str);
diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h
index 2dd14281253..0338d10a66d 100644
--- a/source/blender/blenkernel/depsgraph_private.h
+++ b/source/blender/blenkernel/depsgraph_private.h
@@ -69,7 +69,7 @@ typedef struct DagNode
int ancestor_count;
unsigned int lay; // accumulated layers of its relations + itself
unsigned int scelay; // layers due to being in scene
- unsigned int customdata_mask; // customdata mask
+ uint64_t customdata_mask; // customdata mask
int lasttime; // if lasttime != DagForest->time, this node was not evaluated yet for flushing
int BFS_dist; // BFS distance
int DFS_dist; // DFS distance
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 06f29b95825..d0ef517e2ae 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -642,67 +642,71 @@ enum {
CALC_WP_AUTO_NORMALIZE= (1<<1)
};
+static void weightpaint_color(unsigned char r_col[4], ColorBand *coba, const float input)
+{
+ float colf[4];
+
+ if(coba) do_colorband(coba, input, colf);
+ else weight_to_rgb(colf, input);
+
+ r_col[3] = (unsigned char)(colf[0] * 255.0f);
+ r_col[2] = (unsigned char)(colf[1] * 255.0f);
+ r_col[1] = (unsigned char)(colf[2] * 255.0f);
+ r_col[0] = 255;
+}
+
+
static void calc_weightpaint_vert_color(
- Object *ob, const int defbase_tot, ColorBand *coba, int vert, unsigned char *col,
- const char *dg_flags, int selected, int UNUSED(unselected), const int draw_flag)
+ unsigned char r_col[4],
+ MDeformVert *dv, ColorBand *coba,
+ const int defbase_tot, const int defbase_act,
+ const char *dg_flags,
+ const int selected, const int draw_flag)
{
- Mesh *me = ob->data;
float input = 0.0f;
int make_black= FALSE;
- if (me->dvert) {
- MDeformVert *dvert= &me->dvert[vert];
-
- if ((selected > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
- int was_a_nonzero= FALSE;
- int i;
-
- MDeformWeight *dw= dvert->dw;
- for (i = dvert->totweight; i > 0; i--, dw++) {
- /* in multipaint, get the average if auto normalize is inactive
- * get the sum if it is active */
- if (dw->def_nr < defbase_tot) {
- if (dg_flags[dw->def_nr]) {
- if (dw->weight) {
- input += dw->weight;
- was_a_nonzero= TRUE;
- }
+ if ((selected > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
+ int was_a_nonzero= FALSE;
+ unsigned int i;
+
+ MDeformWeight *dw= dv->dw;
+ for (i = dv->totweight; i != 0; i--, dw++) {
+ /* in multipaint, get the average if auto normalize is inactive
+ * get the sum if it is active */
+ if (dw->def_nr < defbase_tot) {
+ if (dg_flags[dw->def_nr]) {
+ if (dw->weight) {
+ input += dw->weight;
+ was_a_nonzero= TRUE;
}
}
}
+ }
- /* make it black if the selected groups have no weight on a vertex */
- if (was_a_nonzero == FALSE) {
- make_black = TRUE;
- }
- else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
- input /= selected; /* get the average */
- }
+ /* make it black if the selected groups have no weight on a vertex */
+ if (was_a_nonzero == FALSE) {
+ make_black = TRUE;
}
- else {
- /* default, non tricky behavior */
- input= defvert_find_weight(dvert, ob->actdef-1);
+ else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
+ input /= selected; /* get the average */
}
}
-
- if (make_black) {
- col[3] = 0;
- col[2] = 0;
- col[1] = 0;
- col[0] = 255;
+ else {
+ /* default, non tricky behavior */
+ input= defvert_find_weight(dv, defbase_act);
+ }
+
+ if (make_black) { /* TODO, theme color */
+ r_col[3] = 0;
+ r_col[2] = 0;
+ r_col[1] = 0;
+ r_col[0] = 255;
}
else {
- float colf[4];
CLAMP(input, 0.0f, 1.0f);
-
- if(coba) do_colorband(coba, input, colf);
- else weight_to_rgb(colf, input);
-
- col[3] = (unsigned char)(colf[0] * 255.0f);
- col[2] = (unsigned char)(colf[1] * 255.0f);
- col[1] = (unsigned char)(colf[2] * 255.0f);
- col[0] = 255;
+ weightpaint_color(r_col, coba, input);
}
}
@@ -713,33 +717,65 @@ void vDM_ColorBand_store(ColorBand *coba)
stored_cb= coba;
}
+/* return an array of vertex weight colors, caller must free.
+ *
+ * note that we could save some memory and allocate RGB only but then we'd need to
+ * re-arrange the colors when copying to the face since MCol has odd ordering,
+ * so leave this as is - campbell */
+static unsigned char *calc_weightpaint_vert_array(Object *ob, int const draw_flag, ColorBand *coba)
+{
+ Mesh *me = ob->data;
+ unsigned char *wtcol_v = MEM_mallocN (sizeof(unsigned char) * me->totvert * 4, "weightmap_v");
+
+ if (me->dvert) {
+ unsigned char *wc = wtcol_v;
+ MDeformVert *dv= me->dvert;
+ unsigned int i;
+
+ /* varisbles for multipaint */
+ const int defbase_tot = BLI_countlist(&ob->defbase);
+ const int defbase_act = ob->actdef-1;
+ char *dg_flags = MEM_mallocN(defbase_tot * sizeof(char), __func__);
+ const int selected = get_selected_defgroups(ob, dg_flags, defbase_tot);
+ /* const int unselected = defbase_tot - selected; */ /* UNUSED */
+
+ for (i = me->totvert; i != 0; i--, wc += 4, dv++) {
+ calc_weightpaint_vert_color(wc, dv, coba, defbase_tot, defbase_act, dg_flags, selected, draw_flag);
+ }
+
+ MEM_freeN(dg_flags);
+ }
+ else {
+ int col_i;
+ weightpaint_color((unsigned char *)&col_i, coba, 0.0f);
+ fill_vn_i((int *)wtcol_v, me->totvert, col_i);
+ }
+
+ return wtcol_v;
+}
+
static void add_weight_mcol_dm(Object *ob, DerivedMesh *dm, int const draw_flag)
{
+ ColorBand *coba= stored_cb; /* warning, not a local var */
+
Mesh *me = ob->data;
+ unsigned char *wtcol_v = calc_weightpaint_vert_array(ob, draw_flag, coba);
+ unsigned char *wtcol_f = MEM_mallocN (sizeof(unsigned char) * me->totface*4*4, "weightmap_f");
+
MFace *mf = me->mface;
- ColorBand *coba= stored_cb; /* warning, not a local var */
- unsigned char *wtcol;
int i;
-
- int defbase_tot = BLI_countlist(&ob->defbase);
- char *defbase_sel = MEM_mallocN(defbase_tot * sizeof(char), __func__);
- int selected = get_selected_defgroups(ob, defbase_sel, defbase_tot);
- int unselected = defbase_tot - selected;
- wtcol = MEM_callocN (sizeof (unsigned char) * me->totface*4*4, "weightmap");
-
- memset(wtcol, 0x55, sizeof (unsigned char) * me->totface*4*4);
for (i=0; i<me->totface; i++, mf++) {
- calc_weightpaint_vert_color(ob, defbase_tot, coba, mf->v1, &wtcol[(i*4 + 0)*4], defbase_sel, selected, unselected, draw_flag);
- calc_weightpaint_vert_color(ob, defbase_tot, coba, mf->v2, &wtcol[(i*4 + 1)*4], defbase_sel, selected, unselected, draw_flag);
- calc_weightpaint_vert_color(ob, defbase_tot, coba, mf->v3, &wtcol[(i*4 + 2)*4], defbase_sel, selected, unselected, draw_flag);
- if (mf->v4)
- calc_weightpaint_vert_color(ob, defbase_tot, coba, mf->v4, &wtcol[(i*4 + 3)*4], defbase_sel, selected, unselected, draw_flag);
+ unsigned int fidx= mf->v4 ? 3:2;
+ do {
+ copy_v4_v4_char((char *)&wtcol_f[(4 * i + fidx) * 4],
+ (char *)&wtcol_v[4 * (*(&mf->v1 + fidx))]);
+ } while (fidx--);
}
-
- MEM_freeN(defbase_sel);
- CustomData_add_layer(&dm->faceData, CD_WEIGHT_MCOL, CD_ASSIGN, wtcol, dm->numFaceData);
+ MEM_freeN(wtcol_v);
+
+ CustomData_add_layer(&dm->faceData, CD_WEIGHT_MCOL, CD_ASSIGN, wtcol_f, dm->numFaceData);
}
/* new value for useDeform -1 (hack for the gameengine):
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 438bac37c15..231b50c204d 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1871,7 +1871,7 @@ void CDDM_apply_vert_coords(DerivedMesh *dm, float (*vertCoords)[3])
int i;
/* this will just return the pointer if it wasn't a referenced layer */
- vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT);
+ vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
cddm->mvert = vert;
for(i = 0; i < dm->numVertData; ++i, ++vert)
@@ -1885,7 +1885,7 @@ void CDDM_apply_vert_normals(DerivedMesh *dm, short (*vertNormals)[3])
int i;
/* this will just return the pointer if it wasn't a referenced layer */
- vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT);
+ vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
cddm->mvert = vert;
for(i = 0; i < dm->numVertData; ++i, ++vert)
@@ -1900,7 +1900,7 @@ void CDDM_calc_normals(DerivedMesh *dm)
if(dm->numVertData == 0) return;
/* we don't want to overwrite any referenced layers */
- cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT);
+ cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
/* make a face normal layer if not present */
face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index c88b21e2813..289faaa0095 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -943,7 +943,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
number++;
if(lastflag & CD_FLAG_NOCOPY) continue;
- else if(!((int)mask & (int)(1 << (int)type))) continue;
+ else if(!(mask & CD_TYPE_AS_MASK(type))) continue;
else if(number < CustomData_number_of_layers(dest, type)) continue;
if((alloctype == CD_ASSIGN) && (lastflag & CD_FLAG_NOFREE))
@@ -1404,7 +1404,7 @@ int CustomData_number_of_layers(const CustomData *data, int type)
return number;
}
-void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type)
+void *CustomData_duplicate_referenced_layer(struct CustomData *data, const int type, const int totelem)
{
CustomDataLayer *layer;
int layer_index;
@@ -1416,7 +1416,20 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type)
layer = &data->layers[layer_index];
if (layer->flag & CD_FLAG_NOFREE) {
- layer->data = MEM_dupallocN(layer->data);
+ /* MEM_dupallocN won’t work in case of complex layers, like e.g.
+ * CD_MDEFORMVERT, which has pointers to allocated data...
+ * So in case a custom copy function is defined, use it!
+ */
+ const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
+
+ if(typeInfo->copy) {
+ char *dest_data = MEM_mallocN(typeInfo->size * totelem, "CD duplicate ref layer");
+ typeInfo->copy(layer->data, dest_data, totelem);
+ layer->data = dest_data;
+ }
+ else
+ layer->data = MEM_dupallocN(layer->data);
+
layer->flag &= ~CD_FLAG_NOFREE;
}
@@ -1424,7 +1437,7 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type)
}
void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
- int type, const char *name)
+ const int type, const char *name, const int totelem)
{
CustomDataLayer *layer;
int layer_index;
@@ -1436,7 +1449,20 @@ void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
layer = &data->layers[layer_index];
if (layer->flag & CD_FLAG_NOFREE) {
- layer->data = MEM_dupallocN(layer->data);
+ /* MEM_dupallocN won’t work in case of complex layers, like e.g.
+ * CD_MDEFORMVERT, which has pointers to allocated data...
+ * So in case a custom copy function is defined, use it!
+ */
+ const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
+
+ if(typeInfo->copy) {
+ char *dest_data = MEM_mallocN(typeInfo->size * totelem, "CD duplicate ref layer");
+ typeInfo->copy(layer->data, dest_data, totelem);
+ layer->data = dest_data;
+ }
+ else
+ layer->data = MEM_dupallocN(layer->data);
+
layer->flag &= ~CD_FLAG_NOFREE;
}
@@ -1474,7 +1500,7 @@ void CustomData_set_only_copy(const struct CustomData *data,
int i;
for(i = 0; i < data->totlayer; ++i)
- if(!((int)mask & (int)(1 << (int)data->layers[i].type)))
+ if(!(mask & CD_TYPE_AS_MASK(data->layers[i].type)))
data->layers[i].flag |= CD_FLAG_NOCOPY;
}
@@ -2415,7 +2441,7 @@ void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & (1<<layer->type)));
+ if(!(mask & CD_TYPE_AS_MASK(layer->type)));
else if((layer->flag & CD_FLAG_EXTERNAL) && (layer->flag & CD_FLAG_IN_MEMORY)) {
if(typeInfo->free)
typeInfo->free(layer->data, totelem, typeInfo->size);
@@ -2441,7 +2467,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & (1<<layer->type)));
+ if(!(mask & CD_TYPE_AS_MASK(layer->type)));
else if(layer->flag & CD_FLAG_IN_MEMORY);
else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read)
update= 1;
@@ -2462,7 +2488,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & (1<<layer->type)));
+ if(!(mask & CD_TYPE_AS_MASK(layer->type)));
else if(layer->flag & CD_FLAG_IN_MEMORY);
else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) {
blay= cdf_layer_find(cdf, layer->type, layer->name);
@@ -2501,7 +2527,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
layer = &data->layers[i];
typeInfo = layerType_getInfo(layer->type);
- if(!(mask & (1<<layer->type)));
+ if(!(mask & CD_TYPE_AS_MASK(layer->type)));
else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write)
update= 1;
}
@@ -2615,7 +2641,7 @@ void CustomData_external_remove(CustomData *data, ID *id, int type, int totelem)
if(layer->flag & CD_FLAG_EXTERNAL) {
if(!(layer->flag & CD_FLAG_IN_MEMORY))
- CustomData_external_read(data, id, (1<<layer->type), totelem);
+ CustomData_external_read(data, id, CD_TYPE_AS_MASK(layer->type), totelem);
layer->flag &= ~CD_FLAG_EXTERNAL;
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/image.c b/source/blender/blenkernel/intern/image.c
index 25ff7b5fa04..354a5265f90 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1544,7 +1544,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
ibuf->ftype= OPENEXR;
if(imf->depth == R_IMF_CHAN_DEPTH_16)
ibuf->ftype |= OPENEXR_HALF;
- ibuf->ftype |= (quality & OPENEXR_COMPRESS);
+ ibuf->ftype |= (imf->exr_codec & OPENEXR_COMPRESS);
if(!(imf->flag & R_IMF_FLAG_ZBUF))
ibuf->zbuf_float = NULL; /* signal for exr saving */
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/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 43958457edb..4b4875213b1 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -466,8 +466,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
if(mface->v3==0) {
static int corner_indices[4] = {1, 2, 0, 3};
- SWAP(int, mface->v1, mface->v2);
- SWAP(int, mface->v2, mface->v3);
+ SWAP(unsigned int, mface->v1, mface->v2);
+ SWAP(unsigned int, mface->v2, mface->v3);
if(fdata)
CustomData_swap(fdata, mfindex, corner_indices);
@@ -477,8 +477,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
if(mface->v3==0 || mface->v4==0) {
static int corner_indices[4] = {2, 3, 0, 1};
- SWAP(int, mface->v1, mface->v3);
- SWAP(int, mface->v2, mface->v4);
+ SWAP(unsigned int, mface->v1, mface->v3);
+ SWAP(unsigned int, mface->v2, mface->v4);
if(fdata)
CustomData_swap(fdata, mfindex, corner_indices);
@@ -520,12 +520,14 @@ void set_mesh(Object *ob, Mesh *me)
/* ************** make edges in a Mesh, for outside of editmode */
struct edgesort {
- int v1, v2;
+ unsigned int v1, v2;
short is_loose, is_draw;
};
/* edges have to be added with lowest index first for sorting */
-static void to_edgesort(struct edgesort *ed, int v1, int v2, short is_loose, short is_draw)
+static void to_edgesort(struct edgesort *ed,
+ unsigned int v1, unsigned int v2,
+ short is_loose, short is_draw)
{
if(v1<v2) {
ed->v1= v1; ed->v2= v2;
@@ -627,7 +629,7 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(
/* order is swapped so extruding this edge as a surface wont flip face normals
* with cyclic curves */
if(ed->v1+1 != ed->v2) {
- SWAP(int, medge->v1, medge->v2);
+ SWAP(unsigned int, medge->v1, medge->v2);
}
medge++;
}
@@ -1029,17 +1031,17 @@ typedef struct EdgeLink {
typedef struct VertLink {
Link *next, *prev;
- int index;
+ unsigned int index;
} VertLink;
-static void prependPolyLineVert(ListBase *lb, int index)
+static void prependPolyLineVert(ListBase *lb, unsigned int index)
{
VertLink *vl= MEM_callocN(sizeof(VertLink), "VertLink");
vl->index = index;
BLI_addhead(lb, vl);
}
-static void appendPolyLineVert(ListBase *lb, int index)
+static void appendPolyLineVert(ListBase *lb, unsigned int index)
{
VertLink *vl= MEM_callocN(sizeof(VertLink), "VertLink");
vl->index = index;
@@ -1111,8 +1113,8 @@ void mesh_to_curve(Scene *scene, Object *ob)
int closed = FALSE;
int totpoly= 0;
MEdge *med_current= ((EdgeLink *)edges.last)->edge;
- int startVert= med_current->v1;
- int endVert= med_current->v2;
+ unsigned int startVert= med_current->v1;
+ unsigned int endVert= med_current->v2;
int ok= TRUE;
appendPolyLineVert(&polyline, startVert); totpoly++;
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 5a53d953f1b..a1bf9cb9481 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -395,7 +395,7 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
while(i<data->totlayer) {
CustomDataLayer *layer= &data->layers[i];
- int mask= 1 << layer->type;
+ CustomDataMask mask= CD_TYPE_AS_MASK(layer->type);
int ok= 1;
if((mask&CD_MASK_MESH)==0) {
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index f09be8c34ad..5a389019519 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -239,7 +239,14 @@ int modifier_couldBeCage(struct Scene *scene, ModifierData *md)
int modifier_sameTopology(ModifierData *md)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- return ( mti->type == eModifierTypeType_OnlyDeform || mti->type == eModifierTypeType_Nonconstructive);
+ return ELEM3(mti->type, eModifierTypeType_OnlyDeform, eModifierTypeType_Nonconstructive,
+ eModifierTypeType_NonGeometrical);
+}
+
+int modifier_nonGeometrical(ModifierData *md)
+{
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ return (mti->type == eModifierTypeType_NonGeometrical);
}
void modifier_setError(ModifierData *md, const char *format, ...)
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 75d8ec584e8..10c060e0aab 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;
@@ -915,15 +918,17 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
IMB_freeImBuf(scaleibuf);
}
-void BKE_movieclip_build_proxy_frame(MovieClip *clip, struct MovieDistortion *distortion,
+void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct MovieDistortion *distortion,
int cfra, int *build_sizes, int build_count, int undistorted)
{
ImBuf *ibuf;
MovieClipUser user;
user.framenr= cfra;
+ user.render_flag= 0;
+ user.render_size= MCLIP_PROXY_RENDER_SIZE_FULL;
- ibuf= BKE_movieclip_get_ibuf_flag(clip, &user, 0);
+ ibuf= BKE_movieclip_get_ibuf_flag(clip, &user, clip_flag);
if(ibuf) {
ImBuf *tmpibuf= ibuf;
@@ -985,9 +990,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/node.c b/source/blender/blenkernel/intern/node.c
index cc49e8465b9..ce1dd429794 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1325,32 +1325,6 @@ void nodeSetActive(bNodeTree *ntree, bNode *node)
node->flag |= NODE_ACTIVE_TEXTURE;
}
-/* use flags are not persistent yet, groups might need different tagging, so we do it each time
- when we need to get this info */
-void ntreeSocketUseFlags(bNodeTree *ntree)
-{
- bNode *node;
- bNodeSocket *sock;
- bNodeLink *link;
-
- /* clear flags */
- for(node= ntree->nodes.first; node; node= node->next) {
- for(sock= node->inputs.first; sock; sock= sock->next)
- sock->flag &= ~SOCK_IN_USE;
- for(sock= node->outputs.first; sock; sock= sock->next)
- sock->flag &= ~SOCK_IN_USE;
- }
-
- /* tag all thats in use */
- for(link= ntree->links.first; link; link= link->next) {
-
- if(link->fromsock) // FIXME, see below
- link->fromsock->flag |= SOCK_IN_USE;
- if(link->tosock) // FIXME This can be NULL, when dragging a new link in the UI, should probably copy the node tree for preview render - campbell
- link->tosock->flag |= SOCK_IN_USE;
- }
-}
-
/* ************** dependency stuff *********** */
/* node is guaranteed to be not checked before */
@@ -1425,16 +1399,27 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
/* first clear data */
for(node= ntree->nodes.first; node; node= node->next) {
- for(sock= node->inputs.first; sock; sock= sock->next)
+ for(sock= node->inputs.first; sock; sock= sock->next) {
sock->link= NULL;
+ sock->flag &= ~SOCK_IN_USE;
+ }
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+ sock->flag &= ~SOCK_IN_USE;
+ }
+ }
+ for(sock= ntree->inputs.first; sock; sock= sock->next) {
+ sock->flag &= ~SOCK_IN_USE;
}
- /* clear socket links */
- for(sock= ntree->outputs.first; sock; sock= sock->next)
+ for(sock= ntree->outputs.first; sock; sock= sock->next) {
sock->link= NULL;
+ sock->flag &= ~SOCK_IN_USE;
+ }
for(link= ntree->links.first; link; link= link->next) {
- if (link->tosock)
- link->tosock->link= link;
+ link->tosock->link= link;
+
+ link->fromsock->flag |= SOCK_IN_USE;
+ link->tosock->flag |= SOCK_IN_USE;
}
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index cc540a908f6..ac612e3e996 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2573,7 +2573,7 @@ void object_handle_update(Scene *scene, Object *ob)
#else /* ensure CD_MASK_BAREMESH for now */
EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
- unsigned int data_mask= scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH;
+ uint64_t data_mask= scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH;
if(em) {
makeDerivedMesh(scene, ob, em, data_mask); /* was CD_MASK_BAREMESH */
BKE_mesh_end_editmesh(ob->data, em);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 2d0f6053601..f7acdc78749 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2292,6 +2292,9 @@ static int ccgdm_adjacent_grid(CCGSubSurf *ss, int *gridOffset, CCGFace *f, int
break;
}
}
+
+ if(numEdges == 0)
+ return -1;
fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, adjf));
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 93404dc25fb..7051376a1f4 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -349,9 +349,9 @@ ColorBand *add_colorband(int rangetype)
/* ------------------------------------------------------------------------- */
-int do_colorband(ColorBand *coba, float in, float out[4])
+int do_colorband(const ColorBand *coba, float in, float out[4])
{
- CBData *cbd1, *cbd2, *cbd0, *cbd3;
+ const CBData *cbd1, *cbd2, *cbd0, *cbd3;
float fac, mfac, t[4];
int a;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 83adfa12236..1a0007c5bfe 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -730,6 +730,7 @@ typedef struct TrackContext {
typedef struct MovieTrackingContext {
MovieClipUser user;
MovieClip *clip;
+ int clip_flag;
int first_time, frames;
@@ -830,7 +831,20 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
}
context->clip= clip;
+
+ /* store needed clip flags passing to get_buffer functions
+ * - MCLIP_USE_PROXY is needed to because timecode affects on movie clip
+ * only in case Proxy/Timecode flag is set, so store this flag to use
+ * timecodes properly but reset render size to SIZE_FULL so correct resolution
+ * would be used for images
+ * - MCLIP_USE_PROXY_CUSTOM_DIR is needed because proxy/timecode files might
+ * be stored in a different location
+ * ignore all the rest pssible flags for now */
+ context->clip_flag= clip->flag&MCLIP_TIMECODE_FLAGS;
+
context->user= *user;
+ context->user.render_size= 0;
+ context->user.render_flag= MCLIP_PROXY_RENDER_SIZE_FULL;
if(!sequence)
BLI_begin_threaded_malloc();
@@ -1044,7 +1058,7 @@ static ImBuf *get_frame_ibuf(MovieTrackingContext *context, int framenr)
user.framenr= framenr;
- ibuf= BKE_movieclip_get_ibuf_flag(context->clip, &user, 0);
+ ibuf= BKE_movieclip_get_ibuf_flag(context->clip, &user, context->clip_flag);
return ibuf;
}
@@ -1148,7 +1162,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
if(context->backwards) context->user.framenr--;
else context->user.framenr++;
- ibuf_new= BKE_movieclip_get_ibuf_flag(context->clip, &context->user, 0);
+ ibuf_new= BKE_movieclip_get_ibuf_flag(context->clip, &context->user, context->clip_flag);
if(!ibuf_new)
return 0;
@@ -1288,8 +1302,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/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 8cd30912840..da64c464dce 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -159,9 +159,6 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
avi = MEM_mallocN (sizeof(AviMovie), "avimovie");
- /* RPW 11-21-2002
- if (rd->imtype != AVI_FORMAT_MJPEG) format = AVI_FORMAT_AVI_RGB;
- */
if (rd->im_format.imtype != R_IMF_IMTYPE_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
else format = AVI_FORMAT_MJPEG;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index aa7d71b1577..bf547584b9e 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1333,11 +1333,11 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
}
}
-void ffmpeg_verify_image_type(RenderData *rd)
+void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
{
int audio= 0;
- if(rd->imtype == R_IMF_IMTYPE_FFMPEG) {
+ if(imf->imtype == R_IMF_IMTYPE_FFMPEG) {
if(rd->ffcodecdata.type <= 0 ||
rd->ffcodecdata.codec <= 0 ||
rd->ffcodecdata.audio_codec <= 0 ||
@@ -1353,19 +1353,19 @@ void ffmpeg_verify_image_type(RenderData *rd)
audio= 1;
}
- else if(rd->imtype == R_IMF_IMTYPE_H264) {
+ else if(imf->imtype == R_IMF_IMTYPE_H264) {
if(rd->ffcodecdata.codec != CODEC_ID_H264) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_H264);
audio= 1;
}
}
- else if(rd->imtype == R_IMF_IMTYPE_XVID) {
+ else if(imf->imtype == R_IMF_IMTYPE_XVID) {
if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
audio= 1;
}
}
- else if(rd->imtype == R_IMF_IMTYPE_THEORA) {
+ else if(imf->imtype == R_IMF_IMTYPE_THEORA) {
if(rd->ffcodecdata.codec != CODEC_ID_THEORA) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_THEORA);
audio= 1;
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h
index e27a315a023..32c4e012d1d 100644
--- a/source/blender/blenlib/BLI_dynstr.h
+++ b/source/blender/blenlib/BLI_dynstr.h
@@ -100,6 +100,17 @@ int BLI_dynstr_get_len (DynStr *ds);
*/
char* BLI_dynstr_get_cstring (DynStr *ds);
+/**
+ * Get a DynStr's contents as a c-string.
+ * <i> The str argument must be allocated to be at
+ * least the size of BLI_dynstr_get_len(ds) + 1. </i>
+ *
+ * @param ds The DynStr of interest.
+ * @param str The string to fill.
+ * @return The contents of @a ds as a c-string.
+ */
+void BLI_dynstr_get_cstring_ex (DynStr *ds, char *str);
+
/**
* Free the DynStr
*
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index d8e880a9dec..e9e44ed7b2c 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -198,6 +198,7 @@ double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int s
float normalize_vn_vn(float *array_tar, const float *array_src, const int size);
float normalize_vn(float *array_tar, const int size);
void range_vn_i(int *array_tar, const int size, const int start);
+void range_vn_fl(float *array_tar, const int size, const float start, const float step);
void negate_vn(float *array_tar, const int size);
void negate_vn_vn(float *array_tar, const float *array_src, const int size);
void mul_vn_fl(float *array_tar, const int size, const float f);
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/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index a6b4f2c9b92..94189af34fa 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -279,24 +279,22 @@
# endif
# if defined(__GNUC__) || defined(_MSC_VER) /* check __func__ is available */
# define BLI_assert(a) \
-do { \
- if (!(a)) { \
+ (void)((!(a)) ? ( \
+ ( \
fprintf(stderr, \
"BLI_assert failed: %s, %s(), %d at \'%s\'\n", \
- __FILE__, __func__, __LINE__, STRINGIFY(a)); \
- _dummy_abort(); \
- } \
-} while (0)
+ __FILE__, __func__, __LINE__, STRINGIFY(a)), \
+ _dummy_abort(), \
+ NULL)) : NULL)
# else
-# define BLI_assert(a) \
-do { \
- if (0 == (a)) { \
+# define BLI_assert(a) \
+ (void)((!(a)) ? ( \
+ ( \
fprintf(stderr, \
"BLI_assert failed: %s, %d at \'%s\'\n", \
- __FILE__, __LINE__, STRINGIFY(a)); \
- _dummy_abort(); \
- } \
-} while (0)
+ __FILE__, __LINE__, STRINGIFY(a)), \
+ _dummy_abort(), \
+ NULL)) : NULL)
# endif
#else
# define BLI_assert(a) (void)0
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index a424c2ac169..e8621ec7136 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
@@ -118,6 +119,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/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c
index 349bc3492e7..ad52de180aa 100644
--- a/source/blender/blenlib/intern/BLI_dynstr.c
+++ b/source/blender/blenlib/intern/BLI_dynstr.c
@@ -226,11 +226,11 @@ int BLI_dynstr_get_len(DynStr *ds)
return ds->curlen;
}
-char *BLI_dynstr_get_cstring(DynStr *ds)
+void BLI_dynstr_get_cstring_ex(DynStr *ds, char *rets)
{
- char *s, *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
+ char *s;
DynStrElem *dse;
-
+
for (s= rets, dse= ds->elems; dse; dse= dse->next) {
int slen= strlen(dse->str);
@@ -239,7 +239,12 @@ char *BLI_dynstr_get_cstring(DynStr *ds)
s+= slen;
}
rets[ds->curlen]= '\0';
-
+}
+
+char *BLI_dynstr_get_cstring(DynStr *ds)
+{
+ char *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
+ BLI_dynstr_get_cstring_ex(ds, rets);
return rets;
}
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index a2d996366bf..12795280ddd 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -200,7 +200,11 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
- filesize: filesize for the file
*/
#define MAX_RECUR 16
-static int findFileRecursive(char *filename_new, const char *dirname, const char *filename, int *filesize, int *recur_depth)
+static int findFileRecursive(char *filename_new,
+ const char *dirname,
+ const char *filename,
+ int *filesize,
+ int *recur_depth)
{
/* file searching stuff */
DIR *dir;
@@ -315,7 +319,11 @@ static int rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *abs
}
}
-static int rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR], char path_file[FILE_MAXFILE], BPathVisitor visit_cb, const char *absbase, void *userdata)
+static int rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR],
+ char path_file[FILE_MAXFILE],
+ BPathVisitor visit_cb,
+ const char *absbase,
+ void *userdata)
{
char path_src[FILE_MAX];
char path_dst[FILE_MAX];
@@ -498,7 +506,8 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
SEQ_BEGIN(scene->ed, seq) {
if (SEQ_HAS_PATH(seq)) {
if (ELEM(seq->type, SEQ_MOVIE, SEQ_SOUND)) {
- rewrite_path_fixed_dirfile(seq->strip->dir, seq->strip->stripdata->name, visit_cb, absbase, bpath_user_data);
+ rewrite_path_fixed_dirfile(seq->strip->dir, seq->strip->stripdata->name,
+ visit_cb, absbase, bpath_user_data);
}
else if (seq->type == SEQ_IMAGE) {
/* might want an option not to loop over all strips */
@@ -512,7 +521,8 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
}
for(i= 0; i < len; i++, se++) {
- rewrite_path_fixed_dirfile(seq->strip->dir, se->name, visit_cb, absbase, bpath_user_data);
+ rewrite_path_fixed_dirfile(seq->strip->dir, se->name,
+ visit_cb, absbase, bpath_user_data);
}
}
else {
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index a9ea90ef555..590a48e8085 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -416,6 +416,15 @@ void range_vn_i(int *array_tar, const int size, const int start)
while(i--) { *(array_pt--) = j--; }
}
+void range_vn_fl(float *array_tar, const int size, const float start, const float step)
+{
+ float *array_pt= array_tar + (size-1);
+ int i= size;
+ while(i--) {
+ *(array_pt--) = start + step * (float)(i);
+ }
+}
+
void negate_vn(float *array_tar, const int size)
{
float *array_pt= array_tar + (size-1);
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/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 001b191155d..c5b6f46b3bc 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -54,7 +54,7 @@
#include <sys/mount.h>
#endif
-#if defined(linux) || defined(__CYGWIN32__) || defined(__hpux)
+#if defined(linux) || defined(__CYGWIN32__) || defined(__hpux) || defined(__GNU__) || defined(__GLIBC__)
#include <sys/vfs.h>
#endif
@@ -180,7 +180,7 @@ double BLI_dir_free_space(const char *dir)
if (slash) slash[1] = 0;
} else strcpy(name,"/");
-#if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__)
+#if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__) || defined(__GNU__) || defined(__GLIBC__)
if (statfs(name, &disk)) return(-1);
#endif
diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h
index e7f7a7e23bc..800ae834b59 100644
--- a/source/blender/blenloader/BLO_sys_types.h
+++ b/source/blender/blenloader/BLO_sys_types.h
@@ -86,6 +86,14 @@ typedef unsigned long uintptr_t;
/* Linux-i386, Linux-Alpha, Linux-ppc */
#include <stdint.h>
+/* XXX */
+#ifndef uint64_t
+typedef uint8_t u_int8_t;
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+typedef uint64_t u_int64_t;
+#endif
+
#elif defined (__APPLE__)
#include <inttypes.h>
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 d5d2df3ea35..0333eab7e1f 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'
+incs += ' ../render/extern/include ../makesrna ../nodes ../imbuf'
incs += ' ' + env['BF_ZLIB_INC']
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6f542e0f372..ead96859cd1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -140,6 +140,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
@@ -7627,6 +7629,30 @@ void do_versions_image_settings_2_60(Scene *sce)
}
+/* socket use flags were only temporary before */
+static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
+{
+ bNode *node;
+ bNodeSocket *sock;
+ bNodeLink *link;
+
+ for (node=ntree->nodes.first; node; node=node->next) {
+ for (sock=node->inputs.first; sock; sock=sock->next)
+ sock->flag &= ~SOCK_IN_USE;
+ for (sock=node->outputs.first; sock; sock=sock->next)
+ sock->flag &= ~SOCK_IN_USE;
+ }
+ for (sock=ntree->inputs.first; sock; sock=sock->next)
+ sock->flag &= ~SOCK_IN_USE;
+ for (sock=ntree->outputs.first; sock; sock=sock->next)
+ sock->flag &= ~SOCK_IN_USE;
+
+ for (link=ntree->links.first; link; link=link->next) {
+ link->fromsock->flag |= SOCK_IN_USE;
+ link->tosock->flag |= SOCK_IN_USE;
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -10854,8 +10880,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;
}
@@ -12753,10 +12782,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;
@@ -12856,7 +12887,52 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */
{
- /* nothing! */
+ {
+ /* update use flags for node sockets (was only temporary before) */
+ Scene *sce;
+ Material *mat;
+ Tex *tex;
+ Lamp *lamp;
+ World *world;
+ bNodeTree *ntree;
+
+ for (sce=main->scene.first; sce; sce=sce->id.next)
+ if (sce->nodetree)
+ do_versions_nodetree_socket_use_flags_2_62(sce->nodetree);
+
+ for (mat=main->mat.first; mat; mat=mat->id.next)
+ if (mat->nodetree)
+ do_versions_nodetree_socket_use_flags_2_62(mat->nodetree);
+
+ for (tex=main->tex.first; tex; tex=tex->id.next)
+ if (tex->nodetree)
+ do_versions_nodetree_socket_use_flags_2_62(tex->nodetree);
+
+ for (lamp=main->lamp.first; lamp; lamp=lamp->id.next)
+ if (lamp->nodetree)
+ do_versions_nodetree_socket_use_flags_2_62(lamp->nodetree);
+
+ for (world=main->world.first; world; world=world->id.next)
+ if (world->nodetree)
+ do_versions_nodetree_socket_use_flags_2_62(world->nodetree);
+
+ for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+ do_versions_nodetree_socket_use_flags_2_62(ntree);
+ }
+ {
+ /* Initialize BGE exit key to esc key */
+ Scene *scene;
+ for(scene= main->scene.first; scene; scene= scene->id.next) {
+ if (!scene->gm.exitkey)
+ 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;
+ }
+ }
}
/* default values in Freestyle settings */
@@ -14440,7 +14516,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);
@@ -14462,8 +14539,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/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 68ef9fac3ae..99c36a642f9 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -175,6 +175,10 @@ typedef struct {
MemFile *compare, *current;
int tot, count, error, memsize;
+
+#ifdef USE_MESH_FORWARDS_COMAT
+ char use_mesh_compat; /* option to save with older mesh format */
+#endif
} WriteData;
static WriteData *writedata_new(int file)
@@ -2780,7 +2784,10 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.curscene= screen->scene;
fg.displaymode= G.displaymode;
fg.winpos= G.winpos;
- fg.fileflags= (fileflags & ~(G_FILE_NO_UI|G_FILE_RELATIVE_REMAP)); // prevent to save this, is not good convention, and feature with concerns...
+
+ /* prevent to save this, is not good convention, and feature with concerns... */
+ fg.fileflags= (fileflags & ~(G_FILE_NO_UI|G_FILE_RELATIVE_REMAP|G_FILE_MESH_COMPAT));
+
fg.globalf= G.f;
BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
@@ -2823,7 +2830,11 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
blo_split_main(&mainlist, mainvar);
wd= bgnwrite(handle, compare, current);
-
+
+#ifdef USE_MESH_FORWARDS_COMAT
+ wd->use_mesh_compat = (write_flags & G_FILE_MESH_COMPAT) != 0;
+#endif
+
sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (ENDIAN_ORDER==B_ENDIAN)?'V':'v', BLENDER_VERSION);
mywrite(wd, buf, 12);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 422f80532a9..32021447d6a 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -500,7 +500,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 16047161a67..beecbc7abed 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2272,12 +2272,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/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index f75f2921e51..6b374274205 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -243,6 +243,20 @@ int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob
int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
int ED_mesh_color_remove_named(struct bContext *C, struct Object *ob, struct Mesh *me, const char *name);
+
+/* mirrtopo */
+typedef struct MirrTopoStore_t {
+ intptr_t *index_lookup;
+ int prev_vert_tot;
+ int prev_edge_tot;
+ int prev_ob_mode;
+} MirrTopoStore_t;
+
+int ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store);
+void ED_mesh_mirrtopo_init(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store,
+ const short skip_em_vert_array_init);
+void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 476cf2ac109..0562f400700 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -201,7 +201,7 @@ void ED_view3d_depth_tag_update(struct RegionView3D *rv3d);
/* Projection */
#define IS_CLIPPED 12000
-void ED_view3d_calc_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, struct rcti *rect);
+void ED_view3d_calc_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, const struct rcti *rect);
void project_short(struct ARegion *ar, const float vec[3], short adr[2]);
void project_short_noclip(struct ARegion *ar, const float vec[3], short adr[2]);
@@ -215,7 +215,7 @@ void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]);
int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend);
void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
-void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
+void ED_view3d_project_float(const struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short no_shift);
void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]);
@@ -257,7 +257,7 @@ void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc);
void view3d_operator_needs_opengl(const struct bContext *C);
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const int mval[2], const short do_fallback);
-void view3d_get_transformation(struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats);
+void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats);
/* XXX should move to BLI_math */
int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2);
@@ -286,8 +286,8 @@ Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip);
int ED_view3d_lock(struct RegionView3D *rv3d);
-unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
-unsigned int ED_viewedit_datamask(struct bScreen *screen);
+uint64_t ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
+uint64_t ED_viewedit_datamask(struct bScreen *screen);
/* camera lock functions */
int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d);
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_panel.c b/source/blender/editors/interface/interface_panel.c
index 1edfa2f4ea6..c21bc09ff27 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -330,7 +330,6 @@ static void uiPanelPop(uiBlock *UNUSED(block))
#endif
/* triangle 'icon' for panel header */
-/* NOTE - this seems to be only used for hiding nodes now */
void UI_DrawTriIcon(float x, float y, char dir)
{
if(dir=='h') {
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index b89a80bb0d7..c535f2c1ad0 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1071,18 +1071,16 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
/* copy to int, gets projected if possible too */
x1= x1f; y1= y1f; x2= x2f; y2= y2f;
- if(butregion) {
- if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
- UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
- UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
- }
-
- x1 += butregion->winrct.xmin;
- x2 += butregion->winrct.xmin;
- y1 += butregion->winrct.ymin;
- y2 += butregion->winrct.ymin;
+ if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+ UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
+ UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
}
-
+
+ x1 += butregion->winrct.xmin;
+ x2 += butregion->winrct.xmin;
+ y1 += butregion->winrct.ymin;
+ y2 += butregion->winrct.ymin;
+
wm_window_get_size(CTX_wm_window(C), &winx, &winy);
if(x2 > winx) {
@@ -1096,7 +1094,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
x2= winx;
}
}
- if(y1 < 0) { /* XXX butregion NULL check?, there is one above */
+
+ if(y1 < 0) {
int newy1;
UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, NULL, &newy1);
newy1 += butregion->winrct.ymin;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 03bb9d6def9..eb7b2db083f 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -682,7 +682,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;
@@ -690,14 +690,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;
}
@@ -706,7 +708,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;
@@ -846,7 +849,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA);
- if (modifier_sameTopology(md))
+ if (modifier_sameTopology(md) && !modifier_nonGeometrical(md))
uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape"), 0, "apply_as", MODIFIER_APPLY_SHAPE);
}
@@ -854,7 +857,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke))
- uiItemO(row, TIP_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy");
+ uiItemO(row, IFACE_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy");
}
/* result is the layout block inside the box, that we return so that modifier settings can be drawn */
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/interface/view2d.c b/source/blender/editors/interface/view2d.c
index c2c482b0a2c..57d46de9cb7 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -177,7 +177,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* see eView2D_CommonViewTypes in UI_view2d.h for available view presets */
switch (type) {
- /* 'standard view' - optimum setup for 'standard' view behaviour, that should be used new views as basis for their
+ /* 'standard view' - optimum setup for 'standard' view behaviour,
+ * that should be used new views as basis for their
* own unique View2D settings, which should be used instead of this in most cases...
*/
case V2D_COMMONVIEW_STANDARD:
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 7a84f3ad4ab..9107b30d928 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -821,3 +821,241 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
return OPERATOR_FINISHED;
}
+
+
+/* ********************* MESH VERTEX MIRR TOPO LOOKUP *************** */
+/* note, this is not the best place for the function to be but moved
+ * here to for the purpose of syncing with bmesh */
+
+typedef int MirrTopoHash_t;
+
+typedef struct MirrTopoVert_t {
+ MirrTopoHash_t hash;
+ int v_index;
+} MirrTopoVert_t;
+
+static int mirrtopo_hash_sort(const void *l1, const void *l2)
+{
+ if ((MirrTopoHash_t)(intptr_t)l1 > (MirrTopoHash_t)(intptr_t)l2 ) return 1;
+ else if ((MirrTopoHash_t)(intptr_t)l1 < (MirrTopoHash_t)(intptr_t)l2 ) return -1;
+ return 0;
+}
+
+static int mirrtopo_vert_sort(const void *v1, const void *v2)
+{
+ if (((MirrTopoVert_t *)v1)->hash > ((MirrTopoVert_t *)v2)->hash ) return 1;
+ else if (((MirrTopoVert_t *)v1)->hash < ((MirrTopoVert_t *)v2)->hash ) return -1;
+ return 0;
+}
+
+int ED_mesh_mirrtopo_recalc_check(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store)
+{
+ int totvert;
+ int totedge;
+
+ if (me->edit_mesh) {
+ totvert = me->edit_mesh->totvert;
+ totedge = me->edit_mesh->totedge;
+ }
+ else {
+ totvert = me->totvert;
+ totedge = me->totedge;
+ }
+
+ if( (mesh_topo_store->index_lookup==NULL) ||
+ (mesh_topo_store->prev_ob_mode != ob_mode) ||
+ (totvert != mesh_topo_store->prev_vert_tot) ||
+ (totedge != mesh_topo_store->prev_edge_tot))
+ {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+
+}
+
+void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store,
+ const short skip_em_vert_array_init)
+{
+ MEdge *medge;
+ EditMesh *em = me->edit_mesh;
+ void **eve_tmp_back = NULL; /* some of the callers are using eve->tmp so restore after */
+
+ /* editmode*/
+ EditEdge *eed;
+
+ int a, last;
+ int totvert, totedge;
+ int tot_unique = -1, tot_unique_prev = -1;
+
+ MirrTopoHash_t *topo_hash = NULL;
+ MirrTopoHash_t *topo_hash_prev = NULL;
+ MirrTopoVert_t *topo_pairs;
+
+ intptr_t *index_lookup; /* direct access to mesh_topo_store->index_lookup */
+
+ /* reallocate if needed */
+ ED_mesh_mirrtopo_free(mesh_topo_store);
+
+ mesh_topo_store->prev_ob_mode = ob_mode;
+
+ if(em) {
+ EditVert *eve;
+ totvert = 0;
+ eve_tmp_back = MEM_mallocN(em->totvert * sizeof(void *), "TopoMirr");
+ for(eve = em->verts.first; eve; eve = eve->next) {
+ eve_tmp_back[totvert]= eve->tmp.p;
+ eve->tmp.l = totvert++;
+ }
+ }
+ else {
+ totvert = me->totvert;
+ }
+
+ topo_hash = MEM_callocN(totvert * sizeof(MirrTopoHash_t), "TopoMirr");
+
+ /* Initialize the vert-edge-user counts used to detect unique topology */
+ if(em) {
+ totedge = 0;
+
+ for(eed=em->edges.first; eed; eed = eed->next, totedge++) {
+ topo_hash[eed->v1->tmp.l]++;
+ topo_hash[eed->v2->tmp.l]++;
+ }
+ }
+ else {
+ totedge = me->totedge;
+
+ for(a=0, medge=me->medge; a < me->totedge; a++, medge++) {
+ topo_hash[medge->v1]++;
+ topo_hash[medge->v2]++;
+ }
+ }
+
+ topo_hash_prev = MEM_dupallocN(topo_hash);
+
+ tot_unique_prev = -1;
+ while(1) {
+ /* use the number of edges per vert to give verts unique topology IDs */
+
+ if(em) {
+ for(eed=em->edges.first; eed; eed = eed->next) {
+ topo_hash[eed->v1->tmp.l] += topo_hash_prev[eed->v2->tmp.l];
+ topo_hash[eed->v2->tmp.l] += topo_hash_prev[eed->v1->tmp.l];
+ }
+ }
+ else {
+ for(a=0, medge=me->medge; a<me->totedge; a++, medge++) {
+ /* This can make really big numbers, wrapping around here is fine */
+ topo_hash[medge->v1] += topo_hash_prev[medge->v2];
+ topo_hash[medge->v2] += topo_hash_prev[medge->v1];
+ }
+ }
+ memcpy(topo_hash_prev, topo_hash, sizeof(MirrTopoHash_t) * totvert);
+
+ /* sort so we can count unique values */
+ qsort(topo_hash_prev, totvert, sizeof(MirrTopoHash_t), mirrtopo_hash_sort);
+
+ tot_unique = 1; /* account for skiping the first value */
+ for(a=1; a<totvert; a++) {
+ if (topo_hash_prev[a-1] != topo_hash_prev[a]) {
+ tot_unique++;
+ }
+ }
+
+ if (tot_unique <= tot_unique_prev) {
+ /* Finish searching for unique valus when 1 loop dosnt give a
+ * higher number of unique values compared to the previous loop */
+ break;
+ }
+ else {
+ tot_unique_prev = tot_unique;
+ }
+ /* Copy the hash calculated this iter, so we can use them next time */
+ memcpy(topo_hash_prev, topo_hash, sizeof(MirrTopoHash_t) * totvert);
+ }
+
+ /* restore eve->tmp.* */
+ if(eve_tmp_back) {
+ EditVert *eve;
+ totvert = 0;
+ for(eve = em->verts.first; eve; eve = eve->next) {
+ eve->tmp.p = eve_tmp_back[totvert++];
+ }
+
+ MEM_freeN(eve_tmp_back);
+ eve_tmp_back = NULL;
+ }
+
+
+ /* Hash/Index pairs are needed for sorting to find index pairs */
+ topo_pairs = MEM_callocN( sizeof(MirrTopoVert_t) * totvert, "MirrTopoPairs");
+
+ /* since we are looping through verts, initialize these values here too */
+ index_lookup = MEM_mallocN(totvert * sizeof(*index_lookup), "mesh_topo_lookup");
+
+ if(em) {
+ if (skip_em_vert_array_init == FALSE) {
+ EM_init_index_arrays(em, 1, 0, 0);
+ }
+ }
+
+
+ for(a=0; a<totvert; a++) {
+ topo_pairs[a].hash = topo_hash[a];
+ topo_pairs[a].v_index = a;
+
+ /* initialize lookup */
+ index_lookup[a] = -1;
+ }
+
+ qsort(topo_pairs, totvert, sizeof(MirrTopoVert_t), mirrtopo_vert_sort);
+
+ /* Since the loop starts at 2, we must define the last index where the hash's differ */
+ last = ((totvert >= 2) && (topo_pairs[0].hash == topo_pairs[1].hash)) ? 0 : 1;
+
+ /* Get the pairs out of the sorted hashes, note, totvert+1 means we can use the previous 2,
+ * but you cant ever access the last 'a' index of MirrTopoPairs */
+ for(a=2; a <= totvert; a++) {
+ /* printf("I %d %ld %d\n", (a-last), MirrTopoPairs[a ].hash, MirrTopoPairs[a ].vIndex ); */
+ if ((a==totvert) || (topo_pairs[a-1].hash != topo_pairs[a].hash)) {
+ if (a-last==2) {
+ if(em) {
+ index_lookup[topo_pairs[a-1].v_index] = (intptr_t)EM_get_vert_for_index(topo_pairs[a-2].v_index);
+ index_lookup[topo_pairs[a-2].v_index] = (intptr_t)EM_get_vert_for_index(topo_pairs[a-1].v_index);
+ }
+ else {
+ index_lookup[topo_pairs[a-1].v_index] = topo_pairs[a-2].v_index;
+ index_lookup[topo_pairs[a-2].v_index] = topo_pairs[a-1].v_index;
+ }
+ }
+ last = a;
+ }
+ }
+ if(em) {
+ if (skip_em_vert_array_init == FALSE) {
+ EM_free_index_arrays();
+ }
+ }
+
+ MEM_freeN(topo_pairs);
+ topo_pairs = NULL;
+
+ MEM_freeN(topo_hash);
+ MEM_freeN(topo_hash_prev);
+
+ mesh_topo_store->index_lookup = index_lookup;
+ mesh_topo_store->prev_vert_tot = totvert;
+ mesh_topo_store->prev_edge_tot = totedge;
+}
+
+void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store)
+{
+ if (mesh_topo_store->index_lookup) {
+ MEM_freeN(mesh_topo_store->index_lookup);
+ }
+ mesh_topo_store->index_lookup = NULL;
+ mesh_topo_store->prev_vert_tot = -1;
+ mesh_topo_store->prev_edge_tot = -1;
+}
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index e57c7a43566..7c237808e85 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -924,7 +924,10 @@ void make_editMesh(Scene *scene, Object *ob)
for(a=0; a<me->totselect; a++, mselect++){
/*check if recorded selection is still valid, if so copy into editmesh*/
- if( (mselect->type == EDITVERT && me->mvert[mselect->index].flag & SELECT) || (mselect->type == EDITEDGE && me->medge[mselect->index].flag & SELECT) || (mselect->type == EDITFACE && me->mface[mselect->index].flag & ME_FACE_SEL) ){
+ if ( (mselect->type == EDITVERT && me->mvert[mselect->index].flag & SELECT) ||
+ (mselect->type == EDITEDGE && me->medge[mselect->index].flag & SELECT) ||
+ (mselect->type == EDITFACE && me->mface[mselect->index].flag & ME_FACE_SEL) )
+ {
ese = MEM_callocN(sizeof(EditSelection), "Edit Selection");
ese->type = mselect->type;
if(ese->type == EDITVERT) ese->data = EM_get_vert_for_index(mselect->index); else
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index dd82f055f14..b94b60fc279 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -765,7 +765,7 @@ intptr_t mesh_octree_table(Object *ob, EditMesh *em, float *co, char mode)
if(mode=='u') { /* use table */
if(MeshOctree.table==NULL)
mesh_octree_table(ob, em, NULL, 's');
-
+
if(MeshOctree.table) {
Mesh *me= ob->data;
bt= MeshOctree.table + mesh_octree_get_base_offs(co, MeshOctree.offs, MeshOctree.div);
@@ -848,34 +848,7 @@ intptr_t mesh_octree_table(Object *ob, EditMesh *em, float *co, char mode)
return 0;
}
-
-/* ********************* MESH VERTEX MIRR TOPO LOOKUP *************** */
-
-typedef int MirrTopoHash_t;
-
-typedef struct MirrTopoPair_t {
- MirrTopoHash_t hash;
- int vIndex;
-} MirrTopoPair_t;
-
-static int MirrTopo_long_sort(const void *l1, const void *l2)
-{
- if ((MirrTopoHash_t)(intptr_t)l1 > (MirrTopoHash_t)(intptr_t)l2 ) return 1;
- else if ((MirrTopoHash_t)(intptr_t)l1 < (MirrTopoHash_t)(intptr_t)l2 ) return -1;
- return 0;
-}
-
-static int MirrTopo_item_sort(const void *v1, const void *v2)
-{
- if (((MirrTopoPair_t *)v1)->hash > ((MirrTopoPair_t *)v2)->hash ) return 1;
- else if (((MirrTopoPair_t *)v1)->hash < ((MirrTopoPair_t *)v2)->hash ) return -1;
- return 0;
-}
-
-static intptr_t *mesh_topo_lookup = NULL;
-static int mesh_topo_lookup_vert_tot = -1;
-static int mesh_topo_lookup_edge_tot = -1;
-static int mesh_topo_lookup_mode = -1;
+MirrTopoStore_t mesh_topo_store= {NULL, -1. -1, -1};
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
@@ -883,188 +856,15 @@ static int mesh_topo_lookup_mode = -1;
int mesh_mirrtopo_table(Object *ob, char mode)
{
if(mode=='u') { /* use table */
- Mesh *me= ob->data;
- if( (mesh_topo_lookup==NULL) ||
- (mesh_topo_lookup_mode != ob->mode) ||
- (me->edit_mesh && (me->edit_mesh->totvert != mesh_topo_lookup_vert_tot)) ||
- (me->edit_mesh && (me->edit_mesh->totedge != mesh_topo_lookup_edge_tot)) ||
- (me->edit_mesh==NULL && me->totvert != mesh_topo_lookup_vert_tot) ||
- (me->edit_mesh==NULL && me->totedge != mesh_topo_lookup_edge_tot)
- ) {
+ if (ED_mesh_mirrtopo_recalc_check(ob->data, ob->mode, &mesh_topo_store)) {
mesh_mirrtopo_table(ob, 's');
}
- } else if(mode=='s') { /* start table */
- Mesh *me= ob->data;
- MEdge *medge;
- EditMesh *em= me->edit_mesh;
- void **eve_tmp_back= NULL; /* some of the callers are using eve->tmp so restore after */
-
-
- /* editmode*/
- EditEdge *eed;
-
- int a, last;
- int totvert, totedge;
- int totUnique= -1, totUniqueOld= -1;
-
- MirrTopoHash_t *MirrTopoHash = NULL;
- MirrTopoHash_t *MirrTopoHash_Prev = NULL;
- MirrTopoPair_t *MirrTopoPairs;
- mesh_topo_lookup_mode= ob->mode;
-
- /* reallocate if needed */
- if (mesh_topo_lookup) {
- MEM_freeN(mesh_topo_lookup);
- mesh_topo_lookup = NULL;
- }
-
- if(em) {
- EditVert *eve;
- totvert= 0;
- eve_tmp_back= MEM_callocN( em->totvert * sizeof(void *), "TopoMirr" );
- for(eve= em->verts.first; eve; eve= eve->next) {
- eve_tmp_back[totvert]= eve->tmp.p;
- eve->tmp.l = totvert++;
- }
- }
- else {
- totvert = me->totvert;
- }
-
- MirrTopoHash = MEM_callocN( totvert * sizeof(MirrTopoHash_t), "TopoMirr" );
-
- /* Initialize the vert-edge-user counts used to detect unique topology */
- if(em) {
- totedge= 0;
-
- for(eed=em->edges.first; eed; eed= eed->next, totedge++) {
- MirrTopoHash[eed->v1->tmp.l]++;
- MirrTopoHash[eed->v2->tmp.l]++;
- }
- } else {
- totedge= me->totedge;
-
- for(a=0, medge=me->medge; a < me->totedge; a++, medge++) {
- MirrTopoHash[medge->v1]++;
- MirrTopoHash[medge->v2]++;
- }
- }
-
- MirrTopoHash_Prev = MEM_dupallocN( MirrTopoHash );
-
- totUniqueOld = -1;
- while(1) {
- /* use the number of edges per vert to give verts unique topology IDs */
-
- if(em) {
- for(eed=em->edges.first; eed; eed= eed->next) {
- MirrTopoHash[eed->v1->tmp.l] += MirrTopoHash_Prev[eed->v2->tmp.l];
- MirrTopoHash[eed->v2->tmp.l] += MirrTopoHash_Prev[eed->v1->tmp.l];
- }
- } else {
- for(a=0, medge=me->medge; a<me->totedge; a++, medge++) {
- /* This can make really big numbers, wrapping around here is fine */
- MirrTopoHash[medge->v1] += MirrTopoHash_Prev[medge->v2];
- MirrTopoHash[medge->v2] += MirrTopoHash_Prev[medge->v1];
- }
- }
- memcpy(MirrTopoHash_Prev, MirrTopoHash, sizeof(MirrTopoHash_t) * totvert);
-
- /* sort so we can count unique values */
- qsort(MirrTopoHash_Prev, totvert, sizeof(MirrTopoHash_t), MirrTopo_long_sort);
-
- totUnique = 1; /* account for skiping the first value */
- for(a=1; a<totvert; a++) {
- if (MirrTopoHash_Prev[a-1] != MirrTopoHash_Prev[a]) {
- totUnique++;
- }
- }
-
- if (totUnique <= totUniqueOld) {
- /* Finish searching for unique valus when 1 loop dosnt give a
- * higher number of unique values compared to the previous loop */
- break;
- } else {
- totUniqueOld = totUnique;
- }
- /* Copy the hash calculated this iter, so we can use them next time */
- memcpy(MirrTopoHash_Prev, MirrTopoHash, sizeof(MirrTopoHash_t) * totvert);
- }
-
- /* restore eve->tmp.* */
- if(eve_tmp_back) {
- EditVert *eve;
- totvert= 0;
- for(eve= em->verts.first; eve; eve= eve->next) {
- eve->tmp.p= eve_tmp_back[totvert++];
- }
-
- MEM_freeN(eve_tmp_back);
- eve_tmp_back= NULL;
- }
-
-
- /* Hash/Index pairs are needed for sorting to find index pairs */
- MirrTopoPairs= MEM_callocN( sizeof(MirrTopoPair_t) * totvert, "MirrTopoPairs");
-
- /* since we are looping through verts, initialize these values here too */
- mesh_topo_lookup = MEM_mallocN( totvert * sizeof(long), "mesh_topo_lookup" );
-
- if(em) {
- EM_init_index_arrays(em,1,0,0);
- }
-
-
- for(a=0; a<totvert; a++) {
- MirrTopoPairs[a].hash= MirrTopoHash[a];
- MirrTopoPairs[a].vIndex = a;
-
- /* initialize lookup */
- mesh_topo_lookup[a] = -1;
- }
-
- qsort(MirrTopoPairs, totvert, sizeof(MirrTopoPair_t), MirrTopo_item_sort);
-
- /* Since the loop starts at 2, we must define the last index where the hash's differ */
- last = ((totvert >= 2) && (MirrTopoPairs[0].hash == MirrTopoPairs[1].hash)) ? 0 : 1;
-
- /* Get the pairs out of the sorted hashes, note, totvert+1 means we can use the previous 2,
- * but you cant ever access the last 'a' index of MirrTopoPairs */
- for(a=2; a < totvert+1; a++) {
- /* printf("I %d %ld %d\n", (a-last), MirrTopoPairs[a ].hash, MirrTopoPairs[a ].vIndex ); */
- if ((a==totvert) || (MirrTopoPairs[a-1].hash != MirrTopoPairs[a].hash)) {
- if (a-last==2) {
- if(em) {
- mesh_topo_lookup[MirrTopoPairs[a-1].vIndex] = (intptr_t)EM_get_vert_for_index(MirrTopoPairs[a-2].vIndex);
- mesh_topo_lookup[MirrTopoPairs[a-2].vIndex] = (intptr_t)EM_get_vert_for_index(MirrTopoPairs[a-1].vIndex);
- } else {
- mesh_topo_lookup[MirrTopoPairs[a-1].vIndex] = MirrTopoPairs[a-2].vIndex;
- mesh_topo_lookup[MirrTopoPairs[a-2].vIndex] = MirrTopoPairs[a-1].vIndex;
- }
- }
- last= a;
- }
- }
- if(em) {
- EM_free_index_arrays();
- }
-
- MEM_freeN( MirrTopoPairs );
- MirrTopoPairs = NULL;
-
- MEM_freeN( MirrTopoHash );
- MEM_freeN( MirrTopoHash_Prev );
-
- mesh_topo_lookup_vert_tot = totvert;
- mesh_topo_lookup_edge_tot = totedge;
-
- } else if(mode=='e') { /* end table */
- if (mesh_topo_lookup) {
- MEM_freeN(mesh_topo_lookup);
- }
- mesh_topo_lookup = NULL;
- mesh_topo_lookup_vert_tot= -1;
- mesh_topo_lookup_edge_tot= -1;
+ }
+ else if(mode=='s') { /* start table */
+ ED_mesh_mirrtopo_init(ob->data, ob->mode, &mesh_topo_store, FALSE);
+ }
+ else if(mode=='e') { /* end table */
+ ED_mesh_mirrtopo_free(&mesh_topo_store);
}
return 0;
}
@@ -1088,7 +888,7 @@ static int mesh_get_x_mirror_vert_topo(Object *ob, int index)
if (mesh_mirrtopo_table(ob, 'u')==-1)
return -1;
- return mesh_topo_lookup[index];
+ return mesh_topo_store.index_lookup[index];
}
int mesh_get_x_mirror_vert(Object *ob, int index)
@@ -1136,7 +936,7 @@ static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, struct EditMesh *em
}
}
- poinval= mesh_topo_lookup[ index ];
+ poinval= mesh_topo_store.index_lookup[index];
if(poinval != -1)
return (EditVert *)(poinval);
@@ -1280,8 +1080,8 @@ int *mesh_get_x_mirror_faces(Object *ob, EditMesh *em)
/* make sure v4 is not 0 if a quad */
if(mf->v4 && mirrormf.v4==0) {
- SWAP(int, mirrormf.v1, mirrormf.v3);
- SWAP(int, mirrormf.v2, mirrormf.v4);
+ SWAP(unsigned int, mirrormf.v1, mirrormf.v3);
+ SWAP(unsigned int, mirrormf.v2, mirrormf.v4);
}
hashmf= BLI_ghash_lookup(fhash, &mirrormf);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 07ab80f6d15..fa308624454 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -2178,3 +2178,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 185d8d43765..35e802e3e11 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 240fb8017f2..9a592bc9324 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -452,7 +452,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
Key *key=me->key;
KeyBlock *kb;
- if(!modifier_sameTopology(md)) {
+ if(!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes");
return 0;
}
@@ -500,7 +500,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
Mesh *me = ob->data;
MultiresModifierData *mmd= find_multires_modifier_before(scene, md);
- if( me->key) {
+ if(me->key && mti->type != eModifierTypeType_NonGeometrical) {
BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys");
return 0;
}
@@ -643,7 +643,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;
@@ -663,6 +663,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 3b4a5ed976e..a899d60c2ab 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/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 007a8f7e4d7..ffdfea7fde5 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1293,6 +1293,7 @@ static void area_split_exit(bContext *C, wmOperator *op)
op->customdata = NULL;
}
+ WM_cursor_restore(CTX_wm_window(C));
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
/* this makes sure aligned edges will result in aligned grabbing */
@@ -1491,6 +1492,37 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
}
}
break;
+
+ case MIDDLEMOUSE:
+ case TABKEY:
+ if (sd->previewmode==0){
+ }
+ else{
+ dir = RNA_enum_get(op->ptr, "direction");
+
+ if(event->val==KM_PRESS){
+ if (sd->sarea){
+ sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
+ ED_area_tag_redraw(sd->sarea);
+
+ if (dir=='v'){
+ RNA_enum_set(op->ptr, "direction", 'h');
+ sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
+
+ WM_cursor_set(CTX_wm_window(C),CURSOR_X_MOVE);
+ }
+ else{
+ RNA_enum_set(op->ptr, "direction", 'v');
+ sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
+
+ WM_cursor_set(CTX_wm_window(C),CURSOR_Y_MOVE);
+ }
+ }
+ }
+ }
+
+ break;
+
case RIGHTMOUSE: /* cancel operation */
case ESCKEY:
return area_split_cancel(C, op);
@@ -1634,6 +1666,47 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_FINISHED;
}
+static int region_scale_get_maxsize(RegionMoveData *rmd)
+{
+ int maxsize= 0;
+
+ if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+ return rmd->sa->winx - UI_UNIT_X;
+ }
+
+ if(rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
+ /* this calculation seems overly verbose
+ * can someone explain why this method is necessary? - campbell */
+ maxsize = rmd->maxsize - ((rmd->sa->headertype==HEADERTOP)?UI_UNIT_Y*2:UI_UNIT_Y) - (UI_UNIT_Y/4);
+ }
+
+ return maxsize;
+}
+
+static void region_scale_validate_size(RegionMoveData *rmd)
+{
+ if((rmd->ar->flag & RGN_FLAG_HIDDEN)==0) {
+ short *size, maxsize= -1;
+
+
+ if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT)
+ size= &rmd->ar->sizex;
+ else
+ size= &rmd->ar->sizey;
+
+ maxsize= region_scale_get_maxsize(rmd);
+
+ if(*size > maxsize && maxsize > 0)
+ *size= maxsize;
+ }
+}
+
+static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd)
+{
+ ED_region_toggle_hidden(C, rmd->ar);
+ region_scale_validate_size(rmd);
+}
+
static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
{
RegionMoveData *rmd= op->customdata;
@@ -1653,35 +1726,31 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
if(rmd->ar->sizex < UI_UNIT_X) {
rmd->ar->sizex= rmd->origval;
if(!(rmd->ar->flag & RGN_FLAG_HIDDEN))
- ED_region_toggle_hidden(C, rmd->ar);
+ region_scale_toggle_hidden(C, rmd);
}
else if(rmd->ar->flag & RGN_FLAG_HIDDEN)
- ED_region_toggle_hidden(C, rmd->ar);
+ region_scale_toggle_hidden(C, rmd);
}
else {
- int maxsize=0;
+ int maxsize= region_scale_get_maxsize(rmd);
delta= event->y - rmd->origy;
if(rmd->edge==AE_BOTTOM_TO_TOPLEFT) delta= -delta;
rmd->ar->sizey= rmd->origval + delta;
CLAMP(rmd->ar->sizey, 0, rmd->maxsize);
- if(rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
- /* this calculation seems overly verbose
- * can someone explain why this method is necessary? - campbell */
- maxsize = rmd->maxsize - ((rmd->sa->headertype==HEADERTOP)?UI_UNIT_Y*2:UI_UNIT_Y) - (UI_UNIT_Y/4);
- }
-
/* note, 'UI_UNIT_Y/4' means you need to drag the header almost
* all the way down for it to become hidden, this is done
* otherwise its too easy to do this by accident */
- if(rmd->ar->sizey < UI_UNIT_Y/4 || (maxsize > 0 && (rmd->ar->sizey > maxsize)) ) {
+ if(rmd->ar->sizey < UI_UNIT_Y/4) {
rmd->ar->sizey= rmd->origval;
if(!(rmd->ar->flag & RGN_FLAG_HIDDEN))
- ED_region_toggle_hidden(C, rmd->ar);
+ region_scale_toggle_hidden(C, rmd);
}
+ else if(maxsize > 0 && (rmd->ar->sizey > maxsize))
+ rmd->ar->sizey= maxsize;
else if(rmd->ar->flag & RGN_FLAG_HIDDEN)
- ED_region_toggle_hidden(C, rmd->ar);
+ region_scale_toggle_hidden(C, rmd);
}
ED_area_tag_redraw(rmd->sa);
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
@@ -1693,10 +1762,14 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
if(ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) {
if(rmd->ar->flag & RGN_FLAG_HIDDEN) {
- ED_region_toggle_hidden(C, rmd->ar);
- ED_area_tag_redraw(rmd->sa);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ region_scale_toggle_hidden(C, rmd);
}
+ else if(rmd->ar->flag & RGN_FLAG_TOO_SMALL) {
+ region_scale_validate_size(rmd);
+ }
+
+ ED_area_tag_redraw(rmd->sa);
+ WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
}
MEM_freeN(op->customdata);
op->customdata = NULL;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 3aefe5f9ea3..8a4cb8aa78b 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/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 3b001a8fcdc..a5e68f9a244 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -41,6 +41,7 @@ struct Mesh;
struct Object;
struct PaintStroke;
struct PointerRNA;
+struct rcti;
struct Scene;
struct VPaint;
struct ViewContext;
@@ -104,6 +105,26 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot);
/* paint_utils.c */
+
+/* Convert the object-space axis-aligned bounding box (expressed as
+ its minimum and maximum corners) into a screen-space rectangle,
+ returns zero if the result is empty */
+int paint_convert_bb_to_rect(struct rcti *rect,
+ const float bb_min[3],
+ const float bb_max[3],
+ const struct ARegion *ar,
+ struct RegionView3D *rv3d,
+ struct Object *ob);
+
+/* Get four planes in object-space that describe the projection of
+ screen_rect from screen into object-space (essentially converting a
+ 2D screens-space bounding box into four 3D planes) */
+void paint_calc_redraw_planes(float planes[4][4],
+ const struct ARegion *ar,
+ struct RegionView3D *rv3d,
+ struct Object *ob,
+ const struct rcti *screen_rect);
+
void projectf(struct bglMats *mats, const float v[3], float p[2]);
float paint_calc_object_space_radius(struct ViewContext *vc, float center[3], float pixel_radius);
float paint_get_tex_pixel(struct Brush* br, float u, float v);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 2d0ad349be8..eb20465a2ab 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -605,9 +605,13 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "weight_paint", 0);
- kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* face mask toggle */
RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask");
+ /* note, conflicts with vertex paint, but this is more useful */
+ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", VKEY, KM_PRESS, 0, 0); /* vert mask toggle */
+ RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask_vertex");
+
WM_keymap_verify_item(keymap, "PAINT_OT_weight_from_bones", WKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 0e65383861b..7cff37e8814 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -123,19 +123,19 @@ static int same_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
{
MTex* mtex = &brush->mtex;
- return
- (mtex->tex &&
- mtex->ofs[0] == snap->ofs[0] &&
- mtex->ofs[1] == snap->ofs[1] &&
- mtex->ofs[2] == snap->ofs[2] &&
- mtex->size[0] == snap->size[0] &&
- mtex->size[1] == snap->size[1] &&
- mtex->size[2] == snap->size[2] &&
- mtex->rot == snap->rot) &&
- ((mtex->brush_map_mode == MTEX_MAP_MODE_FIXED && brush_size(brush) <= snap->brush_size) || (brush_size(brush) == snap->brush_size)) && // make brush smaller shouldn't cause a resample
- mtex->brush_map_mode == snap->brush_map_mode &&
- vc->ar->winx == snap->winx &&
- vc->ar->winy == snap->winy;
+ return ( (mtex->tex) &&
+ equals_v3v3(mtex->ofs, snap->ofs) &&
+ equals_v3v3(mtex->size, snap->size) &&
+ mtex->rot == snap->rot
+ ) &&
+
+ /* make brush smaller shouldn't cause a resample */
+ ( (mtex->brush_map_mode == MTEX_MAP_MODE_FIXED && (brush_size(brush) <= snap->brush_size)) ||
+ (brush_size(brush) == snap->brush_size)) &&
+
+ (mtex->brush_map_mode == snap->brush_map_mode) &&
+ (vc->ar->winx == snap->winx) &&
+ (vc->ar->winy == snap->winy);
}
static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
@@ -869,7 +869,10 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
MEM_freeN(stroke);
return OPERATOR_FINISHED;
}
- else if(first || ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (event->type == TIMER && (event->customdata == stroke->timer))) {
+ else if( (first) ||
+ (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) ||
+ (event->type == TIMER && (event->customdata == stroke->timer)) )
+ {
if(stroke->stroke_started) {
if(paint_smooth_stroke(stroke, mouse, event)) {
if(paint_space_stroke_enabled(stroke->brush)) {
@@ -887,7 +890,8 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
}
}
- /* we want the stroke to have the first daub at the start location instead of waiting till we have moved the space distance */
+ /* we want the stroke to have the first daub at the start location
+ * instead of waiting till we have moved the space distance */
if(first &&
stroke->stroke_started &&
paint_space_stroke_enabled(stroke->brush) &&
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index ed2956ff054..fdacc2d15f5 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -67,6 +67,78 @@
#include "paint_intern.h"
+/* Convert the object-space axis-aligned bounding box (expressed as
+ its minimum and maximum corners) into a screen-space rectangle,
+ returns zero if the result is empty */
+int paint_convert_bb_to_rect(rcti *rect,
+ const float bb_min[3],
+ const float bb_max[3],
+ const ARegion *ar,
+ RegionView3D *rv3d,
+ Object *ob)
+{
+ float projection_mat[4][4];
+ int i, j, k;
+
+ rect->xmin = rect->ymin = INT_MAX;
+ rect->xmax = rect->ymax = INT_MIN;
+
+ /* return zero if the bounding box has non-positive volume */
+ if(bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
+ return 0;
+
+ ED_view3d_ob_project_mat_get(rv3d, ob, projection_mat);
+
+ for(i = 0; i < 2; ++i) {
+ for(j = 0; j < 2; ++j) {
+ for(k = 0; k < 2; ++k) {
+ float vec[3], proj[2];
+ vec[0] = i ? bb_min[0] : bb_max[0];
+ vec[1] = j ? bb_min[1] : bb_max[1];
+ vec[2] = k ? bb_min[2] : bb_max[2];
+ /* convert corner to screen space */
+ ED_view3d_project_float(ar, vec, proj,
+ projection_mat);
+ /* expand 2D rectangle */
+ rect->xmin = MIN2(rect->xmin, proj[0]);
+ rect->xmax = MAX2(rect->xmax, proj[0]);
+ rect->ymin = MIN2(rect->ymin, proj[1]);
+ rect->ymax = MAX2(rect->ymax, proj[1]);
+ }
+ }
+ }
+
+ /* return false if the rectangle has non-positive area */
+ return rect->xmin < rect->xmax && rect->ymin < rect->ymax;
+}
+
+/* Get four planes in object-space that describe the projection of
+ screen_rect from screen into object-space (essentially converting a
+ 2D screens-space bounding box into four 3D planes) */
+void paint_calc_redraw_planes(float planes[4][4],
+ const ARegion *ar,
+ RegionView3D *rv3d,
+ Object *ob,
+ const rcti *screen_rect)
+{
+ BoundBox bb;
+ bglMats mats;
+ rcti rect;
+
+ memset(&bb, 0, sizeof(BoundBox));
+ view3d_get_transformation(ar, rv3d, ob, &mats);
+
+ /* use some extra space just in case */
+ rect = *screen_rect;
+ rect.xmin -= 2;
+ rect.xmax += 2;
+ rect.ymin -= 2;
+ rect.ymax += 2;
+
+ ED_view3d_calc_clipping(&bb, planes, &mats, &rect);
+ mul_m4_fl(planes, -1.0f);
+}
+
/* convert a point in model coordinates to 2D screen coordinates */
/* TODO: can be deleted once all calls are replaced with
view3d_project_float() */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 272475194ee..9fb992d969c 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -248,90 +248,51 @@ typedef struct StrokeCache {
/* Get a screen-space rectangle of the modified area */
static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
- Object *ob, rcti *rect)
+ Object *ob, rcti *rect)
{
+ SculptSession *ss;
PBVH *pbvh= ob->sculpt->pbvh;
- float bb_min[3], bb_max[3], pmat[4][4];
- int i, j, k;
-
- ED_view3d_ob_project_mat_get(rv3d, ob, pmat);
+ float bb_min[3], bb_max[3];
if(!pbvh)
return 0;
BLI_pbvh_redraw_BB(pbvh, bb_min, bb_max);
- rect->xmin = rect->ymin = INT_MAX;
- rect->xmax = rect->ymax = INT_MIN;
-
- if(bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
+ /* convert 3D bounding box to screen space */
+ if(!paint_convert_bb_to_rect(rect,
+ bb_min,
+ bb_max,
+ ar,
+ rv3d,
+ ob)) {
return 0;
-
- for(i = 0; i < 2; ++i) {
- for(j = 0; j < 2; ++j) {
- for(k = 0; k < 2; ++k) {
- float vec[3], proj[2];
- vec[0] = i ? bb_min[0] : bb_max[0];
- vec[1] = j ? bb_min[1] : bb_max[1];
- vec[2] = k ? bb_min[2] : bb_max[2];
- ED_view3d_project_float(ar, vec, proj, pmat);
- rect->xmin = MIN2(rect->xmin, proj[0]);
- rect->xmax = MAX2(rect->xmax, proj[0]);
- rect->ymin = MIN2(rect->ymin, proj[1]);
- rect->ymax = MAX2(rect->ymax, proj[1]);
- }
- }
}
-
- if (rect->xmin < rect->xmax && rect->ymin < rect->ymax) {
- /* expand redraw rect with redraw rect from previous step to prevent
- partial-redraw issues caused by fast strokes. This is needed here (not in sculpt_flush_update)
- as it was before because redraw rectangle should be the same in both of
- optimized PBVH draw function and 3d view redraw (if not -- some mesh parts could
- disapper from screen (sergey) */
- SculptSession *ss = ob->sculpt;
- if (ss->cache) {
- if (!BLI_rcti_is_empty(&ss->cache->previous_r))
- BLI_union_rcti(rect, &ss->cache->previous_r);
- }
-
- return 1;
+ /* expand redraw rect with redraw rect from previous step to
+ prevent partial-redraw issues caused by fast strokes. This is
+ needed here (not in sculpt_flush_update) as it was before
+ because redraw rectangle should be the same in both of
+ optimized PBVH draw function and 3d view redraw (if not -- some
+ mesh parts could disapper from screen (sergey) */
+ ss = ob->sculpt;
+ if(ss->cache) {
+ if(!BLI_rcti_is_empty(&ss->cache->previous_r))
+ BLI_union_rcti(rect, &ss->cache->previous_r);
}
- return 0;
+ return 1;
}
void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar,
RegionView3D *rv3d, Object *ob)
{
PBVH *pbvh= ob->sculpt->pbvh;
- BoundBox bb;
- bglMats mats;
rcti rect;
- memset(&bb, 0, sizeof(BoundBox));
-
- view3d_get_transformation(ar, rv3d, ob, &mats);
- sculpt_get_redraw_rect(ar, rv3d,ob, &rect);
-
-#if 1
- /* use some extra space just in case */
- rect.xmin -= 2;
- rect.xmax += 2;
- rect.ymin -= 2;
- rect.ymax += 2;
-#else
- /* it was doing this before, allows to redraw a smaller
- part of the screen but also gives artifaces .. */
- rect.xmin += 2;
- rect.xmax -= 2;
- rect.ymin += 2;
- rect.ymax -= 2;
-#endif
+ sculpt_get_redraw_rect(ar, rv3d, ob, &rect);
- ED_view3d_calc_clipping(&bb, planes, &mats, &rect);
- mul_m4_fl(planes, -1.0f);
+ paint_calc_redraw_planes(planes, ar, rv3d, ob, &rect);
/* clear redraw flag from nodes */
if(pbvh)
@@ -592,7 +553,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 +1682,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 +2556,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 +2590,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 +2926,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 +3013,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 +3072,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 +3116,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_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 34726732a17..fe0b58ddda9 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -827,6 +827,7 @@ typedef struct ProxyBuildJob {
Scene *scene;
struct Main *main;
MovieClip *clip;
+ int clip_flag;
} ProxyJob;
static void proxy_freejob(void *pjv)
@@ -877,10 +878,10 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
for(cfra= sfra; cfra<=efra; cfra++) {
if(clip->source != MCLIP_SRC_MOVIE)
- BKE_movieclip_build_proxy_frame(clip, NULL, cfra, build_sizes, build_count, 0);
+ BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, NULL, cfra, build_sizes, build_count, 0);
if(undistort)
- BKE_movieclip_build_proxy_frame(clip, distortion, cfra, build_sizes, build_count, 1);
+ BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, build_sizes, build_count, 1);
if(*stop || G.afbreek)
break;
@@ -911,6 +912,7 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
pj->scene= scene;
pj->main= CTX_data_main(C);
pj->clip= clip;
+ pj->clip_flag= clip->flag&MCLIP_TIMECODE_FLAGS;
WM_jobs_customdata(steve, pj, proxy_freejob);
WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|ND_DISPLAY, 0);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 8a11c881527..d911e68236b 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -2406,7 +2406,8 @@ static int detect_features_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
- ImBuf *ibuf= BKE_movieclip_get_ibuf_flag(clip, &sc->user, 0);
+ int clip_flag= clip->flag&MCLIP_TIMECODE_FLAGS;
+ ImBuf *ibuf= BKE_movieclip_get_ibuf_flag(clip, &sc->user, clip_flag);
MovieTrackingTrack *track= clip->tracking.tracks.first;
int placement= RNA_enum_get(op->ptr, "placement");
int margin= RNA_int_get(op->ptr, "margin");
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 15e5719be37..1b5f2417384 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -115,6 +115,9 @@ static void active_node_panel(const bContext *C, Panel *pa)
uiItemS(layout);
uiItemR(layout, &ptr, "name", 0, NULL, ICON_NODE);
uiItemS(layout);
+
+ uiItemO(layout, NULL, 0, "NODE_OT_hide_socket_toggle");
+ uiItemS(layout);
/* draw this node's settings */
if (node->typeinfo && node->typeinfo->uifuncbut)
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 67b4c43343e..7b692f55965 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -351,10 +351,10 @@ static void node_update_hidden(bNode *node)
/* calculate minimal radius */
for(nsock= node->inputs.first; nsock; nsock= nsock->next)
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
+ if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)) && (nsock->flag & SOCK_IN_USE))
totin++;
for(nsock= node->outputs.first; nsock; nsock= nsock->next)
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
+ if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)) && (nsock->flag & SOCK_IN_USE))
totout++;
tot= MAX2(totin, totout);
@@ -371,7 +371,7 @@ static void node_update_hidden(bNode *node)
rad=drad= (float)M_PI/(1.0f + (float)totout);
for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
+ if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)) && (nsock->flag & SOCK_IN_USE)) {
nsock->locx= node->totr.xmax - hiddenrad + (float)sin(rad)*hiddenrad;
nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
rad+= drad;
@@ -382,7 +382,7 @@ static void node_update_hidden(bNode *node)
rad=drad= - (float)M_PI/(1.0f + (float)totin);
for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
- if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
+ if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)) && (nsock->flag & SOCK_IN_USE)) {
nsock->locx= node->totr.xmin + hiddenrad + (float)sin(rad)*hiddenrad;
nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
rad+= drad;
@@ -562,6 +562,18 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
}
+/* common handle function for operator buttons that need to select the node first */
+static void node_toggle_button_cb(struct bContext *C, void *node_argv, void *op_argv)
+{
+ bNode *node = (bNode*)node_argv;
+ const char *opname = (const char *)op_argv;
+
+ /* select & activate only the button's node */
+ node_select_single(C, node);
+
+ WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, NULL);
+}
+
static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
@@ -601,39 +613,34 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
- /* show/hide icons, note this sequence is copied in do_header_node() node_state.c */
+ /* show/hide icons */
iconofs= rct->xmax - 7.0f;
+ /* preview */
if(node->typeinfo->flag & NODE_PREVIEW) {
- float alpha = (node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT))? 1.0f: 0.5f;
-
+ uiBut *but;
iconofs-=iconbutw;
- uiDefIconBut(node->block, LABEL, B_REDR, ICON_MATERIAL, iconofs, rct->ymax-NODE_DY,
- iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, alpha, "");
+ uiBlockSetEmboss(node->block, UI_EMBOSSN);
+ but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_MATERIAL,
+ iconofs, rct->ymax-NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_preview_toggle");
+ /* XXX this does not work when node is activated and the operator called right afterwards,
+ * since active ID is not updated yet (needs to process the notifier).
+ * This can only work as visual indicator!
+ */
+// if (!(node->flag & (NODE_ACTIVE_ID|NODE_DO_OUTPUT)))
+// uiButSetFlag(but, UI_BUT_DISABLED);
+ uiBlockSetEmboss(node->block, UI_EMBOSS);
}
+ /* group edit */
if(node->type == NODE_GROUP) {
-
+ uiBut *but;
iconofs-=iconbutw;
- uiDefIconBut(node->block, LABEL, B_REDR, ICON_NODETREE, iconofs, rct->ymax-NODE_DY,
- iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, 0.5, "");
- }
- if(node->typeinfo->flag & NODE_OPTIONS) {
- iconofs-=iconbutw;
- uiDefIconBut(node->block, LABEL, B_REDR, ICON_BUTS, iconofs, rct->ymax-NODE_DY,
- iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, 0.5, "");
- }
- { /* always hide/reveal unused sockets */
- // XXX re-enable
- /* int shade;
- if(node_has_hidden_sockets(node))
- shade= -40;
- else
- shade= -90; */
-
- iconofs-=iconbutw;
-
- uiDefIconBut(node->block, LABEL, B_REDR, ICON_PLUS, iconofs, rct->ymax-NODE_DY,
- iconbutw, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, 0.5, "");
+ uiBlockSetEmboss(node->block, UI_EMBOSSN);
+ but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_NODETREE,
+ iconofs, rct->ymax-NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_group_edit");
+ uiBlockSetEmboss(node->block, UI_EMBOSS);
}
/* title */
@@ -643,7 +650,19 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
/* open/close entirely? */
- UI_DrawTriIcon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v');
+ {
+ uiBut *but;
+ int but_size = UI_UNIT_X *0.6f;
+ /* XXX button uses a custom triangle draw below, so make it invisible without icon */
+ uiBlockSetEmboss(node->block, UI_EMBOSSN);
+ but = uiDefBut(node->block, TOGBUT, B_REDR, "",
+ rct->xmin+10.0f-but_size/2, rct->ymax-NODE_DY/2.0f-but_size/2, but_size, but_size, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_hide_toggle");
+ uiBlockSetEmboss(node->block, UI_EMBOSS);
+
+ /* custom draw function for this button */
+ UI_DrawTriIcon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v');
+ }
/* this isn't doing anything for the label, so commenting out
if(node->flag & SELECT)
@@ -789,7 +808,19 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
/* open entirely icon */
- UI_DrawTriIcon(rct->xmin+10.0f, centy, 'h');
+ {
+ uiBut *but;
+ int but_size = UI_UNIT_X *0.6f;
+ /* XXX button uses a custom triangle draw below, so make it invisible without icon */
+ uiBlockSetEmboss(node->block, UI_EMBOSSN);
+ but = uiDefBut(node->block, TOGBUT, B_REDR, "",
+ rct->xmin+10.0f-but_size/2, centy-but_size/2, but_size, but_size, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_hide_toggle");
+ uiBlockSetEmboss(node->block, UI_EMBOSS);
+
+ /* custom draw function for this button */
+ UI_DrawTriIcon(rct->xmin+10.0f, centy, 'h');
+ }
/* disable lines */
if(node->flag & NODE_MUTED)
@@ -823,12 +854,12 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* sockets */
for(sock= node->inputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
+ if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)) && (sock->flag & SOCK_IN_USE))
node_socket_circle_draw(snode->nodetree, sock, socket_size);
}
for(sock= node->outputs.first; sock; sock= sock->next) {
- if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
+ if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)) && (sock->flag & SOCK_IN_USE))
node_socket_circle_draw(snode->nodetree, sock, socket_size);
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index e5a216d42b0..87a56274035 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -690,108 +690,6 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
}
}
-static int compare_nodes(bNode *a, bNode *b)
-{
- bNode *parent;
- /* These tell if either the node or any of the parent nodes is selected.
- * A selected parent means an unselected node is also in foreground!
- */
- int a_select=(a->flag & NODE_SELECT), b_select=(b->flag & NODE_SELECT);
- int a_active=(a->flag & NODE_ACTIVE), b_active=(b->flag & NODE_ACTIVE);
-
- /* if one is an ancestor of the other */
- /* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
- for (parent = a->parent; parent; parent=parent->parent) {
- /* if b is an ancestor, it is always behind a */
- if (parent==b)
- return 1;
- /* any selected ancestor moves the node forward */
- if (parent->flag & NODE_ACTIVE)
- a_active = 1;
- if (parent->flag & NODE_SELECT)
- a_select = 1;
- }
- for (parent = b->parent; parent; parent=parent->parent) {
- /* if a is an ancestor, it is always behind b */
- if (parent==a)
- return 0;
- /* any selected ancestor moves the node forward */
- if (parent->flag & NODE_ACTIVE)
- b_active = 1;
- if (parent->flag & NODE_SELECT)
- b_select = 1;
- }
-
- /* if one of the nodes is in the background and the other not */
- if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND))
- return 0;
- else if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND))
- return 1;
-
- /* if one has a higher selection state (active > selected > nothing) */
- if (!b_active && a_active)
- return 1;
- else if (!b_select && (a_active || a_select))
- return 1;
-
- return 0;
-}
-/* Sorts nodes by selection: unselected nodes first, then selected,
- * then the active node at the very end. Relative order is kept intact!
- */
-void node_sort(bNodeTree *ntree)
-{
- /* merge sort is the algorithm of choice here */
- bNode *first_a, *first_b, *node_a, *node_b, *tmp;
- int totnodes= BLI_countlist(&ntree->nodes);
- int k, a, b;
-
- k = 1;
- while (k < totnodes) {
- first_a = first_b = ntree->nodes.first;
-
- do {
- /* setup first_b pointer */
- for (b=0; b < k && first_b; ++b) {
- first_b = first_b->next;
- }
- /* all batches merged? */
- if (first_b==NULL)
- break;
-
- /* merge batches */
- node_a = first_a;
- node_b = first_b;
- a = b = 0;
- while (a < k && b < k && node_b) {
- if (compare_nodes(node_a, node_b)==0) {
- node_a = node_a->next;
- ++a;
- }
- else {
- tmp = node_b;
- node_b = node_b->next;
- ++b;
- BLI_remlink(&ntree->nodes, tmp);
- BLI_insertlinkbefore(&ntree->nodes, node_a, tmp);
- }
- }
-
- /* setup first pointers for next batch */
- first_b = node_b;
- for (; b < k; ++b) {
- /* all nodes sorted? */
- if (first_b==NULL)
- break;
- first_b = first_b->next;
- }
- first_a = first_b;
- } while (first_b);
-
- k = k << 1;
- }
-}
-
static int inside_rctf(rctf *bounds, rctf *rect)
{
return (bounds->xmin <= rect->xmin && bounds->xmax >= rect->xmax
@@ -940,7 +838,7 @@ static int node_group_edit_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
if (snode->nodetree==snode->edittree) {
- bNode *gnode= nodeGetActive(snode->nodetree);
+ bNode *gnode = nodeGetActive(snode->edittree);
snode_make_group_editable(snode, gnode);
}
else
@@ -955,8 +853,11 @@ static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
{
SpaceNode *snode = CTX_wm_space_node(C);
bNode *gnode;
-
- gnode= nodeGetActive(snode->edittree);
+
+ gnode = nodeGetActive(snode->edittree);
+ if (!gnode)
+ return OPERATOR_CANCELLED;
+
/* XXX callback? */
if(gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
uiPupMenuOkee(C, op->type->idname, "Make group local?");
@@ -1696,90 +1597,8 @@ void NODE_OT_resize(wmOperatorType *ot)
ot->flag= OPTYPE_BLOCKING;
}
-/* ********************** select ******************** */
-
-
-/* no undo here! */
-void node_deselectall(SpaceNode *snode)
-{
- bNode *node;
-
- for(node= snode->edittree->nodes.first; node; node= node->next)
- node->flag &= ~SELECT;
-}
-/* return 1 if we need redraw otherwise zero. */
-int node_select_same_type(SpaceNode *snode)
-{
- bNode *nac, *p;
- int redraw;
-
- /* search for the active node. */
- for (nac= snode->edittree->nodes.first; nac; nac= nac->next) {
- if (nac->flag & SELECT)
- break;
- }
-
- /* no active node, return. */
- if (!nac)
- return(0);
-
- redraw= 0;
- for (p= snode->edittree->nodes.first; p; p= p->next) {
- if (p->type != nac->type && p->flag & SELECT) {
- /* if it's selected but different type, unselect */
- redraw= 1;
- p->flag &= ~SELECT;
- }
- else if (p->type == nac->type && (!(p->flag & SELECT))) {
- /* if it's the same type and is not selected, select! */
- redraw= 1;
- p->flag |= SELECT;
- }
- }
- return(redraw);
-}
-
-/* return 1 if we need redraw, otherwise zero.
- * dir can be 0 == next or 0 != prev.
- */
-int node_select_same_type_np(SpaceNode *snode, int dir)
-{
- bNode *nac, *p;
-
- /* search the active one. */
- for (nac= snode->edittree->nodes.first; nac; nac= nac->next) {
- if (nac->flag & SELECT)
- break;
- }
-
- /* no active node, return. */
- if (!nac)
- return(0);
-
- if (dir == 0)
- p= nac->next;
- else
- p= nac->prev;
-
- while (p) {
- /* Now search the next with the same type. */
- if (p->type == nac->type)
- break;
-
- if (dir == 0)
- p= p->next;
- else
- p= p->prev;
- }
-
- if (p) {
- node_deselectall(snode);
- p->flag |= SELECT;
- return(1);
- }
- return(0);
-}
+/* ********************** hidden sockets ******************** */
int node_has_hidden_sockets(bNode *node)
{
@@ -1794,6 +1613,31 @@ int node_has_hidden_sockets(bNode *node)
return 0;
}
+/* note: call node_tree_verify_groups(snode->nodetree) after this
+ */
+void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set)
+{
+ bNodeSocket *sock;
+
+ if(set==0) {
+ for(sock= node->inputs.first; sock; sock= sock->next)
+ sock->flag &= ~SOCK_HIDDEN;
+ for(sock= node->outputs.first; sock; sock= sock->next)
+ sock->flag &= ~SOCK_HIDDEN;
+ }
+ else {
+ /* hide unused sockets */
+ for(sock= node->inputs.first; sock; sock= sock->next) {
+ if(sock->link==NULL)
+ sock->flag |= SOCK_HIDDEN;
+ }
+ for(sock= node->outputs.first; sock; sock= sock->next) {
+ if(nodeCountSocketLinks(snode->edittree, sock)==0)
+ sock->flag |= SOCK_HIDDEN;
+ }
+ }
+}
+
static void node_link_viewer(SpaceNode *snode, bNode *tonode)
{
bNode *node;
@@ -2232,7 +2076,7 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
{
bNode *node= NULL, *gnode;
- node_deselectall(snode);
+ node_deselect_all(snode);
node = nodeAddNode(snode->edittree, ntemp);
@@ -3130,15 +2974,21 @@ void NODE_OT_group_make(wmOperatorType *ot)
static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
{
- int tot_eq= 0, tot_neq= 0;
bNode *node;
+ int tot_eq= 0, tot_neq= 0;
+ /* Toggles the flag on all selected nodes.
+ * If the flag is set on all nodes it is unset.
+ * If the flag is not set on all nodes, it is set.
+ */
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
-
+
if(toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
continue;
-
+ if(toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+ continue;
+
if(node->flag & toggle_flag)
tot_eq++;
else
@@ -3147,10 +2997,12 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
}
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
-
+
if(toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
continue;
-
+ if(toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+ continue;
+
if( (tot_eq && tot_neq) || tot_eq==0)
node->flag |= toggle_flag;
else
@@ -3159,7 +3011,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
}
}
-static int node_hide_exec(bContext *C, wmOperator *UNUSED(op))
+static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
@@ -3182,14 +3034,14 @@ void NODE_OT_hide_toggle(wmOperatorType *ot)
ot->idname= "NODE_OT_hide_toggle";
/* callbacks */
- ot->exec= node_hide_exec;
+ ot->exec= node_hide_toggle_exec;
ot->poll= ED_operator_node_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int node_preview_exec(bContext *C, wmOperator *UNUSED(op))
+static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
@@ -3214,7 +3066,37 @@ void NODE_OT_preview_toggle(wmOperatorType *ot)
ot->idname= "NODE_OT_preview_toggle";
/* callbacks */
- ot->exec= node_preview_exec;
+ ot->exec= node_preview_toggle_exec;
+ ot->poll= ED_operator_node_active;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ SpaceNode *snode= CTX_wm_space_node(C);
+
+ /* sanity checking (poll callback checks this already) */
+ if((snode == NULL) || (snode->edittree == NULL))
+ return OPERATOR_CANCELLED;
+
+ node_flag_toggle_exec(snode, NODE_OPTIONS);
+
+ snode_notify(C, snode);
+
+ return OPERATOR_FINISHED;
+}
+
+void NODE_OT_options_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Toggle Node Options";
+ ot->description= "Toggle option buttons display for selected nodes";
+ ot->idname= "NODE_OT_options_toggle";
+
+ /* callbacks */
+ ot->exec= node_options_toggle_exec;
ot->poll= ED_operator_node_active;
/* flags */
@@ -3225,7 +3107,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node;
- int hidden= 0;
+ int hidden;
/* sanity checking (poll callback checks this already) */
if((snode == NULL) || (snode->edittree == NULL))
@@ -3233,6 +3115,8 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
+ /* Toggle for all selected nodes */
+ hidden = 0;
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
if(node_has_hidden_sockets(node)) {
@@ -3241,7 +3125,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
}
}
}
-
+
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
node_set_hidden_sockets(snode, node, !hidden);
@@ -3570,7 +3454,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
}
}
- node_deselectall(snode);
+ node_deselect_all(snode);
if (snode->nodetree->type==NTREE_COMPOSIT)
ntemp.type = CMP_NODE_IMAGE;
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 88b81d0855c..9068493360e 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -82,17 +82,23 @@ void node_operatortypes(void);
void node_keymap(wmKeyConfig *keyconf);
/* node_select.c */
+void node_deselect_all(struct SpaceNode *snode);
+int node_select_same_type(struct SpaceNode *snode);
+int node_select_same_type_np(struct SpaceNode *snode, int dir);
+void node_select_single(struct bContext *C, struct bNode *node);
+
void NODE_OT_select(struct wmOperatorType *ot);
void NODE_OT_select_all(wmOperatorType *ot);
void NODE_OT_select_linked_to(wmOperatorType *ot);
void NODE_OT_select_linked_from(wmOperatorType *ot);
-void NODE_OT_visibility_toggle(struct wmOperatorType *ot);
-void NODE_OT_view_all(struct wmOperatorType *ot);
void NODE_OT_select_border(struct wmOperatorType *ot);
void NODE_OT_select_same_type(struct wmOperatorType *ot);
void NODE_OT_select_same_type_next(wmOperatorType *ot);
void NODE_OT_select_same_type_prev(wmOperatorType *ot);
+/* node_state.c */
+void NODE_OT_view_all(struct wmOperatorType *ot);
+
/* drawnode.c */
void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link);
void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
@@ -108,10 +114,6 @@ void snode_dag_update(bContext *C, SpaceNode *snode);
bNode *node_add_node(struct SpaceNode *snode, struct Main *bmain, struct Scene *scene, struct bNodeTemplate *ntemp, float locx, float locy);
void snode_set_context(SpaceNode *snode, Scene *scene);
void snode_make_group_editable(SpaceNode *snode, bNode *gnode);
-void node_sort(struct bNodeTree *ntree);
-void node_deselectall(SpaceNode *snode);
-int node_select_same_type(SpaceNode *snode);
-int node_select_same_type_np(SpaceNode *snode, int dir);
void snode_composite_job(const struct bContext *C, ScrArea *sa);
bNode *node_tree_get_editgroup(bNodeTree *ntree);
void node_tree_verify_groups(bNodeTree *nodetree);
@@ -141,6 +143,7 @@ void NODE_OT_mute_toggle(struct wmOperatorType *ot);
void NODE_OT_hide_toggle(struct wmOperatorType *ot);
void NODE_OT_hide_socket_toggle(struct wmOperatorType *ot);
void NODE_OT_preview_toggle(struct wmOperatorType *ot);
+void NODE_OT_options_toggle(struct wmOperatorType *ot);
void NODE_OT_show_cyclic_dependencies(struct wmOperatorType *ot);
void NODE_OT_link_viewer(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 8309181ddda..b5c435b50e8 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -59,10 +59,11 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_select_same_type_prev);
WM_operatortype_append(NODE_OT_view_all);
- WM_operatortype_append(NODE_OT_visibility_toggle);
+
WM_operatortype_append(NODE_OT_mute_toggle);
WM_operatortype_append(NODE_OT_hide_toggle);
WM_operatortype_append(NODE_OT_preview_toggle);
+ WM_operatortype_append(NODE_OT_options_toggle);
WM_operatortype_append(NODE_OT_hide_socket_toggle);
WM_operatortype_append(NODE_OT_show_cyclic_dependencies);
@@ -148,7 +149,6 @@ void node_keymap(struct wmKeyConfig *keyconf)
/* each of these falls through if not handled... */
WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_resize", LEFTMOUSE, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "NODE_OT_visibility_toggle", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "NODE_OT_select_link_viewer", LEFTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index c863efada9f..15efd65450c 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -31,6 +31,8 @@
#include <stdio.h>
+#include "BLI_listbase.h"
+
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
@@ -68,6 +70,206 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my)
return NULL;
}
+static int compare_nodes(bNode *a, bNode *b)
+{
+ bNode *parent;
+ /* These tell if either the node or any of the parent nodes is selected.
+ * A selected parent means an unselected node is also in foreground!
+ */
+ int a_select=(a->flag & NODE_SELECT), b_select=(b->flag & NODE_SELECT);
+ int a_active=(a->flag & NODE_ACTIVE), b_active=(b->flag & NODE_ACTIVE);
+
+ /* if one is an ancestor of the other */
+ /* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
+ for (parent = a->parent; parent; parent=parent->parent) {
+ /* if b is an ancestor, it is always behind a */
+ if (parent==b)
+ return 1;
+ /* any selected ancestor moves the node forward */
+ if (parent->flag & NODE_ACTIVE)
+ a_active = 1;
+ if (parent->flag & NODE_SELECT)
+ a_select = 1;
+ }
+ for (parent = b->parent; parent; parent=parent->parent) {
+ /* if a is an ancestor, it is always behind b */
+ if (parent==a)
+ return 0;
+ /* any selected ancestor moves the node forward */
+ if (parent->flag & NODE_ACTIVE)
+ b_active = 1;
+ if (parent->flag & NODE_SELECT)
+ b_select = 1;
+ }
+
+ /* if one of the nodes is in the background and the other not */
+ if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND))
+ return 0;
+ else if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND))
+ return 1;
+
+ /* if one has a higher selection state (active > selected > nothing) */
+ if (!b_active && a_active)
+ return 1;
+ else if (!b_select && (a_active || a_select))
+ return 1;
+
+ return 0;
+}
+
+/* Sorts nodes by selection: unselected nodes first, then selected,
+ * then the active node at the very end. Relative order is kept intact!
+ */
+static void node_sort(bNodeTree *ntree)
+{
+ /* merge sort is the algorithm of choice here */
+ bNode *first_a, *first_b, *node_a, *node_b, *tmp;
+ int totnodes= BLI_countlist(&ntree->nodes);
+ int k, a, b;
+
+ k = 1;
+ while (k < totnodes) {
+ first_a = first_b = ntree->nodes.first;
+
+ do {
+ /* setup first_b pointer */
+ for (b=0; b < k && first_b; ++b) {
+ first_b = first_b->next;
+ }
+ /* all batches merged? */
+ if (first_b==NULL)
+ break;
+
+ /* merge batches */
+ node_a = first_a;
+ node_b = first_b;
+ a = b = 0;
+ while (a < k && b < k && node_b) {
+ if (compare_nodes(node_a, node_b)==0) {
+ node_a = node_a->next;
+ ++a;
+ }
+ else {
+ tmp = node_b;
+ node_b = node_b->next;
+ ++b;
+ BLI_remlink(&ntree->nodes, tmp);
+ BLI_insertlinkbefore(&ntree->nodes, node_a, tmp);
+ }
+ }
+
+ /* setup first pointers for next batch */
+ first_b = node_b;
+ for (; b < k; ++b) {
+ /* all nodes sorted? */
+ if (first_b==NULL)
+ break;
+ first_b = first_b->next;
+ }
+ first_a = first_b;
+ } while (first_b);
+
+ k = k << 1;
+ }
+}
+
+/* no undo here! */
+void node_deselect_all(SpaceNode *snode)
+{
+ bNode *node;
+
+ for(node= snode->edittree->nodes.first; node; node= node->next)
+ node->flag &= ~SELECT;
+}
+
+/* return 1 if we need redraw otherwise zero. */
+int node_select_same_type(SpaceNode *snode)
+{
+ bNode *nac, *p;
+ int redraw;
+
+ /* search for the active node. */
+ for (nac= snode->edittree->nodes.first; nac; nac= nac->next) {
+ if (nac->flag & SELECT)
+ break;
+ }
+
+ /* no active node, return. */
+ if (!nac)
+ return(0);
+
+ redraw= 0;
+ for (p= snode->edittree->nodes.first; p; p= p->next) {
+ if (p->type != nac->type && p->flag & SELECT) {
+ /* if it's selected but different type, unselect */
+ redraw= 1;
+ p->flag &= ~SELECT;
+ }
+ else if (p->type == nac->type && (!(p->flag & SELECT))) {
+ /* if it's the same type and is not selected, select! */
+ redraw= 1;
+ p->flag |= SELECT;
+ }
+ }
+ return(redraw);
+}
+
+/* return 1 if we need redraw, otherwise zero.
+ * dir can be 0 == next or 0 != prev.
+ */
+int node_select_same_type_np(SpaceNode *snode, int dir)
+{
+ bNode *nac, *p;
+
+ /* search the active one. */
+ for (nac= snode->edittree->nodes.first; nac; nac= nac->next) {
+ if (nac->flag & SELECT)
+ break;
+ }
+
+ /* no active node, return. */
+ if (!nac)
+ return(0);
+
+ if (dir == 0)
+ p= nac->next;
+ else
+ p= nac->prev;
+
+ while (p) {
+ /* Now search the next with the same type. */
+ if (p->type == nac->type)
+ break;
+
+ if (dir == 0)
+ p= p->next;
+ else
+ p= p->prev;
+ }
+
+ if (p) {
+ node_deselect_all(snode);
+ p->flag |= SELECT;
+ return(1);
+ }
+ return(0);
+}
+
+void node_select_single(bContext *C, bNode *node)
+{
+ Main *bmain= CTX_data_main(C);
+ SpaceNode *snode= CTX_wm_space_node(C);
+
+ node_deselect_all(snode);
+ node->flag |= SELECT;
+
+ ED_node_set_active(bmain, snode->edittree, node);
+
+ node_sort(snode->edittree);
+
+ WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL);
+}
+
/* ****** Click Select ****** */
static bNode *node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const int mval[2], short extend)
@@ -86,7 +288,7 @@ static bNode *node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, cons
if (node) {
if (extend == 0) {
- node_deselectall(snode);
+ node_deselect_all(snode);
node->flag |= SELECT;
}
else
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index bfebd087c3f..58623e17b10 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -52,160 +52,6 @@
#include "node_intern.h"
-/* **************** Node Header Buttons ************** */
-
-/* note: call node_tree_verify_groups(snode->nodetree) after this
- */
-void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set)
-{
- bNodeSocket *sock;
-
- if(set==0) {
- for(sock= node->inputs.first; sock; sock= sock->next)
- sock->flag &= ~SOCK_HIDDEN;
- for(sock= node->outputs.first; sock; sock= sock->next)
- sock->flag &= ~SOCK_HIDDEN;
- }
- else {
- /* hide unused sockets */
- for(sock= node->inputs.first; sock; sock= sock->next) {
- if(sock->link==NULL)
- sock->flag |= SOCK_HIDDEN;
- }
- for(sock= node->outputs.first; sock; sock= sock->next) {
- if(nodeCountSocketLinks(snode->edittree, sock)==0)
- sock->flag |= SOCK_HIDDEN;
- }
- }
-}
-
-static void node_hide_unhide_sockets(SpaceNode *snode, bNode *node)
-{
- node_set_hidden_sockets(snode, node, !node_has_hidden_sockets(node));
- ntreeUpdateTree(snode->edittree);
-}
-
-static int do_header_node(SpaceNode *snode, bNode *node, float mx, float my)
-{
- rctf totr= node->totr;
-
- totr.ymin= totr.ymax-20.0f;
-
- totr.xmax= totr.xmin+15.0f;
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag |= NODE_HIDDEN;
- return 1;
- }
-
- totr.xmax= node->totr.xmax;
- totr.xmin= totr.xmax-18.0f;
- if(node->typeinfo->flag & NODE_PREVIEW) {
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag ^= NODE_PREVIEW;
- return 1;
- }
- totr.xmin-=15.0f;
- }
- if(node->type == NODE_GROUP) {
- if(BLI_in_rctf(&totr, mx, my)) {
- snode_make_group_editable(snode, node);
- return 1;
- }
- totr.xmin-=15.0f;
- }
- if(node->typeinfo->flag & NODE_OPTIONS) {
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag ^= NODE_OPTIONS;
- return 1;
- }
- totr.xmin-=15.0f;
- }
- /* hide unused sockets */
- if(BLI_in_rctf(&totr, mx, my)) {
- node_hide_unhide_sockets(snode, node);
- }
-
- return 0;
-}
-
-static int do_header_hidden_node(bNode *node, float mx, float my)
-{
- rctf totr= node->totr;
-
- totr.xmax= totr.xmin+15.0f;
- if(BLI_in_rctf(&totr, mx, my)) {
- node->flag &= ~NODE_HIDDEN;
- return 1;
- }
- return 0;
-}
-
-static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, const int mval[2])
-{
- bNode *node;
- float mx, my;
-
- mx= (float)mval[0];
- my= (float)mval[1];
-
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &mx, &my);
-
- for(node=snode->edittree->nodes.last; node; node=node->prev) {
- if(node->flag & NODE_HIDDEN) {
- if(do_header_hidden_node(node, mx, my)) {
- ED_region_tag_redraw(ar);
- return 1;
- }
- }
- else {
- if(do_header_node(snode, node, mx, my)) {
- ED_region_tag_redraw(ar);
- return 1;
- }
- }
- }
- return 0;
-}
-
-static int node_toggle_visibility_exec(bContext *C, wmOperator *op)
-{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
- int mval[2];
-
- mval[0] = RNA_int_get(op->ptr, "mouse_x");
- mval[1] = RNA_int_get(op->ptr, "mouse_y");
- if(node_toggle_visibility(snode, ar, mval))
- return OPERATOR_FINISHED;
- else
- return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
-}
-
-static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
- RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
-
- return node_toggle_visibility_exec(C,op);
-}
-
-void NODE_OT_visibility_toggle(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Toggle Visibility";
- ot->idname= "NODE_OT_visibility_toggle";
- ot->description= "Handle clicks on node header buttons";
-
- /* api callbacks */
- ot->invoke= node_toggle_visibility_invoke;
- ot->poll= ED_operator_node_active;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- RNA_def_int(ot->srna, "mouse_x", 0, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "mouse_y", 0, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX);
-}
/* **************** View All Operator ************** */
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_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 16ee32d10a2..566659e0391 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -195,7 +195,6 @@ void TEXT_OT_new(wmOperatorType *ot)
ot->description= "Create a new text data block";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
ot->exec= text_new_exec;
ot->poll= text_new_poll;
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 6dd362b827f..e0b1741b0d0 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -70,6 +70,25 @@
#include "view3d_intern.h" // own include
+/* user data structures for derived mesh callbacks */
+typedef struct drawMeshFaceSelect_userData {
+ Mesh *me;
+ EdgeHash *eh;
+} drawMeshFaceSelect_userData;
+
+typedef struct drawEMTFMapped_userData {
+ EditMesh *em;
+ short has_mcol;
+ short has_mtface;
+ MFace *mf;
+ MTFace *tf;
+} drawEMTFMapped_userData;
+
+typedef struct drawTFace_userData {
+ MFace *mf;
+ MTFace *tf;
+} drawTFace_userData;
+
/**************************** Face Select Mode *******************************/
/* Flags for marked edges */
@@ -121,7 +140,7 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
static int draw_mesh_face_select__setHiddenOpts(void *userData, int index)
{
- struct { Mesh *me; EdgeHash *eh; } *data = userData;
+ drawMeshFaceSelect_userData *data = userData;
Mesh *me= data->me;
MEdge *med = &me->medge[index];
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
@@ -138,7 +157,7 @@ static int draw_mesh_face_select__setHiddenOpts(void *userData, int index)
static int draw_mesh_face_select__setSelectOpts(void *userData, int index)
{
- struct { Mesh *me; EdgeHash *eh; } *data = userData;
+ drawMeshFaceSelect_userData *data = userData;
MEdge *med = &data->me->medge[index];
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
@@ -159,7 +178,7 @@ static int draw_mesh_face_select__drawFaceOptsInv(void *userData, int index)
static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
{
- struct { Mesh *me; EdgeHash *eh; } data;
+ drawMeshFaceSelect_userData data;
data.me = me;
data.eh = get_tface_mesh_marked_edge_info(me);
@@ -513,7 +532,7 @@ static int draw_tface_mapped__set_draw(void *userData, int index)
static int draw_em_tf_mapped__set_draw(void *userData, int index)
{
- struct {EditMesh *em; short has_mcol; short has_mtface; MFace *mf; MTFace *tf;} *data = userData;
+ drawEMTFMapped_userData *data = userData;
EditMesh *em = data->em;
EditFace *efa= EM_get_face_for_index(index);
MTFace *tface;
@@ -631,7 +650,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
static int compareDrawOptions(void *userData, int cur_index, int next_index)
{
- struct { MFace *mf; MTFace *tf; } *data = userData;
+ drawTFace_userData *data = userData;
if(data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
return 0;
@@ -644,7 +663,7 @@ static int compareDrawOptions(void *userData, int cur_index, int next_index)
static int compareDrawOptionsEm(void *userData, int cur_index, int next_index)
{
- struct {EditMesh *em; short has_mcol; short has_mtface; MFace *mf; MTFace *tf;} *data= userData;
+ drawEMTFMapped_userData *data= userData;
if(data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
return 0;
@@ -669,7 +688,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
glColor4f(1.0f,1.0f,1.0f,1.0f);
if(ob->mode & OB_MODE_EDIT) {
- struct {EditMesh *em; short has_mcol; short has_mtface; MFace *mf; MTFace *tf;} data;
+ drawEMTFMapped_userData data;
data.em= me->edit_mesh;
data.has_mcol= CustomData_has_layer(&me->edit_mesh->fdata, CD_MCOL);
@@ -693,7 +712,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
dm->drawFacesTex(dm, draw_tface__set_draw_legacy, NULL, NULL);
}
else {
- struct { MFace *mf; MTFace *tf; } userData;
+ drawTFace_userData userData;
if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL))
add_tface_color_layer(dm);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6e4992e8048..e359e7a2402 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -118,6 +118,48 @@ typedef enum eWireDrawMode {
OBDRAW_WIRE_ON_DEPTH= 2
} eWireDrawMode;
+/* user data structures for derived mesh callbacks */
+typedef struct foreachScreenVert_userData {
+ void (*func)(void *userData, EditVert *eve, int x, int y, int index);
+ void *userData;
+ ViewContext vc;
+ eV3DClipTest clipVerts;
+} foreachScreenVert_userData;
+
+typedef struct foreachScreenEdge_userData {
+ void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index);
+ void *userData;
+ ViewContext vc;
+ eV3DClipTest clipVerts;
+} foreachScreenEdge_userData;
+
+typedef struct foreachScreenFace_userData {
+ void (*func)(void *userData, EditFace *efa, int x, int y, int index);
+ void *userData;
+ ViewContext vc;
+} foreachScreenFace_userData;
+
+typedef struct drawDMVerts_userData {
+ int sel;
+ EditVert *eve_act;
+} drawDMVerts_userData;
+
+typedef struct drawDMEdgesSel_userData {
+ unsigned char *baseCol, *selCol, *actCol;
+ EditEdge *eed_act;
+} drawDMEdgesSel_userData;
+
+typedef struct drawDMFacesSel_userData {
+ unsigned char *cols[4];
+ EditFace *efa_act;
+ int *orig_index;
+} drawDMFacesSel_userData;
+
+typedef struct bbsObmodeMeshVerts_userData {
+ void *offset;
+ MVert *mvert;
+} bbsObmodeMeshVerts_userData;
+
static void draw_bounding_volume(Scene *scene, Object *ob, char type);
static void drawcube_size(float size);
@@ -1914,9 +1956,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
* use the object matrix in the useual way */
static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
- struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index);
- void *userData; ViewContext vc; eV3DClipTest clipVerts; } *data = userData;
-
+ foreachScreenVert_userData *data = userData;
EditVert *eve = EM_get_vert_for_index(index);
if (eve->h==0) {
@@ -1938,9 +1978,7 @@ void mesh_foreachScreenVert(
void (*func)(void *userData, EditVert *eve, int x, int y, int index),
void *userData, eV3DClipTest clipVerts)
{
- struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index);
- void *userData; ViewContext vc; eV3DClipTest clipVerts; } data;
-
+ foreachScreenVert_userData data;
DerivedMesh *dm = editmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
data.vc= *vc;
@@ -1994,8 +2032,7 @@ static int is_co_in_region(ARegion *ar, const short co[2])
}
static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0co, float *v1co)
{
- struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index);
- void *userData; ViewContext vc; eV3DClipTest clipVerts; } *data = userData;
+ foreachScreenEdge_userData *data = userData;
EditEdge *eed = EM_get_edge_for_index(index);
short s[2][2];
@@ -2026,8 +2063,7 @@ void mesh_foreachScreenEdge(
void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index),
void *userData, eV3DClipTest clipVerts)
{
- struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index);
- void *userData; ViewContext vc; eV3DClipTest clipVerts; } data;
+ foreachScreenEdge_userData data;
DerivedMesh *dm = editmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
data.vc= *vc;
@@ -2047,7 +2083,7 @@ void mesh_foreachScreenEdge(
static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *UNUSED(no))
{
- struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; ViewContext vc; } *data = userData;
+ foreachScreenFace_userData *data = userData;
EditFace *efa = EM_get_face_for_index(index);
short s[2];
@@ -2065,7 +2101,7 @@ void mesh_foreachScreenFace(
void (*func)(void *userData, EditFace *efa, int x, int y, int index),
void *userData)
{
- struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; ViewContext vc; } data;
+ foreachScreenFace_userData data;
DerivedMesh *dm = editmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
data.vc= *vc;
@@ -2210,7 +2246,7 @@ static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm)
/* Draw verts with color set based on selection */
static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
- struct { int sel; EditVert *eve_act; } * data = userData;
+ drawDMVerts_userData * data = userData;
EditVert *eve = EM_get_vert_for_index(index);
if (eve->h==0 && (eve->f&SELECT)==data->sel) {
@@ -2237,7 +2273,7 @@ static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *
static void draw_dm_verts(DerivedMesh *dm, int sel, EditVert *eve_act)
{
- struct { int sel; EditVert *eve_act; } data;
+ drawDMVerts_userData data;
data.sel = sel;
data.eve_act = eve_act;
@@ -2251,7 +2287,7 @@ static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
{
EditEdge *eed = EM_get_edge_for_index(index);
//unsigned char **cols = userData, *col;
- struct { unsigned char *baseCol, *selCol, *actCol; EditEdge *eed_act; } * data = userData;
+ drawDMEdgesSel_userData * data = userData;
unsigned char *col;
if (eed->h==0) {
@@ -2275,7 +2311,7 @@ static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
}
static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *actCol, EditEdge *eed_act)
{
- struct { unsigned char *baseCol, *selCol, *actCol; EditEdge *eed_act; } data;
+ drawDMEdgesSel_userData data;
data.baseCol = baseCol;
data.selCol = selCol;
@@ -2360,7 +2396,7 @@ static void draw_dm_edges_freestyle(DerivedMesh *dm)
* return 2 for the active face so it renders with stipple enabled */
static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r))
{
- struct { unsigned char *cols[4]; EditFace *efa_act; int *orig_index; } * data = userData;
+ drawDMFacesSel_userData * data = userData;
EditFace *efa = EM_get_face_for_index(index);
unsigned char *col;
@@ -2380,7 +2416,7 @@ static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNU
static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int next_index)
{
- struct { unsigned char *cols[4]; EditFace *efa_act; int *orig_index; } *data = userData;
+ drawDMFacesSel_userData *data = userData;
EditFace *efa;
EditFace *next_efa;
unsigned char *col, *next_col;
@@ -2409,7 +2445,7 @@ static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int
/* also draws the active face */
static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *markCol, unsigned char *actCol, EditFace *efa_act)
{
- struct { unsigned char *cols[4]; EditFace *efa_act; int *orig_index; } data;
+ drawDMFacesSel_userData data;
data.cols[0] = baseCol;
data.cols[1] = selCol;
data.cols[2] = markCol;
@@ -2602,8 +2638,7 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d,
}
}
-static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
- Object *ob, EditMesh *em, UnitSettings *unit)
+static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em, UnitSettings *unit)
{
Mesh *me= ob->data;
EditEdge *eed;
@@ -2626,11 +2661,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) {
UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
@@ -2749,23 +2779,49 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
}
}
}
+}
- /* useful for debugging index vs shape key index */
-#if 0
- {
- EditVert *eve;
- int j;
+static void draw_em_indices(EditMesh *em)
+{
+ EditEdge *e;
+ EditFace *f;
+ EditVert *v;
+ int i;
+ char val[32];
+ float pos[3];
+ unsigned char col[4];
+
+ /* For now, reuse appropriate theme colors from stats text colors */
+
+ if (em->selectmode & SCE_SELECT_VERTEX) {
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
- for(eve= em->verts.first, j= 0; eve; eve= eve->next, j++) {
- sprintf(val, "%d:%d", j, eve->keyindex);
- view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ for (v = em->verts.first, i = 0; v; v = v->next, i++) {
+ if (v->f & SELECT) {
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ }
}
}
-#endif
- if(v3d->zbuf) {
- glEnable(GL_DEPTH_TEST);
- bglPolygonOffset(rv3d->dist, 0.0f);
+ if (em->selectmode & SCE_SELECT_EDGE) {
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
+ for (e = em->edges.first, i = 0; e; e = e->next, i++) {
+ if (e->f & 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);
+ }
+ }
+ }
+
+ if (em->selectmode & SCE_SELECT_FACE) {
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
+ for (f = em->faces.first, i = 0; f; f = f->next, i++) {
+ if (f->f & SELECT) {
+ sprintf(val, "%d", i);
+ view3d_cached_text_draw_add(f->cent, val, 0, V3D_CACHE_TEXT_ASCII, col);
+ }
+ }
}
}
@@ -2956,7 +3012,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);
}
}
@@ -6848,7 +6909,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
- struct {void* offset; MVert *mvert;} *data = userData;
+ bbsObmodeMeshVerts_userData *data = userData;
MVert *mv = &data->mvert[index];
int offset = (intptr_t) data->offset;
@@ -6860,7 +6921,7 @@ static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, float *co,
static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
{
- struct {void* offset; struct MVert *mvert;} data;
+ bbsObmodeMeshVerts_userData data;
Mesh *me = ob->data;
MVert *mvert = me->mvert;
data.mvert = mvert;
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 0c9ea3c6a2a..315da0423d1 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -276,7 +276,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;
@@ -316,7 +316,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_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 1be19f14618..886db3a5f0e 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -135,7 +135,7 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
/*
* ob == NULL if you want global matrices
* */
-void view3d_get_transformation(ARegion *ar, RegionView3D *rv3d, Object *ob, bglMats *mats)
+void view3d_get_transformation(const ARegion *ar, RegionView3D *rv3d, Object *ob, bglMats *mats)
{
float cpy[4][4];
int i, j;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 4d98afc4c10..aa444125287 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -512,7 +512,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
/* ********************************** */
-void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect)
+void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, const rcti *rect)
{
float modelview[4][4];
double xs, ys, p[3];
@@ -760,7 +760,7 @@ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y,
#endif
/* use view3d_get_object_project_mat to get projecting mat */
-void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4])
+void ED_view3d_project_float(const ARegion *ar, const float vec[3], float adr[2], float mat[4][4])
{
float vec4[4];
@@ -1727,7 +1727,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.c b/source/blender/editors/transform/transform.c
index f2387c278c4..1029888df23 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -582,6 +582,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
applyMouseInput(t, &t->mouse, t->mval, t->values);
+
+ // Snapping mouse move events
+ t->redraw |= handleSnapping(t, event);
}
/* handle modal keymap first */
@@ -1024,7 +1027,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
// Numerical input events
t->redraw |= handleNumInput(&(t->num), event);
- // Snapping events
+ // Snapping key events
t->redraw |= handleSnapping(t, event);
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index fcc285d52f0..2233aeda92e 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -65,15 +65,6 @@ struct wmTimer;
struct ARegion;
struct ReportList;
-/*
- The ctrl value has different meaning:
- 0 : No value has been typed
-
- otherwise, |value| - 1 is where the cursor is located after the period
- Positive : number is positive
- Negative : number is negative
-*/
-
typedef struct TransSnapPoint {
struct TransSnapPoint *next,*prev;
float co[3];
@@ -94,6 +85,7 @@ typedef struct TransSnap {
float snapNormal[3];
float snapTangent[3];
ListBase points;
+ TransSnapPoint *selectedPoint;
float dist; // Distance from snapPoint to snapTarget
double last;
void (*applySnap)(struct TransInfo *, float *);
@@ -618,6 +610,7 @@ int validSnappingNormal(TransInfo *t);
void getSnapPoint(TransInfo *t, float vec[3]);
void addSnapPoint(TransInfo *t);
+int updateSelectedSnapPoint(TransInfo *t);
void removeSnapPoint(TransInfo *t);
/********************** Mouse Input ******************************/
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 4b6c3a7031b..0f93ff12f95 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1548,8 +1548,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;
@@ -3448,7 +3450,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;
@@ -4144,7 +4149,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;
}
}
@@ -4443,7 +4451,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);
}
@@ -4454,7 +4463,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 :) */
@@ -4530,7 +4540,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);
}
}
}
@@ -5048,8 +5060,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 4635411dcdf..ed3e949c8a0 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -141,11 +141,16 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
if (validSnap(t) && activeSnap(t))
{
- unsigned char col[4];
+ unsigned char col[4], selectedCol[4], activeCol[4];
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
col[3]= 128;
- glColor4ubv(col);
+ UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
+ selectedCol[3]= 128;
+
+ UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
+ activeCol[3]= 192;
+
if (t->spacetype == SPACE_VIEW3D) {
TransSnapPoint *p;
View3D *v3d = CTX_wm_view3d(C);
@@ -160,16 +165,26 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
invert_m4_m4(imat, rv3d->viewmat);
for (p = t->tsnap.points.first; p; p = p->next) {
- drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size, imat);
+ if (p == t->tsnap.selectedPoint) {
+ glColor4ubv(selectedCol);
+ } else {
+ glColor4ubv(col);
+ }
+
+ drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size * 0.75f, imat);
}
if (t->tsnap.status & POINT_INIT) {
+ glColor4ubv(activeCol);
+
drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat);
}
/* draw normal if needed */
if (usingSnappingNormal(t) && validSnappingNormal(t))
{
+ glColor4ubv(activeCol);
+
glBegin(GL_LINES);
glVertex3f(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
glVertex3f( t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
@@ -219,7 +234,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
}
}
-int handleSnapping(TransInfo *UNUSED(t), wmEvent *UNUSED(event))
+int handleSnapping(TransInfo *t, wmEvent *event)
{
int status = 0;
@@ -232,6 +247,10 @@ int handleSnapping(TransInfo *UNUSED(t), wmEvent *UNUSED(event))
status = 1;
}
#endif
+ if (event->type == MOUSEMOVE)
+ {
+ status |= updateSelectedSnapPoint(t);
+ }
return status;
}
@@ -541,6 +560,8 @@ void addSnapPoint(TransInfo *t)
if (t->tsnap.status & POINT_INIT) {
TransSnapPoint *p = MEM_callocN(sizeof(TransSnapPoint), "SnapPoint");
+ t->tsnap.selectedPoint = p;
+
copy_v3_v3(p->co, t->tsnap.snapPoint);
BLI_addtail(&t->tsnap.points, p);
@@ -549,13 +570,55 @@ void addSnapPoint(TransInfo *t)
}
}
+int updateSelectedSnapPoint(TransInfo *t)
+{
+ int status = 0;
+ if (t->tsnap.status & MULTI_POINTS) {
+ TransSnapPoint *p, *closest_p = NULL;
+ int closest_dist = 0;
+ int screen_loc[2];
+
+ for( p = t->tsnap.points.first; p; p = p->next ) {
+ int dx, dy;
+ int dist;
+
+ project_int(t->ar, p->co, screen_loc);
+
+ dx = t->mval[0] - screen_loc[0];
+ dy = t->mval[1] - screen_loc[1];
+
+ dist = dx * dx + dy * dy;
+
+ if (dist < 100 && (closest_p == NULL || closest_dist > dist)) {
+ closest_p = p;
+ closest_dist = dist;
+ }
+ }
+
+ if (closest_p) {
+ status = t->tsnap.selectedPoint == closest_p ? 0 : 1;
+ t->tsnap.selectedPoint = closest_p;
+ }
+ }
+
+ return status;
+}
+
void removeSnapPoint(TransInfo *t)
{
if (t->tsnap.status & MULTI_POINTS) {
- BLI_freelinkN(&t->tsnap.points, t->tsnap.points.last);
+ updateSelectedSnapPoint(t);
+
+ if (t->tsnap.selectedPoint) {
+ BLI_freelinkN(&t->tsnap.points, t->tsnap.selectedPoint);
+
+ if (t->tsnap.points.first == NULL) {
+ t->tsnap.status &= ~MULTI_POINTS;
+ }
+
+ t->tsnap.selectedPoint = NULL;
+ }
- if (t->tsnap.points.first == NULL)
- t->tsnap.status &= ~MULTI_POINTS;
}
}
@@ -680,7 +743,7 @@ static float RotationBetween(TransInfo *t, float p1[3], float p2[3])
static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
{
- float d1[3], d2[3], center[3];
+ float d1[3], d2[3], center[3], len_d1;
copy_v3_v3(center, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
@@ -696,7 +759,9 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
mul_m3_v3(t->con.pmtx, d2);
}
- return len_v3(d2) / len_v3(d1);
+ len_d1 = len_v3(d1);
+
+ return len_d1 != 0.0f ? len_v3(d2) / len_d1 : 1;
}
/********************** CALC **************************/
@@ -1622,7 +1687,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_defs.h b/source/blender/makesdna/DNA_defs.h
index 88401d3d2d4..25d95419605 100644
--- a/source/blender/makesdna/DNA_defs.h
+++ b/source/blender/makesdna/DNA_defs.h
@@ -42,4 +42,7 @@
# endif
#endif
+/* hrmf, we need a better include then this */
+#include "../blenloader/BLO_sys_types.h" /* needed for int64_t only! */
+
#endif /* DNA_DEFS_H */
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 4f8b2343a9f..be13c8bba4f 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -38,6 +38,24 @@ 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_UINT64 = 10
+ /* ,SDNA_TYPE_VOID = 11 */ /* nothing uses yet */
+} eSDNA_Type;
+
+/* define so switch statements don't complain */
+#define SDNA_TYPE_VOID 11
+
struct SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap);
void DNA_sdna_free(struct SDNA *sdna);
@@ -49,6 +67,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 cd76944e1b0..8db24a91d41 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -162,8 +162,11 @@ typedef struct TFace {
#define ME_DRAWEXTRA_FACEAREA (1 << 11)
#define ME_DRAWEXTRA_FACEANG (1 << 12)
-#define ME_DRAW_FREESTYLE_EDGE (1 << 13)
-#define ME_DRAW_FREESTYLE_FACE (1 << 14)
+/* debug only option */
+#define ME_DRAWEXTRA_INDICES (1 << 13)
+
+#define ME_DRAW_FREESTYLE_EDGE (1 << 14)
+#define ME_DRAW_FREESTYLE_FACE (1 << 15)
/* old global flags:
#define G_DRAWEDGES (1 << 18)
@@ -192,4 +195,12 @@ typedef struct TFace {
#define MESH_MAX_VERTS 2000000000L
+/* this is so we can save bmesh files that load in trunk, ignoring NGons
+ * will eventually be removed */
+
+#if 0 /* enable in bmesh branch only for now */
+#define USE_MESH_FORWARDS_COMAT
+#endif
+
+
#endif
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index fc21f26fa32..1a065741121 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -113,6 +113,8 @@ typedef struct MovieClipScopes {
#define MCLIP_USE_PROXY (1<<0)
#define MCLIP_USE_PROXY_CUSTOM_DIR (1<<1)
+#define MCLIP_TIMECODE_FLAGS (MCLIP_USE_PROXY|MCLIP_USE_PROXY_CUSTOM_DIR)
+
/* MovieClip->render_size */
#define MCLIP_PROXY_RENDER_SIZE_FULL 0
#define MCLIP_PROXY_RENDER_SIZE_25 1
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 8707ae038c3..46b971e8e0d 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -250,8 +250,8 @@ typedef struct Object {
struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
struct DerivedMesh *derivedDeform, *derivedFinal;
- unsigned int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
- unsigned int customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
+ uint64_t lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
+ uint64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
unsigned int state; /* bit masks of game controllers that are active */
unsigned int init_state; /* bit masks of initial state as recorded by the users */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 6960e6e7d7f..01d3feb2135 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -581,7 +581,7 @@ typedef struct GameData {
short mode, matmode;
short occlusionRes; /* resolution of occlusion Z buffer in pixel */
short physicsEngine;
- short pad[2];
+ short exitkey, pad;
short ticrate, maxlogicstep, physubstep, maxphystep;
short obstacleSimulation, pad1;
float levelHeight;
@@ -920,8 +920,6 @@ typedef struct Scene {
unsigned int lay; /* bitflags for layer visibility */
int layact; /* active layer */
unsigned int lay_updated; /* runtime flag, has layer ever been updated since load? */
- unsigned int customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */
- unsigned int customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
short flag; /* various settings */
@@ -976,6 +974,9 @@ typedef struct Scene {
/* Movie Tracking */
struct MovieClip *clip; /* active movie clip */
+
+ uint64_t customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */
+ uint64_t customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
} Scene;
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index 1e8a4574120..149393b6723 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -181,6 +181,7 @@ typedef struct World {
#define TEXCO_ANGMAP 64
#define TEXCO_H_SPHEREMAP 256
#define TEXCO_H_TUBEMAP 1024
+#define TEXCO_EQUIRECTMAP 2048
/* mapto */
#define WOMAP_BLEND 1
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 0dba78ff97e..5b115a404ce 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -491,7 +491,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;
}
}
@@ -655,92 +655,92 @@ 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 if( strcmp(dna_type, "uint64_t")==0) return SDNA_TYPE_UINT64;
+ 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;
+ case SDNA_TYPE_UINT64:
+ val= *( (uint64_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;
+ case SDNA_TYPE_UINT64:
+ *( (uint64_t *)curdata)= val; break;
}
olddata+= oldlen;
@@ -838,7 +838,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:
@@ -912,7 +913,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.
@@ -1054,7 +1056,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;
@@ -1076,7 +1080,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;
@@ -1090,6 +1098,20 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
cpo+= 4;
}
}
+ else if ( (spc[0]==SDNA_TYPE_INT64) ||
+ (spc[0]==SDNA_TYPE_UINT64))
+ {
+ 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;
@@ -1138,3 +1160,27 @@ 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:
+ case SDNA_TYPE_UINT64:
+ return 8;
+ }
+
+ /* weak */
+ return 8;
+}
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index e869ccc3d77..9cfa01204ab 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -930,16 +930,19 @@ 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("uint64_t", 8); /* SDNA_TYPE_UINT64 */
+ 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 bb9fa28dd3f..dc6b7e4d456 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 c7909d2aa7d..74620b11d50 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2152,6 +2152,11 @@ static void rna_def_mesh(BlenderRNA *brna)
"Display 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_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index c588dc9c8ac..c15758eed1f 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -64,9 +64,13 @@ EnumPropertyItem nodetree_type_items[] = {
EnumPropertyItem node_socket_type_items[] = {
- {SOCK_FLOAT, "VALUE", 0, "Value", ""},
- {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
- {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
+ {SOCK_FLOAT, "VALUE", 0, "Value", ""},
+ {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
+ {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
+ {SOCK_SHADER, "SHADER", 0, "Shader", ""},
+ {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
+ {SOCK_MESH, "MESH", 0, "Mesh", ""},
+ {SOCK_INT, "INT", 0, "Int", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem node_math_items[] = {
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 9109c8fc023..f9bb0b36a3f 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -809,11 +809,11 @@ static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
if(value) {
ob->matbits[index]= 1;
- ob->colbits |= (1<<index);
+ /* ob->colbits |= (1<<index); */ /* DEPRECATED */
}
else {
ob->matbits[index]= 0;
- ob->colbits &= ~(1<<index);
+ /* ob->colbits &= ~(1<<index); */ /* DEPRECATED */
}
}
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index e06bc206807..877da130357 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -191,13 +191,12 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
if( tmpcu->mat ) {
for( i = tmpcu->totcol; i-- > 0; ) {
/* are we an object material or data based? */
- if (ob->colbits & 1<<i)
- tmpmesh->mat[i] = ob->mat[i];
- else
- tmpmesh->mat[i] = tmpcu->mat[i];
- if (tmpmesh->mat[i])
+ tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : tmpcu->mat[i];
+
+ if (tmpmesh->mat[i]) {
tmpmesh->mat[i]->id.us++;
+ }
}
}
break;
@@ -230,12 +229,11 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
if( origmesh->mat ) {
for( i = origmesh->totcol; i-- > 0; ) {
/* are we an object material or data based? */
- if (ob->colbits & 1<<i)
- tmpmesh->mat[i] = ob->mat[i];
- else
- tmpmesh->mat[i] = origmesh->mat[i];
- if (tmpmesh->mat[i])
+ tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : origmesh->mat[i];
+
+ if (tmpmesh->mat[i]) {
tmpmesh->mat[i]->id.us++;
+ }
}
}
}
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 abd7f6370f1..f0ef2d89870 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -662,10 +662,10 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
Scene *scene= ptr->id.data;
RenderData *rd= &scene->r;
#ifdef WITH_FFMPEG
- ffmpeg_verify_image_type(rd);
+ ffmpeg_verify_image_type(rd, imf);
#endif
#ifdef WITH_QUICKTIME
- quicktime_verify_image_type(rd);
+ quicktime_verify_image_type(rd, imf);
#endif
(void)rd;
}
@@ -1216,6 +1216,13 @@ static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
G.fileflags &= ~G_FILE_AUTOPLAY;
}
+static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
+{
+ GameData *gm = (GameData*)ptr->data;
+
+ if(ISKEYBOARD(value))
+ gm->exitkey=value;
+}
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
{
@@ -2530,6 +2537,13 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_range(prop, 8, 32);
RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display");
RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
+ 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", "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
prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f0a008b4939..a7f45d867dd 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2000,23 +2000,6 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_property_enum_items(prop, proxy_render_size_items);
RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
-
-
- /* not sure we need rna access to these but adding anyway */
- prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xof");
- RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the view center");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
-
- prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "yof");
- RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the view center");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
-
- prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "zoom");
- RNA_def_property_ui_text(prop, "Zoom", "Display zoom level");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
}
static void rna_def_space_text(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index bba1a607b65..d080a7b08dd 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2617,40 +2617,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_RS"},
+ {28, "SERBIAN_LATIN", 0, "Serbian latin (Srpski latinica)", "sr_RS@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/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 840498249ea..087716adbe3 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -143,6 +143,7 @@ static void rna_def_world_mtex(BlenderRNA *brna)
{TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates (interior mist)"},
{TEXCO_ANGMAP, "ANGMAP", 0, "AngMap", "Use 360 degree angular coordinates, e.g. for spherical light probes"},
{TEXCO_H_SPHEREMAP, "SPHERE", 0, "Sphere", "For 360 degree panorama sky, spherical mapped, only top half"},
+ {TEXCO_EQUIRECTMAP, "EQUIRECT", 0, "Equirectangular", "For 360 degree panorama sky, equirectangular mapping"},
{TEXCO_H_TUBEMAP, "TUBE", 0, "Tube", "For 360 degree panorama sky, cylindrical mapped, only top half"},
{TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index aba68dc9edc..d1092345930 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -38,13 +38,13 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "MEM_guardedalloc.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_particle.h"
+#include "BKE_cdderivedmesh.h"
-#include "MEM_guardedalloc.h"
#ifdef WITH_MOD_DECIMATE
#include "LOD_decimation.h"
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index a4097d8967b..32ab2c82f90 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -47,12 +47,12 @@
#include "BLI_utildefines.h"
#include "BLI_linklist.h"
+#include "MEM_guardedalloc.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
#include "BKE_particle.h"
-#include "MEM_guardedalloc.h"
#include "MOD_util.h"
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index c72a76f0101..8a003256ff2 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -266,7 +266,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
}
/* Flip face normal */
- SWAP(int, mf2->v1, mf2->v3);
+ SWAP(unsigned int, mf2->v1, mf2->v3);
DM_swap_face_data(result, numFaces, corner_indices);
test_index_face(mf2, &result->faceData, numFaces, inMF.v4?4:3);
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 8bcaf8802b5..55f29137eb9 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -35,14 +35,14 @@
#include <stddef.h>
+#include "DNA_mesh_types.h"
+
#include "BKE_cdderivedmesh.h"
#include "BKE_multires.h"
#include "BKE_modifier.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
-#include "DNA_mesh_types.h"
-
#include "MOD_util.h"
static void initData(ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 0867a4b2a7b..93abbb1780c 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -145,12 +145,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
int mface_index=0;
int step;
int i, j;
- int i1,i2;
+ unsigned int i1, i2;
int step_tot= useRenderParams ? ltmd->render_steps : ltmd->steps;
const int do_flip = ltmd->flag & MOD_SCREW_NORMAL_FLIP ? 1 : 0;
int maxVerts=0, maxEdges=0, maxFaces=0;
- int totvert= dm->getNumVerts(dm);
- int totedge= dm->getNumEdges(dm);
+ const unsigned int totvert= dm->getNumVerts(dm);
+ const unsigned int totedge= dm->getNumEdges(dm);
char axis_char= 'X', close;
float angle= ltmd->angle;
@@ -571,7 +571,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (lt_iter.v == lt_iter.e->v1) {
if (ed_loop_flip == 0) {
/*printf("\t\t\tFlipping 0\n");*/
- SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
+ SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
}/* else {
printf("\t\t\tFlipping Not 0\n");
}*/
@@ -579,7 +579,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
else if (lt_iter.v == lt_iter.e->v2) {
if (ed_loop_flip == 1) {
/*printf("\t\t\tFlipping 1\n");*/
- SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
+ SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
}/* else {
printf("\t\t\tFlipping Not 1\n");
}*/
@@ -771,8 +771,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
if( !mf_new->v3 || !mf_new->v4 ) {
- SWAP(int, mf_new->v1, mf_new->v3);
- SWAP(int, mf_new->v2, mf_new->v4);
+ SWAP(unsigned int, mf_new->v1, mf_new->v3);
+ SWAP(unsigned int, mf_new->v2, mf_new->v4);
}
mf_new->flag= ME_SMOOTH;
origindex[mface_index]= ORIGINDEX_NONE;
@@ -807,8 +807,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
if( !mf_new->v3 || !mf_new->v4 ) {
- SWAP(int, mf_new->v1, mf_new->v3);
- SWAP(int, mf_new->v2, mf_new->v4);
+ SWAP(unsigned int, mf_new->v1, mf_new->v3);
+ SWAP(unsigned int, mf_new->v2, mf_new->v4);
}
mf_new->flag= ME_SMOOTH;
origindex[mface_index]= ORIGINDEX_NONE;
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index 6c047a81fa5..e8f099785f9 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -35,6 +35,8 @@
#include <string.h>
+#include "DNA_object_types.h"
+
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -42,8 +44,6 @@
#include "BKE_modifier.h"
#include "BKE_shrinkwrap.h"
-#include "DNA_object_types.h"
-
#include "depsgraph_private.h"
#include "MOD_util.h"
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index 6edd8921c79..1bd5b2e78dd 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -39,13 +39,12 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
+#include "MEM_guardedalloc.h"
+
#include "BKE_cdderivedmesh.h"
#include "BKE_particle.h"
#include "BKE_deform.h"
-
-#include "MEM_guardedalloc.h"
-
#include "MOD_modifiertypes.h"
#include "MOD_util.h"
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 347af0066c6..2aa69526c10 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -40,16 +40,16 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
+#include "MEM_guardedalloc.h"
+
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_particle.h"
#include "BKE_deform.h"
-
#include "MOD_modifiertypes.h"
#include "MOD_util.h"
-#include "MEM_guardedalloc.h"
typedef struct EdgeFaceRef {
int f1; /* init as -1 */
@@ -75,8 +75,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
/* we don't want to overwrite any referenced layers */
/*
- Dosnt work here!
- mv = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT);
+ Doesn't work here!
+ mv = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, numVerts);
cddm->mvert = mv;
*/
@@ -350,7 +350,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
{
static int corner_indices[4] = {2, 1, 0, 3};
- int is_quad;
+ unsigned int is_quad;
for(i=0, mf=mface+numFaces; i<numFaces; i++, mf++) {
mf->v1 += numVerts;
@@ -362,7 +362,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* Flip face normal */
{
is_quad = mf->v4;
- SWAP(int, mf->v1, mf->v3);
+ SWAP(unsigned int, mf->v1, mf->v3);
DM_swap_face_data(result, i+numFaces, corner_indices);
test_index_face(mf, &result->faceData, numFaces, is_quad ? 4:3);
}
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index acf65a56561..38c2073b6a5 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -259,11 +259,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal);
}
+ numFaces = dm->getNumFaces(dm);
+
/* make sure we are not modifying the original UV map */
tface = CustomData_duplicate_referenced_layer_named(&dm->faceData,
- CD_MTFACE, uvname);
+ CD_MTFACE, uvname, numFaces);
-
numVerts = dm->getNumVerts(dm);
coords = MEM_callocN(sizeof(*coords) * numVerts,
@@ -280,7 +281,6 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
mul_project_m4_v3(projectors[0].projmat, *co);
mface = dm->getFaceArray(dm);
- numFaces = dm->getNumFaces(dm);
/* apply coords as UVs, and apply image if tfaces are new */
for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tface) {
@@ -290,7 +290,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
project_from_camera(tface->uv[0], coords[mf->v1], projectors[0].uci);
project_from_camera(tface->uv[1], coords[mf->v2], projectors[0].uci);
project_from_camera(tface->uv[2], coords[mf->v3], projectors[0].uci);
- if(mf->v3)
+ if(mf->v4)
project_from_camera(tface->uv[3], coords[mf->v4], projectors[0].uci);
}
else {
@@ -343,7 +343,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
project_from_camera(tface->uv[0], coords[mf->v1], best_projector->uci);
project_from_camera(tface->uv[1], coords[mf->v2], best_projector->uci);
project_from_camera(tface->uv[2], coords[mf->v3], best_projector->uci);
- if(mf->v3)
+ if(mf->v4)
project_from_camera(tface->uv[3], coords[mf->v4], best_projector->uci);
}
else {
@@ -407,7 +407,7 @@ ModifierTypeInfo modifierType_UVProject = {
/* name */ "UVProject",
/* structName */ "UVProjectModifierData",
/* structSize */ sizeof(UVProjectModifierData),
- /* type */ eModifierTypeType_Nonconstructive,
+ /* type */ eModifierTypeType_NonGeometrical,
/* flags */ eModifierTypeFlag_AcceptsMesh
| eModifierTypeFlag_SupportsMapping
| eModifierTypeFlag_SupportsEditmode
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 24d80fe847c..bdd7ab7486b 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -177,10 +177,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
- DerivedMesh *dm = derivedData, *ret = NULL;
-#if 0
- Mesh *ob_m = NULL;
-#endif
+ DerivedMesh *dm = derivedData;
MDeformVert *dvert = NULL;
MDeformWeight **dw = NULL;
float *org_w; /* Array original weights. */
@@ -188,7 +185,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
int numVerts;
int defgrp_idx;
int i;
- char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */
/* Flags. */
int do_add = (wmd->edit_flags & MOD_WVG_EDIT_ADD2VG) != 0;
int do_rem = (wmd->edit_flags & MOD_WVG_EDIT_REMFVG) != 0;
@@ -207,49 +203,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
if (defgrp_idx < 0)
return dm;
- /* XXX All this to avoid copying dm when not needed... However, it nearly doubles compute
- * time! See scene 5 of the WeighVG test file...
- */
-#if 0
- /* Get actual dverts (ie vertex group data). */
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- /* If no dverts, return unmodified data... */
- if (dvert == NULL)
- return dm;
-
- /* Get org mesh, only to test whether affected cdata layer has already been copied
- * somewhere up in the modifiers stack.
- */
- ob_m = get_mesh(ob);
- if (ob_m == NULL)
- return dm;
-
- /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */
- if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) {
- /* XXX Seems to create problems with weightpaint mode???
- * I'm missing something here, I guess...
- */
-// DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */
- ret = CDDM_copy(dm);
- dvert = ret->getVertDataArray(ret, CD_MDEFORMVERT);
- if (dvert == NULL) {
- ret->release(ret);
- return dm;
- }
- rel_ret = 1;
- }
- else
- ret = dm;
-#else
- ret = CDDM_copy(dm);
- rel_ret = 1;
- dvert = ret->getVertDataArray(ret, CD_MDEFORMVERT);
- if (dvert == NULL) {
- if (rel_ret)
- ret->release(ret);
- return dm;
- }
-#endif
+ dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
/* Get org weights, assuming 0.0 for vertices not in given vgroup. */
org_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, org_w");
@@ -271,7 +225,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
}
/* Do masking. */
- weightvg_do_mask(numVerts, NULL, org_w, new_w, ob, ret, wmd->mask_constant,
+ weightvg_do_mask(numVerts, NULL, org_w, new_w, ob, dm, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
@@ -285,7 +239,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(dw);
/* Return the vgroup-modified mesh. */
- return ret;
+ return dm;
}
static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
@@ -300,7 +254,7 @@ ModifierTypeInfo modifierType_WeightVGEdit = {
/* name */ "VertexWeightEdit",
/* structName */ "WeightVGEditModifierData",
/* structSize */ sizeof(WeightVGEditModifierData),
- /* type */ eModifierTypeType_Nonconstructive,
+ /* type */ eModifierTypeType_NonGeometrical,
/* flags */ eModifierTypeFlag_AcceptsMesh
/* |eModifierTypeFlag_SupportsMapping*/
|eModifierTypeFlag_SupportsEditmode,
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 221deeef1a6..17316d891da 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -219,10 +219,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
WeightVGMixModifierData *wmd = (WeightVGMixModifierData*) md;
- DerivedMesh *dm = derivedData, *ret = NULL;
-#if 0
- Mesh *ob_m = NULL;
-#endif
+ DerivedMesh *dm = derivedData;
MDeformVert *dvert = NULL;
MDeformWeight **dw1, **tdw1, **dw2, **tdw2;
int numVerts;
@@ -232,7 +229,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
int *tidx, *indices = NULL;
int numIdx = 0;
int i;
- char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */
/* Get number of verts. */
numVerts = dm->getNumVerts(dm);
@@ -254,49 +250,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
return dm;
}
- /* XXX All this to avoid copying dm when not needed... However, it nearly doubles compute
- * time! See scene 5 of the WeighVG test file...
- */
-#if 0
- /* Get actual dverts (ie vertex group data). */
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- /* If no dverts, return unmodified data... */
- if (dvert == NULL)
- return dm;
-
- /* Get org mesh, only to test whether affected cdata layer has already been copied
- * somewhere up in the modifiers stack.
- */
- ob_m = get_mesh(ob);
- if (ob_m == NULL)
- return dm;
-
- /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */
- if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) {
- /* XXX Seems to create problems with weightpaint mode???
- * I'm missing something here, I guess...
- */
-// DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */
- ret = CDDM_copy(dm);
- dvert = ret->getVertDataArray(ret, CD_MDEFORMVERT);
- if (dvert == NULL) {
- ret->release(ret);
- return dm;
- }
- rel_ret = 1;
- }
- else
- ret = dm;
-#else
- ret = CDDM_copy(dm);
- rel_ret = 1;
- dvert = ret->getVertDataArray(ret, CD_MDEFORMVERT);
- if (dvert == NULL) {
- if (rel_ret)
- ret->release(ret);
- return dm;
- }
-#endif
+ dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
/* Find out which vertices to work on. */
tidx = MEM_mallocN(sizeof(int) * numVerts, "WeightVGMix Modifier, tidx");
@@ -364,8 +318,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(tdw1);
MEM_freeN(tdw2);
MEM_freeN(tidx);
- if (rel_ret)
- ret->release(ret);
return dm;
}
if (numIdx != -1) {
@@ -400,7 +352,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
}
/* Do masking. */
- weightvg_do_mask(numIdx, indices, org_w, new_w, ob, ret, wmd->mask_constant,
+ weightvg_do_mask(numIdx, indices, org_w, new_w, ob, dm, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
@@ -419,7 +371,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(indices);
/* Return the vgroup-modified mesh. */
- return ret;
+ return dm;
}
static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
@@ -434,7 +386,7 @@ ModifierTypeInfo modifierType_WeightVGMix = {
/* name */ "VertexWeightMix",
/* structName */ "WeightVGMixModifierData",
/* structSize */ sizeof(WeightVGMixModifierData),
- /* type */ eModifierTypeType_Nonconstructive,
+ /* type */ eModifierTypeType_NonGeometrical,
/* flags */ eModifierTypeFlag_AcceptsMesh
/* |eModifierTypeFlag_SupportsMapping*/
|eModifierTypeFlag_SupportsEditmode,
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index a30c5da07c8..8e0949f2a22 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -28,11 +28,17 @@
* \ingroup modifiers
*/
+#define DO_PROFILE 0
+
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#if DO_PROFILE
+ #include "PIL_time.h"
+#endif
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
@@ -334,10 +340,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
{
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData*) md;
- DerivedMesh *dm = derivedData, *ret = NULL;
-#if 0
- Mesh *ob_m = NULL;
-#endif
+ DerivedMesh *dm = derivedData;
MDeformVert *dvert = NULL;
MDeformWeight **dw, **tdw;
int numVerts;
@@ -350,7 +353,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
int *tidx, *indices = NULL;
int numIdx = 0;
int i;
- char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */
+
+#if DO_PROFILE
+ TIMEIT_START(perf)
+#endif
/* Get number of verts. */
numVerts = dm->getNumVerts(dm);
@@ -371,49 +377,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
if (defgrp_idx < 0)
return dm;
- /* XXX All this to avoid copying dm when not needed... However, it nearly doubles compute
- * time! See scene 5 of the WeighVG test file...
- */
-#if 0
- /* Get actual dverts (ie vertex group data). */
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- /* If no dverts, return unmodified data... */
- if (dvert == NULL)
- return dm;
-
- /* Get org mesh, only to test whether affected cdata layer has already been copied
- * somewhere up in the modifiers stack.
- */
- ob_m = get_mesh(ob);
- if (ob_m == NULL)
- return dm;
-
- /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */
- if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) {
- /* XXX Seems to create problems with weightpaint mode???
- * I'm missing something here, I guess...
- */
-// DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */
- ret = CDDM_copy(dm);
- dvert = ret->getVertDataArray(ret, CD_MDEFORMVERT);
- if (dvert == NULL) {
- ret->release(ret);
- return dm;
- }
- rel_ret = 1;
- }
- else
- ret = dm;
-#else
- ret = CDDM_copy(dm);
- rel_ret = 1;
- dvert = ret->getVertDataArray(ret, CD_MDEFORMVERT);
- if (dvert == NULL) {
- if (rel_ret)
- ret->release(ret);
- return dm;
- }
-#endif
+ dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
/* Find out which vertices to work on (all vertices in vgroup), and get their relevant weight.
*/
@@ -433,25 +397,39 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(tidx);
MEM_freeN(tw);
MEM_freeN(tdw);
- if (rel_ret)
- ret->release(ret);
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");
- for (i = 0; i < numIdx; i++)
- ret->getVertCo(ret, indices[i], v_cos[i]);
+ 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");
+ 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) {
@@ -516,7 +494,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
do_map(new_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
/* Do masking. */
- weightvg_do_mask(numIdx, indices, org_w, new_w, ob, ret, wmd->mask_constant,
+ weightvg_do_mask(numIdx, indices, org_w, new_w, ob, dm, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
@@ -527,11 +505,16 @@ 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
+ TIMEIT_END(perf)
+#endif
+
/* Return the vgroup-modified mesh. */
- return ret;
+ return dm;
}
static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
@@ -546,7 +529,7 @@ ModifierTypeInfo modifierType_WeightVGProximity = {
/* name */ "VertexWeightProximity",
/* structName */ "WeightVGProximityModifierData",
/* structSize */ sizeof(WeightVGProximityModifierData),
- /* type */ eModifierTypeType_Nonconstructive,
+ /* type */ eModifierTypeType_NonGeometrical,
/* flags */ eModifierTypeFlag_AcceptsMesh
/* |eModifierTypeFlag_SupportsMapping*/
|eModifierTypeFlag_SupportsEditmode,
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/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 87585c35e6a..8b8afc3d846 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -134,8 +134,6 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
bNodeSocket *sock;
int a;
- ntreeSocketUseFlags(ntree);
-
for(node= ntree->nodes.first; node; node= node->next) {
if(node->type==SH_NODE_TEXTURE) {
if((r_mode & R_OSA) && node->id) {
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 03d66e918d5..e32444976dd 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -453,7 +453,7 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
}
}
- switch(self->type) {
+ switch (self->type) {
case GL_BYTE:
return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0:-1;
case GL_SHORT:
@@ -595,7 +595,7 @@ static PyObject *Buffer_repr(Buffer *self)
PyObject *repr;
const char *typestr= "UNKNOWN";
- switch(self->type) {
+ switch (self->type) {
case GL_BYTE: typestr= "GL_BYTE"; break;
case GL_SHORT: typestr= "GL_SHORT"; break;
case GL_INT: typestr= "GL_BYTE"; break;
@@ -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/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 88e2da16eb5..db3519a3056 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -51,7 +51,7 @@
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
-static Main *bpy_import_main= NULL;
+static Main *bpy_import_main = NULL;
/* 'builtins' is most likely PyEval_GetBuiltins() */
void bpy_import_init(PyObject *builtins)
@@ -59,13 +59,13 @@ void bpy_import_init(PyObject *builtins)
PyObject *item;
PyObject *mod;
- PyDict_SetItemString(builtins, "__import__", item=PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item);
+ PyDict_SetItemString(builtins, "__import__", item = PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item);
/* move reload here
* XXX, use import hooks */
- mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
+ mod = PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
if (mod) {
- PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
+ PyDict_SetItemString(PyModule_GetDict(mod), "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
Py_DECREF(mod);
}
else {
@@ -79,7 +79,7 @@ static void free_compiled_text(Text *text)
if (text->compiled) {
Py_DECREF((PyObject *)text->compiled);
}
- text->compiled= NULL;
+ text->compiled = NULL;
}
struct Main *bpy_import_main_get(void)
@@ -89,18 +89,18 @@ struct Main *bpy_import_main_get(void)
void bpy_import_main_set(struct Main *maggie)
{
- bpy_import_main= maggie;
+ bpy_import_main = maggie;
}
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
{
- BLI_snprintf(fn, fn_len, "%s%c%s", ID_BLEND_PATH(bpy_import_main, &text->id), SEP, text->id.name+2);
+ BLI_snprintf(fn, fn_len, "%s%c%s", ID_BLEND_PATH(bpy_import_main, &text->id), SEP, text->id.name + 2);
}
PyObject *bpy_text_import(Text *text)
{
- char *buf= NULL;
+ char *buf = NULL;
char modulename[24];
int len;
@@ -108,8 +108,8 @@ PyObject *bpy_text_import(Text *text)
char fn_dummy[256];
bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
- buf= txt_to_buf(text);
- text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
+ buf = txt_to_buf(text);
+ text->compiled = Py_CompileString(buf, fn_dummy, Py_file_input);
MEM_freeN(buf);
if (PyErr_Occurred()) {
@@ -121,38 +121,39 @@ PyObject *bpy_text_import(Text *text)
}
}
- len= strlen(text->id.name+2);
- BLI_strncpy(modulename, text->id.name+2, len);
- modulename[len - 3]= '\0'; /* remove .py */
+ len = strlen(text->id.name + 2);
+ BLI_strncpy(modulename, text->id.name + 2, len);
+ modulename[len - 3] = '\0'; /* remove .py */
return PyImport_ExecCodeModule(modulename, text->compiled);
}
PyObject *bpy_text_import_name(const char *name, int *found)
{
Text *text;
- char txtname[MAX_ID_NAME-2];
- int namelen= strlen(name);
-//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
- Main *maggie= bpy_import_main;
+ char txtname[MAX_ID_NAME - 2];
+ int namelen = strlen(name);
+//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+ Main *maggie = bpy_import_main;
- *found= 0;
+ *found = 0;
if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL;
}
-
- if (namelen >= (MAX_ID_NAME-2) - 3) return NULL; /* we know this cant be importable, the name is too long for blender! */
-
+
+ /* we know this cant be importable, the name is too long for blender! */
+ if (namelen >= (MAX_ID_NAME - 2) - 3) return NULL;
+
memcpy(txtname, name, namelen);
memcpy(&txtname[namelen], ".py", 4);
- text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
+ text = BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
if (!text)
return NULL;
else
- *found= 1;
+ *found = 1;
return bpy_text_import(text);
}
@@ -167,32 +168,32 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
Text *text;
const char *name;
char *filepath;
- char *buf= NULL;
-//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
- Main *maggie= bpy_import_main;
+ char *buf = NULL;
+//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+ Main *maggie = bpy_import_main;
if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL;
}
- *found= 0;
+ *found = 0;
/* get name, filename from the module itself */
- if ((name= PyModule_GetName(module)) == NULL)
+ if ((name = PyModule_GetName(module)) == NULL)
return NULL;
- if ((filepath= (char *)PyModule_GetFilename(module)) == NULL)
+ if ((filepath = (char *)PyModule_GetFilename(module)) == NULL)
return NULL;
/* look up the text object */
- text= BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
+ text = BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
if (!text)
return NULL;
else
- *found= 1;
+ *found = 1;
/* if previously compiled, free the object */
/* (can't see how could be NULL, but check just in case) */
@@ -201,8 +202,8 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
}
/* compile the buffer */
- buf= txt_to_buf(text);
- text->compiled= Py_CompileString(buf, text->id.name+2, Py_file_input);
+ buf = txt_to_buf(text);
+ text->compiled = Py_CompileString(buf, text->id.name + 2, Py_file_input);
MEM_freeN(buf);
/* if compile failed.... return this error */
@@ -223,20 +224,22 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
{
PyObject *exception, *err, *tb;
char *name;
- int found= 0;
- PyObject *globals= NULL, *locals= NULL, *fromlist= NULL;
- int level= -1; /* relative imports */
+ int found = 0;
+ PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
+ int level = -1; /* relative imports */
PyObject *newmodule;
//PyObject_Print(args, stderr, 0);
- static const char *kwlist[]= {"name", "globals", "locals", "fromlist", "level", NULL};
+ static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist,
- &name, &globals, &locals, &fromlist, &level))
+ &name, &globals, &locals, &fromlist, &level))
+ {
return NULL;
+ }
/* import existing builtin modules or modules that have been imported already */
- newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
+ newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
if (newmodule)
return newmodule;
@@ -244,7 +247,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
PyErr_Fetch(&exception, &err, &tb); /* get the python error incase we cant import as blender text either */
/* importing from existing modules failed, see if we have this module as blender text */
- newmodule= bpy_text_import_name(name, &found);
+ newmodule = bpy_text_import_name(name, &found);
if (newmodule) {/* found module as blender text, ignore above exception */
PyErr_Clear();
@@ -253,7 +256,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
Py_XDECREF(tb);
/* printf("imported from text buffer...\n"); */
}
- else if (found==1) { /* blender text module failed to execute but was found, use its error message */
+ else if (found == 1) { /* blender text module failed to execute but was found, use its error message */
Py_XDECREF(exception);
Py_XDECREF(err);
Py_XDECREF(tb);
@@ -275,18 +278,18 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
{
PyObject *exception, *err, *tb;
- PyObject *newmodule= NULL;
- int found= 0;
+ PyObject *newmodule = NULL;
+ int found = 0;
/* try reimporting from file */
- newmodule= PyImport_ReloadModule(module);
+ newmodule = PyImport_ReloadModule(module);
if (newmodule)
return newmodule;
/* no file, try importing from memory */
PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */
- newmodule= bpy_text_reimport(module, &found);
+ newmodule = bpy_text_reimport(module, &found);
if (newmodule) {/* found module as blender text, ignore above exception */
PyErr_Clear();
Py_XDECREF(exception);
@@ -294,7 +297,7 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
Py_XDECREF(tb);
/* printf("imported from text buffer...\n"); */
}
- else if (found==1) { /* blender text module failed to execute but was found, use its error message */
+ else if (found == 1) { /* blender text module failed to execute but was found, use its error message */
Py_XDECREF(exception);
Py_XDECREF(err);
Py_XDECREF(tb);
@@ -309,5 +312,5 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
return newmodule;
}
-PyMethodDef bpy_import_meth= {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
-PyMethodDef bpy_reload_meth= {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};
+PyMethodDef bpy_import_meth = {"bpy_import_meth", (PyCFunction)blender_import, METH_VARARGS | METH_KEYWORDS, "blenders import"};
+PyMethodDef bpy_reload_meth = {"bpy_reload_meth", (PyCFunction)blender_reload, METH_O, "blenders reload"};
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index c31dadff3e1..c058ee1d4f0 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -405,7 +405,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
val.array.len = PySequence_Size(ob);
- switch(val.array.type) {
+ switch (val.array.type) {
case IDP_DOUBLE:
prop = IDP_New(IDP_ARRAY, &val, name);
for (i=0; i<val.array.len; i++) {
@@ -565,7 +565,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
return NULL;
}
- switch(prop->subtype) {
+ switch (prop->subtype) {
case IDP_FLOAT:
{
float *array= (float*)IDP_Array(prop);
@@ -976,7 +976,7 @@ static PyObject *BPy_IDArray_repr(BPy_IDArray *self)
static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
{
- switch(self->prop->subtype) {
+ switch (self->prop->subtype) {
case IDP_FLOAT:
return PyUnicode_FromString("f");
case IDP_DOUBLE:
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 8d68a407e62..43b8dc21300 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -191,7 +191,7 @@ void PyC_FileAndNum(const char **filename, int *lineno)
void PyC_FileAndNum_Safe(const char **filename, int *lineno)
{
- if(!PYC_INTERPRETER_ACTIVE) {
+ if (!PYC_INTERPRETER_ACTIVE) {
return;
}
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 81882317244..b6e0897f626 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -60,7 +60,7 @@
#include "BPy_Freestyle.h"
-PyObject *bpy_package_py= NULL;
+PyObject *bpy_package_py = NULL;
PyDoc_STRVAR(bpy_script_paths_doc,
".. function:: script_paths()\n"
@@ -72,12 +72,12 @@ PyDoc_STRVAR(bpy_script_paths_doc,
);
static PyObject *bpy_script_paths(PyObject *UNUSED(self))
{
- PyObject *ret= PyTuple_New(2);
+ PyObject *ret = PyTuple_New(2);
char *path;
- path= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
+ path = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
- path= BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
+ path = BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
return ret;
@@ -85,8 +85,8 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self))
static int bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
{
- PyObject *list= (PyObject *)userdata;
- PyObject *item= PyUnicode_DecodeFSDefault(path_src);
+ PyObject *list = (PyObject *)userdata;
+ PyObject *item = PyUnicode_DecodeFSDefault(path_src);
PyList_Append(list, item);
Py_DECREF(item);
return FALSE; /* never edits the path */
@@ -108,13 +108,13 @@ PyDoc_STRVAR(bpy_blend_paths_doc,
);
static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
- int flag= 0;
+ int flag = 0;
PyObject *list;
- int absolute= FALSE;
- int packed= FALSE;
- int local= FALSE;
- static const char *kwlist[]= {"absolute", "packed", "local", NULL};
+ int absolute = FALSE;
+ int packed = FALSE;
+ int local = FALSE;
+ static const char *kwlist[] = {"absolute", "packed", "local", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "|ii:blend_paths",
(char **)kwlist, &absolute, &packed))
@@ -126,7 +126,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
if (!packed) flag |= BPATH_TRAVERSE_SKIP_PACKED;
if (local) flag |= BPATH_TRAVERSE_SKIP_LIBRARY;
- list= PyList_New(0);
+ list = PyList_New(0);
bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list);
@@ -134,13 +134,13 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
}
-// PyDoc_STRVAR(bpy_user_resource_doc[]= // now in bpy/utils.py
+// PyDoc_STRVAR(bpy_user_resource_doc[] = // now in bpy/utils.py
static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
- char *subdir= NULL;
+ char *subdir = NULL;
int folder_id;
- static const char *kwlist[]= {"type", "subdir", NULL};
+ static const char *kwlist[] = {"type", "subdir", NULL};
char *path;
@@ -148,20 +148,20 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
return NULL;
/* stupid string compare */
- if (!strcmp(type, "DATAFILES")) folder_id= BLENDER_USER_DATAFILES;
- else if (!strcmp(type, "CONFIG")) folder_id= BLENDER_USER_CONFIG;
- else if (!strcmp(type, "SCRIPTS")) folder_id= BLENDER_USER_SCRIPTS;
- else if (!strcmp(type, "AUTOSAVE")) folder_id= BLENDER_USER_AUTOSAVE;
+ if (!strcmp(type, "DATAFILES")) folder_id = BLENDER_USER_DATAFILES;
+ else if (!strcmp(type, "CONFIG")) folder_id = BLENDER_USER_CONFIG;
+ else if (!strcmp(type, "SCRIPTS")) folder_id = BLENDER_USER_SCRIPTS;
+ else if (!strcmp(type, "AUTOSAVE")) folder_id = BLENDER_USER_AUTOSAVE;
else {
PyErr_SetString(PyExc_ValueError, "invalid resource argument");
return NULL;
}
/* same logic as BLI_get_folder_create(), but best leave it up to the script author to create */
- path= BLI_get_folder(folder_id, subdir);
+ path = BLI_get_folder(folder_id, subdir);
if (!path)
- path= BLI_get_user_folder_notest(folder_id, subdir);
+ path = BLI_get_user_folder_notest(folder_id, subdir);
return PyUnicode_DecodeFSDefault(path ? path : "");
}
@@ -183,8 +183,8 @@ PyDoc_STRVAR(bpy_resource_path_doc,
static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
- int major= BLENDER_VERSION/100, minor= BLENDER_VERSION%100;
- static const char *kwlist[]= {"type", "major", "minor", NULL};
+ int major = BLENDER_VERSION / 100, minor = BLENDER_VERSION % 100;
+ static const char *kwlist[] = {"type", "major", "minor", NULL};
int folder_id;
char *path;
@@ -192,32 +192,32 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
return NULL;
/* stupid string compare */
- if (!strcmp(type, "USER")) folder_id= BLENDER_RESOURCE_PATH_USER;
- else if (!strcmp(type, "LOCAL")) folder_id= BLENDER_RESOURCE_PATH_LOCAL;
- else if (!strcmp(type, "SYSTEM")) folder_id= BLENDER_RESOURCE_PATH_SYSTEM;
+ if (!strcmp(type, "USER")) folder_id = BLENDER_RESOURCE_PATH_USER;
+ else if (!strcmp(type, "LOCAL")) folder_id = BLENDER_RESOURCE_PATH_LOCAL;
+ else if (!strcmp(type, "SYSTEM")) folder_id = BLENDER_RESOURCE_PATH_SYSTEM;
else {
PyErr_SetString(PyExc_ValueError, "invalid resource argument");
return NULL;
}
- path= BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
+ path = BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
return PyUnicode_DecodeFSDefault(path);
}
-static PyMethodDef meth_bpy_script_paths=
+static PyMethodDef meth_bpy_script_paths =
{"script_paths", (PyCFunction)bpy_script_paths, METH_NOARGS, bpy_script_paths_doc};
-static PyMethodDef meth_bpy_blend_paths=
+static PyMethodDef meth_bpy_blend_paths =
{"blend_paths", (PyCFunction)bpy_blend_paths, METH_VARARGS|METH_KEYWORDS, bpy_blend_paths_doc};
-static PyMethodDef meth_bpy_user_resource=
+static PyMethodDef meth_bpy_user_resource =
{"user_resource", (PyCFunction)bpy_user_resource, METH_VARARGS|METH_KEYWORDS, NULL};
-static PyMethodDef meth_bpy_resource_path=
+static PyMethodDef meth_bpy_resource_path =
{"resource_path", (PyCFunction)bpy_resource_path, METH_VARARGS|METH_KEYWORDS, bpy_resource_path_doc};
static PyObject *bpy_import_test(const char *modname)
{
- PyObject *mod= PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0);
+ PyObject *mod = PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0);
if (mod) {
Py_DECREF(mod);
}
@@ -240,11 +240,11 @@ void BPy_init_modules(void)
PyObject *mod;
/* Needs to be first since this dir is needed for future modules */
- char *modpath= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules");
+ char *modpath = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules");
if (modpath) {
// printf("bpy: found module path '%s'.\n", modpath);
- PyObject *sys_path= PySys_GetObject("path"); /* borrow */
- PyObject *py_modpath= PyUnicode_FromString(modpath);
+ PyObject *sys_path = PySys_GetObject("path"); /* borrow */
+ PyObject *py_modpath = PyUnicode_FromString(modpath);
PyList_Insert(sys_path, 0, py_modpath); /* add first */
Py_DECREF(py_modpath);
}
@@ -255,7 +255,7 @@ void BPy_init_modules(void)
IDProp_Init_Types(); /* not actually a submodule, just types */
Freestyle_Init();
- mod= PyModule_New("_bpy");
+ mod = PyModule_New("_bpy");
/* add the module so we can import it */
PyDict_SetItemString(PyImport_GetModuleDict(), "_bpy", mod);
@@ -283,7 +283,7 @@ void BPy_init_modules(void)
/* bpy context */
RNA_pointer_create(NULL, &RNA_Context, (void *)BPy_GetContext(), &ctx_ptr);
- bpy_context_module= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ctx_ptr);
+ bpy_context_module = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ctx_ptr);
/* odd that this is needed, 1 ref on creation and another for the module
* but without we get a crash on exit */
Py_INCREF(bpy_context_module);
@@ -301,5 +301,5 @@ void BPy_init_modules(void)
PyModule_AddObject(mod, meth_bpy_unregister_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_unregister_class, NULL));
/* add our own modules dir, this is a python package */
- bpy_package_py= bpy_import_test("bpy");
+ bpy_package_py = bpy_import_test("bpy");
}
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index a10be098a61..d5f0cd205fa 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -59,7 +59,7 @@ extern char build_system[];
static PyTypeObject BlenderAppType;
-static PyStructSequence_Field app_info_fields[]= {
+static PyStructSequence_Field app_info_fields[] = {
{(char *)"version", (char *)"The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{(char *)"version_string", (char *)"The Blender version formatted as a string"},
{(char *)"version_char", (char *)"The Blender version character (for minor releases)"},
@@ -83,11 +83,11 @@ static PyStructSequence_Field app_info_fields[]= {
{NULL}
};
-static PyStructSequence_Desc app_info_desc= {
+static PyStructSequence_Desc app_info_desc = {
(char *)"bpy.app", /* name */
(char *)"This module contains application values that remain unchanged during runtime.", /* doc */
app_info_fields, /* fields */
- (sizeof(app_info_fields)/sizeof(PyStructSequence_Field)) - 1
+ (sizeof(app_info_fields) / sizeof(PyStructSequence_Field)) - 1
};
#define DO_EXPAND(VAL) VAL ## 1
@@ -96,9 +96,9 @@ static PyStructSequence_Desc app_info_desc= {
static PyObject *make_app_info(void)
{
PyObject *app_info;
- int pos= 0;
+ int pos = 0;
- app_info= PyStructSequence_New(&BlenderAppType);
+ app_info = PyStructSequence_New(&BlenderAppType);
if (app_info == NULL) {
return NULL;
}
@@ -110,8 +110,11 @@ static PyObject *make_app_info(void)
#define SetObjItem(obj) \
PyStructSequence_SET_ITEM(app_info, pos++, obj)
- SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
- SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
+ SetObjItem(Py_BuildValue("(iii)",
+ BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
+ SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)",
+ BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
+
#if defined(BLENDER_VERSION_CHAR) && EXPAND(BLENDER_VERSION_CHAR) != 1
SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR));
#else
@@ -170,7 +173,7 @@ static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)
static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
{
- int param= PyObject_IsTrue(value);
+ int param = PyObject_IsTrue(value);
if (param < 0) {
PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
@@ -193,14 +196,14 @@ static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(cl
static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
{
- int param= PyLong_AsSsize_t(value);
+ int param = PyLong_AsSsize_t(value);
if (param == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
return -1;
}
- G.rt= param;
+ G.rt = param;
return 0;
}
@@ -229,7 +232,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl
}
-static PyGetSetDef bpy_app_getsets[]= {
+static PyGetSetDef bpy_app_getsets[] = {
{(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, NULL},
{(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)bpy_app_debug_value_doc, NULL},
{(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)bpy_app_tempdir_doc, NULL},
@@ -242,7 +245,7 @@ static void py_struct_seq_getset_init(void)
/* tricky dynamic members, not to py-spec! */
PyGetSetDef *getset;
- for (getset= bpy_app_getsets; getset->name; getset++) {
+ for (getset = bpy_app_getsets; getset->name; getset++) {
PyDict_SetItemString(BlenderAppType.tp_dict, getset->name, PyDescr_NewGetSet(&BlenderAppType, getset));
}
}
@@ -255,12 +258,12 @@ PyObject *BPY_app_struct(void)
PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
- ret= make_app_info();
+ ret = make_app_info();
/* prevent user from creating new instances */
- BlenderAppType.tp_init= NULL;
- BlenderAppType.tp_new= NULL;
- BlenderAppType.tp_hash= (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
+ BlenderAppType.tp_init = NULL;
+ BlenderAppType.tp_new = NULL;
+ BlenderAppType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
/* kindof a hack ontop of PyStructSequence */
py_struct_seq_getset_init();
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index dd512791e85..721bce51693 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -41,7 +41,7 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
static PyTypeObject BlenderAppCbType;
-static PyStructSequence_Field app_cb_info_fields[]= {
+static PyStructSequence_Field app_cb_info_fields[] = {
{(char *)"frame_change_pre", (char *)"Callback list - on frame change for playback and rendering (before)"},
{(char *)"frame_change_post", (char *)"Callback list - on frame change for playback and rendering (after)"},
{(char *)"render_pre", (char *)"Callback list - on render (before)"},
@@ -61,11 +61,11 @@ static PyStructSequence_Field app_cb_info_fields[]= {
{NULL}
};
-static PyStructSequence_Desc app_cb_info_desc= {
+static PyStructSequence_Desc app_cb_info_desc = {
(char *)"bpy.app.handlers", /* name */
(char *)"This module contains callbacks", /* doc */
app_cb_info_fields, /* fields */
- (sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field)) - 1
+ (sizeof(app_cb_info_fields) / sizeof(PyStructSequence_Field)) - 1
};
/*
@@ -82,11 +82,11 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyO
{
PyObject *value;
- if(!PyArg_ParseTuple(args, "O:bpy.app.handlers.persistent", &value))
+ if (!PyArg_ParseTuple(args, "O:bpy.app.handlers.persistent", &value))
return NULL;
if (PyFunction_Check(value)) {
- PyObject **dict_ptr= _PyObject_GetDictPtr(value);
+ PyObject **dict_ptr = _PyObject_GetDictPtr(value);
if (dict_ptr == NULL) {
PyErr_SetString(PyExc_ValueError,
"bpy.app.handlers.persistent wasn't able to "
@@ -96,7 +96,7 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyO
else {
/* set id */
if (*dict_ptr == NULL) {
- *dict_ptr= PyDict_New();
+ *dict_ptr = PyDict_New();
}
PyDict_SetItemString(*dict_ptr, PERMINENT_CB_ID, Py_None);
@@ -163,23 +163,23 @@ static PyTypeObject BPyPersistent_Type = {
0, /* tp_free */
};
-static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {NULL};
+static PyObject *py_cb_array[BLI_CB_EVT_TOT] = {NULL};
static PyObject *make_app_cb_info(void)
{
PyObject *app_cb_info;
- int pos= 0;
+ int pos = 0;
- app_cb_info= PyStructSequence_New(&BlenderAppCbType);
+ app_cb_info = PyStructSequence_New(&BlenderAppCbType);
if (app_cb_info == NULL) {
return NULL;
}
- for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+ for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
if (app_cb_info_fields[pos].name == NULL) {
Py_FatalError("invalid callback slots 1");
}
- PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos]= PyList_New(0)));
+ PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos] = PyList_New(0)));
}
if (app_cb_info_fields[pos + APP_CB_OTHER_FIELDS].name != NULL) {
Py_FatalError("invalid callback slots 2");
@@ -196,7 +196,7 @@ PyObject *BPY_app_handlers_struct(void)
PyObject *ret;
#if defined(_MSC_VER) || defined(FREE_WINDOWS)
- BPyPersistent_Type.ob_base.ob_base.ob_type= &PyType_Type;
+ BPyPersistent_Type.ob_base.ob_base.ob_type = &PyType_Type;
#endif
if (PyType_Ready(&BPyPersistent_Type) < 0) {
@@ -205,24 +205,24 @@ PyObject *BPY_app_handlers_struct(void)
PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc);
- ret= make_app_cb_info();
+ ret = make_app_cb_info();
/* prevent user from creating new instances */
- BlenderAppCbType.tp_init= NULL;
- BlenderAppCbType.tp_new= NULL;
- BlenderAppCbType.tp_hash= (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
+ BlenderAppCbType.tp_init = NULL;
+ BlenderAppCbType.tp_new = NULL;
+ BlenderAppCbType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
/* assign the C callbacks */
if (ret) {
- static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}};
+ static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT] = {{NULL}};
bCallbackFuncStore *funcstore;
- int pos= 0;
+ int pos = 0;
- for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
- funcstore= &funcstore_array[pos];
- funcstore->func= bpy_app_generic_callback;
- funcstore->alloc= 0;
- funcstore->arg= SET_INT_IN_POINTER(pos);
+ for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
+ funcstore = &funcstore_array[pos];
+ funcstore->func = bpy_app_generic_callback;
+ funcstore->alloc = 0;
+ funcstore->arg = SET_INT_IN_POINTER(pos);
BLI_add_cb(funcstore, pos);
}
}
@@ -232,32 +232,32 @@ PyObject *BPY_app_handlers_struct(void)
void BPY_app_handlers_reset(const short do_all)
{
- int pos= 0;
+ int pos = 0;
if (do_all) {
- for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+ for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
/* clear list */
PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL);
}
}
else {
/* save string conversion thrashing */
- PyObject *perm_id_str= PyUnicode_FromString(PERMINENT_CB_ID);
+ PyObject *perm_id_str = PyUnicode_FromString(PERMINENT_CB_ID);
- for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+ for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
/* clear only items without PERMINENT_CB_ID */
- PyObject *ls= py_cb_array[pos];
+ PyObject *ls = py_cb_array[pos];
Py_ssize_t i;
PyObject *item;
PyObject **dict_ptr;
- for(i= PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
+ for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
- if ( (PyFunction_Check((item= PyList_GET_ITEM(ls, i)))) &&
- (dict_ptr= _PyObject_GetDictPtr(item)) &&
- (*dict_ptr) &&
- (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
+ if ( (PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
+ (dict_ptr = _PyObject_GetDictPtr(item)) &&
+ (*dict_ptr) &&
+ (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
{
/* keep */
}
@@ -276,12 +276,12 @@ void BPY_app_handlers_reset(const short do_all)
/* the actual callback - not necessarily called from py */
void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
{
- PyObject *cb_list= py_cb_array[GET_INT_FROM_POINTER(arg)];
+ PyObject *cb_list = py_cb_array[GET_INT_FROM_POINTER(arg)];
Py_ssize_t cb_list_len;
- if ((cb_list_len= PyList_GET_SIZE(cb_list)) > 0) {
- PyGILState_STATE gilstate= PyGILState_Ensure();
+ if ((cb_list_len = PyList_GET_SIZE(cb_list)) > 0) {
+ PyGILState_STATE gilstate = PyGILState_Ensure();
- PyObject* args= PyTuple_New(1); // save python creating each call
+ PyObject* args = PyTuple_New(1); // save python creating each call
PyObject* func;
PyObject* ret;
Py_ssize_t pos;
@@ -298,10 +298,10 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
}
// Iterate the list and run the callbacks
- for (pos=0; pos < cb_list_len; pos++) {
- func= PyList_GET_ITEM(cb_list, pos);
- ret= PyObject_Call(func, args, NULL);
- if (ret==NULL) {
+ for (pos = 0; pos < cb_list_len; pos++) {
+ func = PyList_GET_ITEM(cb_list, pos);
+ ret = PyObject_Call(func, args, NULL);
+ if (ret == NULL) {
PyErr_Print();
PyErr_Clear();
}
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index e628cb891d8..95b00b18f43 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -47,7 +47,7 @@ extern void BPY_update_rna_module(void);
/* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */
-PyObject *bpy_pydriver_Dict= NULL;
+PyObject *bpy_pydriver_Dict = NULL;
/* For faster execution we keep a special dictionary for pydrivers, with
* the needed modules and aliases.
@@ -59,32 +59,32 @@ int bpy_pydriver_create_dict(void)
/* validate namespace for driver evaluation */
if (bpy_pydriver_Dict) return -1;
- d= PyDict_New();
+ d = PyDict_New();
if (d == NULL)
return -1;
else
- bpy_pydriver_Dict= d;
+ bpy_pydriver_Dict = d;
/* import some modules: builtins, bpy, math, (Blender.noise)*/
PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins());
- mod= PyImport_ImportModule("math");
+ mod = PyImport_ImportModule("math");
if (mod) {
PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
Py_DECREF(mod);
}
/* add bpy to global namespace */
- mod= PyImport_ImportModuleLevel((char *)"bpy", NULL, NULL, NULL, 0);
+ mod = PyImport_ImportModuleLevel((char *)"bpy", NULL, NULL, NULL, 0);
if (mod) {
PyDict_SetItemString(bpy_pydriver_Dict, "bpy", mod);
Py_DECREF(mod);
}
/* add noise to global namespace */
- mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
+ mod = PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
if (mod) {
- PyObject *modsub= PyDict_GetItemString(PyModule_GetDict(mod), "noise");
+ PyObject *modsub = PyDict_GetItemString(PyModule_GetDict(mod), "noise");
PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub);
Py_DECREF(mod);
}
@@ -93,9 +93,9 @@ int bpy_pydriver_create_dict(void)
}
/* note, this function should do nothing most runs, only when changing frame */
-static PyObject *bpy_pydriver_InternStr__frame= NULL;
+static PyObject *bpy_pydriver_InternStr__frame = NULL;
/* not thread safe but neither is python */
-static float bpy_pydriver_evaltime_prev= FLT_MAX;
+static float bpy_pydriver_evaltime_prev = FLT_MAX;
static void bpy_pydriver_update_dict(const float evaltime)
{
@@ -103,14 +103,14 @@ static void bpy_pydriver_update_dict(const float evaltime)
/* currently only update the frame */
if (bpy_pydriver_InternStr__frame == NULL) {
- bpy_pydriver_InternStr__frame= PyUnicode_FromString("frame");
+ bpy_pydriver_InternStr__frame = PyUnicode_FromString("frame");
}
PyDict_SetItem(bpy_pydriver_Dict,
bpy_pydriver_InternStr__frame,
PyFloat_FromDouble(evaltime));
- bpy_pydriver_evaltime_prev= evaltime;
+ bpy_pydriver_evaltime_prev = evaltime;
}
}
@@ -122,21 +122,21 @@ static void bpy_pydriver_update_dict(const float evaltime)
void BPY_driver_reset(void)
{
PyGILState_STATE gilstate;
- int use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
+ int use_gil = 1; /* !PYC_INTERPRETER_ACTIVE; */
if (use_gil)
- gilstate= PyGILState_Ensure();
+ gilstate = PyGILState_Ensure();
if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
PyDict_Clear(bpy_pydriver_Dict);
Py_DECREF(bpy_pydriver_Dict);
- bpy_pydriver_Dict= NULL;
+ bpy_pydriver_Dict = NULL;
}
if (bpy_pydriver_InternStr__frame) {
Py_DECREF(bpy_pydriver_InternStr__frame);
- bpy_pydriver_InternStr__frame= NULL;
- bpy_pydriver_evaltime_prev= FLT_MAX;
+ bpy_pydriver_InternStr__frame = NULL;
+ bpy_pydriver_evaltime_prev = FLT_MAX;
}
if (use_gil)
@@ -170,22 +170,22 @@ static void pydriver_error(ChannelDriver *driver)
*/
float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
{
- PyObject *driver_vars=NULL;
- PyObject *retval= NULL;
+ PyObject *driver_vars = NULL;
+ PyObject *retval = NULL;
PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */
PyObject *expr_code;
PyGILState_STATE gilstate;
int use_gil;
DriverVar *dvar;
- double result= 0.0; /* default return */
- char *expr= NULL;
- short targets_ok= 1;
+ double result = 0.0; /* default return */
+ char *expr = NULL;
+ short targets_ok = 1;
int i;
/* get the py expression to be evaluated */
- expr= driver->expression;
- if ((expr == NULL) || (expr[0]=='\0'))
+ expr = driver->expression;
+ if ((expr == NULL) || (expr[0] == '\0'))
return 0.0f;
if (!(G.f & G_SCRIPT_AUTOEXEC)) {
@@ -193,10 +193,10 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
return 0.0f;
}
- use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
+ use_gil = 1; /* !PYC_INTERPRETER_ACTIVE; */
if (use_gil)
- gilstate= PyGILState_Ensure();
+ gilstate = PyGILState_Ensure();
/* needed since drivers are updated directly after undo where 'main' is
* re-allocated [#28807] */
@@ -216,51 +216,51 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
bpy_pydriver_update_dict(evaltime);
- if (driver->expr_comp==NULL)
+ if (driver->expr_comp == NULL)
driver->flag |= DRIVER_FLAG_RECOMPILE;
/* compile the expression first if it hasn't been compiled or needs to be rebuilt */
if (driver->flag & DRIVER_FLAG_RECOMPILE) {
Py_XDECREF(driver->expr_comp);
- driver->expr_comp= PyTuple_New(2);
+ driver->expr_comp = PyTuple_New(2);
- expr_code= Py_CompileString(expr, "<bpy driver>", Py_eval_input);
+ expr_code = Py_CompileString(expr, "<bpy driver>", Py_eval_input);
PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 0, expr_code);
driver->flag &= ~DRIVER_FLAG_RECOMPILE;
driver->flag |= DRIVER_FLAG_RENAMEVAR; /* maybe this can be removed but for now best keep until were sure */
}
else {
- expr_code= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 0);
+ expr_code = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 0);
}
if (driver->flag & DRIVER_FLAG_RENAMEVAR) {
/* may not be set */
- expr_vars= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
+ expr_vars = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
Py_XDECREF(expr_vars);
- expr_vars= PyTuple_New(BLI_countlist(&driver->variables));
+ expr_vars = PyTuple_New(BLI_countlist(&driver->variables));
PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 1, expr_vars);
- for (dvar= driver->variables.first, i=0; dvar; dvar= dvar->next) {
+ for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) {
PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name));
}
driver->flag &= ~DRIVER_FLAG_RENAMEVAR;
}
else {
- expr_vars= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
+ expr_vars = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
}
/* add target values to a dict that will be used as '__locals__' dict */
- driver_vars= PyDict_New(); // XXX do we need to decref this?
- for (dvar= driver->variables.first, i=0; dvar; dvar= dvar->next) {
- PyObject *driver_arg= NULL;
- float tval= 0.0f;
+ driver_vars = PyDict_New(); // XXX do we need to decref this?
+ for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) {
+ PyObject *driver_arg = NULL;
+ float tval = 0.0f;
/* try to get variable value */
- tval= driver_get_variable_value(driver, dvar);
- driver_arg= PyFloat_FromDouble((double)tval);
+ tval = driver_get_variable_value(driver, dvar);
+ driver_arg = PyFloat_FromDouble((double)tval);
/* try to add to dictionary */
/* if (PyDict_SetItemString(driver_vars, dvar->name, driver_arg)) { */
@@ -269,7 +269,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
if (targets_ok) {
/* first one - print some extra info for easier identification */
fprintf(stderr, "\nBPY_driver_eval() - Error while evaluating PyDriver:\n");
- targets_ok= 0;
+ targets_ok = 0;
}
fprintf(stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name);
@@ -282,11 +282,11 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
#if 0 // slow, with this can avoid all Py_CompileString above.
/* execute expression to get a value */
- retval= PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
+ retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
#else
/* evaluate the compiled expression */
if (expr_code)
- retval= PyEval_EvalCode((void *)expr_code, bpy_pydriver_Dict, driver_vars);
+ retval = PyEval_EvalCode((void *)expr_code, bpy_pydriver_Dict, driver_vars);
#endif
/* decref the driver vars first... */
@@ -296,10 +296,10 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
if (retval == NULL) {
pydriver_error(driver);
}
- else if ((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) {
+ else if ((result = PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) {
pydriver_error(driver);
Py_DECREF(retval);
- result= 0.0;
+ result = 0.0;
}
else {
/* all fine, make sure the "invalid expression" flag is cleared */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 14d74bcf5d0..7d91438e4f7 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -76,14 +76,14 @@
/* for internal use, when starting and ending python scripts */
/* incase a python script triggers another python call, stop bpy_context_clear from invalidating */
-static int py_call_level= 0;
-BPy_StructRNA *bpy_context_module= NULL; /* for fast access */
+static int py_call_level = 0;
+BPy_StructRNA *bpy_context_module = NULL; /* for fast access */
// #define TIME_PY_RUN // simple python tests. prints on exit.
#ifdef TIME_PY_RUN
#include "PIL_time.h"
-static int bpy_timer_count= 0;
+static int bpy_timer_count = 0;
static double bpy_timer; /* time since python starts */
static double bpy_timer_run; /* time for each python script run */
static double bpy_timer_run_tot; /* accumulate python runs */
@@ -102,18 +102,18 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
py_call_level++;
if (gilstate)
- *gilstate= PyGILState_Ensure();
+ *gilstate = PyGILState_Ensure();
- if (py_call_level==1) {
+ if (py_call_level == 1) {
bpy_context_update(C);
#ifdef TIME_PY_RUN
- if (bpy_timer_count==0) {
+ if (bpy_timer_count == 0) {
/* record time from the beginning */
- bpy_timer= PIL_check_seconds_timer();
- bpy_timer_run= bpy_timer_run_tot= 0.0;
+ bpy_timer = PIL_check_seconds_timer();
+ bpy_timer_run = bpy_timer_run_tot = 0.0;
}
- bpy_timer_run= PIL_check_seconds_timer();
+ bpy_timer_run = PIL_check_seconds_timer();
bpy_timer_count++;
@@ -132,7 +132,7 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
if (py_call_level < 0) {
fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n");
}
- else if (py_call_level==0) {
+ else if (py_call_level == 0) {
/* XXX - Calling classes currently wont store the context :\,
* cant set NULL because of this. but this is very flakey still. */
#if 0
@@ -152,21 +152,21 @@ void BPY_text_free_code(Text *text)
{
if (text->compiled) {
Py_DECREF((PyObject *)text->compiled);
- text->compiled= NULL;
+ text->compiled = NULL;
}
}
void BPY_modules_update(bContext *C)
{
#if 0 // slow, this runs all the time poll, draw etc 100's of time a sec.
- PyObject *mod= PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
+ PyObject *mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
PyModule_AddObject(mod, "data", BPY_rna_module());
PyModule_AddObject(mod, "types", BPY_rna_types()); // atm this does not need updating
#endif
/* refreshes the main struct */
BPY_update_rna_module();
- bpy_context_module->ptr.data= (void *)C;
+ bpy_context_module->ptr.data = (void *)C;
}
void BPY_context_set(bContext *C)
@@ -179,7 +179,7 @@ extern PyObject *AUD_initPython(void);
/* defined in cycles/blender */
extern PyObject *CYCLES_initPython(void);
-static struct _inittab bpy_internal_modules[]= {
+static struct _inittab bpy_internal_modules[] = {
{(char *)"mathutils", PyInit_mathutils},
// {(char *)"mathutils.geometry", PyInit_mathutils_geometry},
// {(char *)"mathutils.noise", PyInit_mathutils_noise},
@@ -189,7 +189,7 @@ static struct _inittab bpy_internal_modules[]= {
{(char *)"aud", AUD_initPython},
#endif
#ifdef WITH_CYCLES
- {(char *)"bcycles", CYCLES_initPython},
+ {(char *)"_cycles", CYCLES_initPython},
#endif
{(char *)"gpu", GPU_initPython},
{NULL, NULL}
@@ -199,7 +199,7 @@ static struct _inittab bpy_internal_modules[]= {
void BPY_python_start(int argc, const char **argv)
{
#ifndef WITH_PYTHON_MODULE
- PyThreadState *py_tstate= NULL;
+ PyThreadState *py_tstate = NULL;
/* not essential but nice to set our name */
static wchar_t program_path_wchar[FILE_MAX]; /* python holds a reference */
@@ -222,7 +222,7 @@ void BPY_python_start(int argc, const char **argv)
/* Python 3.2 now looks for '2.xx/python/include/python3.2d/pyconfig.h' to
* parse from the 'sysconfig' module which is used by 'site',
* so for now disable site. alternatively we could copy the file. */
- Py_NoSiteFlag= 1;
+ Py_NoSiteFlag = 1;
Py_Initialize();
@@ -230,8 +230,8 @@ void BPY_python_start(int argc, const char **argv)
/* sigh, why do python guys not have a char** version anymore? :( */
{
int i;
- PyObject *py_argv= PyList_New(argc);
- for (i=0; i<argc; i++) {
+ PyObject *py_argv = PyList_New(argc);
+ for (i = 0; i < argc; i++) {
/* should fix bug #20021 - utf path name problems, by replacing
* PyUnicode_FromString, with this one */
PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i]));
@@ -263,7 +263,7 @@ void BPY_python_start(int argc, const char **argv)
BPY_atexit_register(); /* this can init any time */
#ifndef WITH_PYTHON_MODULE
- py_tstate= PyGILState_GetThisThreadState();
+ py_tstate = PyGILState_GetThisThreadState();
PyEval_ReleaseThread(py_tstate);
#endif
}
@@ -287,16 +287,16 @@ void BPY_python_end(void)
#ifdef TIME_PY_RUN
// measure time since py started
- bpy_timer= PIL_check_seconds_timer() - bpy_timer;
+ bpy_timer = PIL_check_seconds_timer() - bpy_timer;
printf("*bpy stats* - ");
printf("tot exec: %d, ", bpy_timer_count);
printf("tot run: %.4fsec, ", bpy_timer_run_tot);
- if (bpy_timer_count>0)
+ if (bpy_timer_count > 0)
printf("average run: %.6fsec, ", (bpy_timer_run_tot/bpy_timer_count));
- if (bpy_timer>0.0)
- printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer)*100.0);
+ if (bpy_timer > 0.0)
+ printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer) * 100.0);
printf("\n");
@@ -310,7 +310,7 @@ static void python_script_error_jump_text(struct Text *text)
{
int lineno;
int offset;
- python_script_error_jump(text->id.name+2, &lineno, &offset);
+ python_script_error_jump(text->id.name + 2, &lineno, &offset);
if (lineno != -1) {
/* select the line with the error */
txt_move_to(text, lineno - 1, INT_MAX, FALSE);
@@ -334,13 +334,13 @@ typedef struct {
static int python_script_exec(bContext *C, const char *fn, struct Text *text,
struct ReportList *reports, const short do_jump)
{
- PyObject *main_mod= NULL;
- PyObject *py_dict= NULL, *py_result= NULL;
+ PyObject *main_mod = NULL;
+ PyObject *py_dict = NULL, *py_result = NULL;
PyGILState_STATE gilstate;
BLI_assert(fn || text);
- if (fn==NULL && text==NULL) {
+ if (fn == NULL && text == NULL) {
return 0;
}
@@ -353,9 +353,9 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
if (text->compiled == NULL) { /* if it wasn't already compiled, do it now */
- char *buf= txt_to_buf(text);
+ char *buf = txt_to_buf(text);
- text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
+ text->compiled = Py_CompileString(buf, fn_dummy, Py_file_input);
MEM_freeN(buf);
@@ -368,16 +368,16 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
}
if (text->compiled) {
- py_dict= PyC_DefaultNameSpace(fn_dummy);
- py_result= PyEval_EvalCode(text->compiled, py_dict, py_dict);
+ py_dict = PyC_DefaultNameSpace(fn_dummy);
+ py_result = PyEval_EvalCode(text->compiled, py_dict, py_dict);
}
}
else {
- FILE *fp= fopen(fn, "r");
+ FILE *fp = fopen(fn, "r");
if (fp) {
- py_dict= PyC_DefaultNameSpace(fn);
+ py_dict = PyC_DefaultNameSpace(fn);
#ifdef _WIN32
/* Previously we used PyRun_File to run directly the code on a FILE
@@ -390,14 +390,14 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
fclose(fp);
- pystring= MEM_mallocN(strlen(fn) + 32, "pystring");
- pystring[0]= '\0';
+ pystring = MEM_mallocN(strlen(fn) + 32, "pystring");
+ pystring[0] = '\0';
sprintf(pystring, "exec(open(r'%s').read())", fn);
- py_result= PyRun_String(pystring, Py_file_input, py_dict, py_dict);
+ py_result = PyRun_String(pystring, Py_file_input, py_dict, py_dict);
MEM_freeN(pystring);
}
#else
- py_result= PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);
+ py_result = PyRun_File(fp, fn, Py_file_input, py_dict, py_dict);
fclose(fp);
#endif
}
@@ -405,7 +405,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
PyErr_Format(PyExc_IOError,
"Python file \"%s\" could not be opened: %s",
fn, strerror(errno));
- py_result= NULL;
+ py_result = NULL;
}
}
@@ -423,11 +423,11 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
if (py_dict) {
#ifdef PYMODULE_CLEAR_WORKAROUND
- PyModuleObject *mmod= (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
- PyObject *dict_back= mmod->md_dict;
+ PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
+ PyObject *dict_back = mmod->md_dict;
/* freeing the module will clear the namespace,
* gives problems running classes defined in this namespace being used later. */
- mmod->md_dict= NULL;
+ mmod->md_dict = NULL;
Py_DECREF(dict_back);
#endif
@@ -455,7 +455,7 @@ int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports, co
void BPY_DECREF(void *pyob_ptr)
{
- PyGILState_STATE gilstate= PyGILState_Ensure();
+ PyGILState_STATE gilstate = PyGILState_Ensure();
Py_DECREF((PyObject *)pyob_ptr);
PyGILState_Release(gilstate);
}
@@ -465,13 +465,13 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
{
PyGILState_STATE gilstate;
PyObject *py_dict, *mod, *retval;
- int error_ret= 0;
- PyObject *main_mod= NULL;
+ int error_ret = 0;
+ PyObject *main_mod = NULL;
if (!value || !expr) return -1;
- if (expr[0]=='\0') {
- *value= 0.0;
+ if (expr[0] == '\0') {
+ *value = 0.0;
return error_ret;
}
@@ -479,9 +479,9 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
PyC_MainModule_Backup(&main_mod);
- py_dict= PyC_DefaultNameSpace("<blender button>");
+ py_dict = PyC_DefaultNameSpace("<blender button>");
- mod= PyImport_ImportModule("math");
+ mod = PyImport_ImportModule("math");
if (mod) {
PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
Py_DECREF(mod);
@@ -491,10 +491,10 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
PyErr_Clear();
}
- retval= PyRun_String(expr, Py_eval_input, py_dict, py_dict);
+ retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
if (retval == NULL) {
- error_ret= -1;
+ error_ret = -1;
}
else {
double val;
@@ -503,25 +503,25 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
/* Users my have typed in 10km, 2m
* add up all values */
int i;
- val= 0.0;
+ val = 0.0;
- for (i=0; i<PyTuple_GET_SIZE(retval); i++) {
- val+= PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i));
+ for (i = 0; i < PyTuple_GET_SIZE(retval); i++) {
+ val += PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i));
}
}
else {
- val= PyFloat_AsDouble(retval);
+ val = PyFloat_AsDouble(retval);
}
Py_DECREF(retval);
- if (val==-1 && PyErr_Occurred()) {
- error_ret= -1;
+ if (val == -1 && PyErr_Occurred()) {
+ error_ret = -1;
}
else if (!finite(val)) {
- *value= 0.0;
+ *value = 0.0;
}
else {
- *value= val;
+ *value = val;
}
}
@@ -544,14 +544,14 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
int BPY_string_exec(bContext *C, const char *expr)
{
PyGILState_STATE gilstate;
- PyObject *main_mod= NULL;
+ PyObject *main_mod = NULL;
PyObject *py_dict, *retval;
- int error_ret= 0;
+ int error_ret = 0;
Main *bmain_back; /* XXX, quick fix for release (Copy Settings crash), needs further investigation */
if (!expr) return -1;
- if (expr[0]=='\0') {
+ if (expr[0] == '\0') {
return error_ret;
}
@@ -559,17 +559,17 @@ int BPY_string_exec(bContext *C, const char *expr)
PyC_MainModule_Backup(&main_mod);
- py_dict= PyC_DefaultNameSpace("<blender string>");
+ py_dict = PyC_DefaultNameSpace("<blender string>");
- bmain_back= bpy_import_main_get();
+ bmain_back = bpy_import_main_get();
bpy_import_main_set(CTX_data_main(C));
- retval= PyRun_String(expr, Py_eval_input, py_dict, py_dict);
+ retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
bpy_import_main_set(bmain_back);
if (retval == NULL) {
- error_ret= -1;
+ error_ret = -1;
BPy_errors_to_report(CTX_wm_reports(C));
}
@@ -588,11 +588,11 @@ int BPY_string_exec(bContext *C, const char *expr)
void BPY_modules_load_user(bContext *C)
{
PyGILState_STATE gilstate;
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Text *text;
/* can happen on file load */
- if (bmain==NULL)
+ if (bmain == NULL)
return;
/* update pointers since this can run from a nested script
@@ -603,15 +603,15 @@ void BPY_modules_load_user(bContext *C)
bpy_context_set(C, &gilstate);
- for (text=CTX_data_main(C)->text.first; text; text= text->id.next) {
- if (text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name+2, ".py")) {
+ for (text = CTX_data_main(C)->text.first; text; text = text->id.next) {
+ if (text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name + 2, ".py")) {
if (!(G.f & G_SCRIPT_AUTOEXEC)) {
- printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name+2);
+ printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name + 2);
}
else {
- PyObject *module= bpy_text_import(text);
+ PyObject *module = bpy_text_import(text);
- if (module==NULL) {
+ if (module == NULL) {
PyErr_Print();
PyErr_Clear();
}
@@ -626,43 +626,43 @@ void BPY_modules_load_user(bContext *C)
int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *result)
{
- PyObject *pyctx= (PyObject *)CTX_py_dict_get(C);
- PyObject *item= PyDict_GetItemString(pyctx, member);
- PointerRNA *ptr= NULL;
- int done= 0;
+ PyObject *pyctx = (PyObject *)CTX_py_dict_get(C);
+ PyObject *item = PyDict_GetItemString(pyctx, member);
+ PointerRNA *ptr = NULL;
+ int done = 0;
- if (item==NULL) {
+ if (item == NULL) {
/* pass */
}
- else if (item==Py_None) {
+ else if (item == Py_None) {
/* pass */
}
else if (BPy_StructRNA_Check(item)) {
- ptr= &(((BPy_StructRNA *)item)->ptr);
+ ptr = &(((BPy_StructRNA *)item)->ptr);
- //result->ptr= ((BPy_StructRNA *)item)->ptr;
+ //result->ptr = ((BPy_StructRNA *)item)->ptr;
CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
- done= 1;
+ done = 1;
}
else if (PySequence_Check(item)) {
- PyObject *seq_fast= PySequence_Fast(item, "bpy_context_get sequence conversion");
- if (seq_fast==NULL) {
+ PyObject *seq_fast = PySequence_Fast(item, "bpy_context_get sequence conversion");
+ if (seq_fast == NULL) {
PyErr_Print();
PyErr_Clear();
}
else {
- int len= PySequence_Fast_GET_SIZE(seq_fast);
+ int len = PySequence_Fast_GET_SIZE(seq_fast);
int i;
- for (i= 0; i < len; i++) {
- PyObject *list_item= PySequence_Fast_GET_ITEM(seq_fast, i);
+ for (i = 0; i < len; i++) {
+ PyObject *list_item = PySequence_Fast_GET_ITEM(seq_fast, i);
if (BPy_StructRNA_Check(list_item)) {
/*
- CollectionPointerLink *link= MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get");
- link->ptr= ((BPy_StructRNA *)item)->ptr;
+ CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get");
+ link->ptr = ((BPy_StructRNA *)item)->ptr;
BLI_addtail(&result->list, link);
*/
- ptr= &(((BPy_StructRNA *)list_item)->ptr);
+ ptr = &(((BPy_StructRNA *)list_item)->ptr);
CTX_data_list_add(result, ptr->id.data, ptr->type, ptr->data);
}
else {
@@ -672,11 +672,11 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
}
Py_DECREF(seq_fast);
- done= 1;
+ done = 1;
}
}
- if (done==0) {
+ if (done == 0) {
if (item) printf("PyContext '%s' not a valid type\n", member);
else printf("PyContext '%s' not found\n", member);
}
@@ -697,7 +697,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
static void bpy_module_free(void *mod);
extern int main_python_enter(int argc, const char **argv);
extern void main_python_exit(void);
-static struct PyModuleDef bpy_proxy_def= {
+static struct PyModuleDef bpy_proxy_def = {
PyModuleDef_HEAD_INIT,
"bpy", /* m_name */
NULL, /* m_doc */
@@ -718,20 +718,20 @@ typedef struct {
/* call once __file__ is set */
void bpy_module_delay_init(PyObject *bpy_proxy)
{
- const int argc= 1;
+ const int argc = 1;
const char *argv[2];
/* updating the module dict below will loose the reference to __file__ */
- PyObject *filename_obj= PyModule_GetFilenameObject(bpy_proxy);
+ PyObject *filename_obj = PyModule_GetFilenameObject(bpy_proxy);
- const char *filename_rel= _PyUnicode_AsString(filename_obj); /* can be relative */
+ const char *filename_rel = _PyUnicode_AsString(filename_obj); /* can be relative */
char filename_abs[1024];
BLI_strncpy(filename_abs, filename_rel, sizeof(filename_abs));
BLI_path_cwd(filename_abs);
- argv[0]= filename_abs;
- argv[1]= NULL;
+ argv[0] = filename_abs;
+ argv[1] = NULL;
// printf("module found %s\n", argv[0]);
@@ -743,7 +743,7 @@ void bpy_module_delay_init(PyObject *bpy_proxy)
static void dealloc_obj_dealloc(PyObject *self);
-static PyTypeObject dealloc_obj_Type= {{{0}}};
+static PyTypeObject dealloc_obj_Type = {{{0}}};
/* use our own dealloc so we can free a property if we use one */
static void dealloc_obj_dealloc(PyObject *self)
@@ -757,7 +757,7 @@ static void dealloc_obj_dealloc(PyObject *self)
PyMODINIT_FUNC
PyInit_bpy(void)
{
- PyObject *bpy_proxy= PyModule_Create(&bpy_proxy_def);
+ PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def);
/* Problem:
* 1) this init function is expected to have a private member defined - 'md_def'
@@ -777,16 +777,16 @@ PyInit_bpy(void)
dealloc_obj *dob;
/* assign dummy type */
- dealloc_obj_Type.tp_name= "dealloc_obj";
- dealloc_obj_Type.tp_basicsize= sizeof(dealloc_obj);
- dealloc_obj_Type.tp_dealloc= dealloc_obj_dealloc;
- dealloc_obj_Type.tp_flags= Py_TPFLAGS_DEFAULT;
+ dealloc_obj_Type.tp_name = "dealloc_obj";
+ dealloc_obj_Type.tp_basicsize = sizeof(dealloc_obj);
+ dealloc_obj_Type.tp_dealloc = dealloc_obj_dealloc;
+ dealloc_obj_Type.tp_flags = Py_TPFLAGS_DEFAULT;
if (PyType_Ready(&dealloc_obj_Type) < 0)
return NULL;
- dob= (dealloc_obj *) dealloc_obj_Type.tp_alloc(&dealloc_obj_Type, 0);
- dob->mod= bpy_proxy; /* borrow */
+ dob = (dealloc_obj *) dealloc_obj_Type.tp_alloc(&dealloc_obj_Type, 0);
+ dob->mod = bpy_proxy; /* borrow */
PyModule_AddObject(bpy_proxy, "__file__", (PyObject *)dob); /* borrow */
return bpy_proxy;
diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c
index a0cf3c38503..53775e7d893 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -40,15 +40,15 @@
static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject *UNUSED(args), PyObject *UNUSED(kw))
{
/* close down enough of blender at least not to crash */
- struct bContext *C= BPy_GetContext();
+ struct bContext *C = BPy_GetContext();
WM_exit_ext(C, 0);
Py_RETURN_NONE;
}
-static PyMethodDef meth_bpy_atexit= {"bpy_atexit", (PyCFunction)bpy_atexit, METH_NOARGS, NULL};
-static PyObject *func_bpy_atregister= NULL; /* borrowed referebce, atexit holds */
+static PyMethodDef meth_bpy_atexit = {"bpy_atexit", (PyCFunction)bpy_atexit, METH_NOARGS, NULL};
+static PyObject *func_bpy_atregister = NULL; /* borrowed referebce, atexit holds */
static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
{
@@ -56,15 +56,15 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
* this is intended, but if its problematic it could be changed
* - campbell */
- PyObject *atexit_mod= PyImport_ImportModuleLevel((char *)"atexit", NULL, NULL, NULL, 0);
- PyObject *atexit_func= PyObject_GetAttrString(atexit_mod, func_name);
- PyObject *args= PyTuple_New(1);
+ PyObject *atexit_mod = PyImport_ImportModuleLevel((char *)"atexit", NULL, NULL, NULL, 0);
+ PyObject *atexit_func = PyObject_GetAttrString(atexit_mod, func_name);
+ PyObject *args = PyTuple_New(1);
PyObject *ret;
PyTuple_SET_ITEM(args, 0, atexit_func_arg);
Py_INCREF(atexit_func_arg); /* only incref so we dont dec'ref along with 'args' */
- ret= PyObject_CallObject(atexit_func, args);
+ ret = PyObject_CallObject(atexit_func, args);
Py_DECREF(atexit_mod);
Py_DECREF(atexit_func);
@@ -83,7 +83,7 @@ void BPY_atexit_register(void)
/* atexit module owns this new function reference */
BLI_assert(func_bpy_atregister == NULL);
- func_bpy_atregister= (PyObject *)PyCFunction_New(&meth_bpy_atexit, NULL);
+ func_bpy_atregister = (PyObject *)PyCFunction_New(&meth_bpy_atexit, NULL);
atexit_func_call("register", func_bpy_atregister);
}
@@ -92,5 +92,5 @@ void BPY_atexit_unregister(void)
BLI_assert(func_bpy_atregister != NULL);
atexit_func_call("unregister", func_bpy_atregister);
- func_bpy_atregister= NULL; /* don't really need to set but just incase */
+ func_bpy_atregister = NULL; /* don't really need to set but just incase */
}
diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c
index 4f206c4c365..7c8291d62d3 100644
--- a/source/blender/python/intern/bpy_intern_string.c
+++ b/source/blender/python/intern/bpy_intern_string.c
@@ -41,12 +41,12 @@ PyObject *bpy_intern_str___slots__;
void bpy_intern_string_init(void)
{
- bpy_intern_str_register= PyUnicode_FromString("register");
- bpy_intern_str_unregister= PyUnicode_FromString("unregister");
- bpy_intern_str_bl_rna= PyUnicode_FromString("bl_rna");
- bpy_intern_str_order= PyUnicode_FromString("order");
- bpy_intern_str_attr= PyUnicode_FromString("attr");
- bpy_intern_str___slots__= PyUnicode_FromString("__slots__");
+ bpy_intern_str_register = PyUnicode_FromString("register");
+ bpy_intern_str_unregister = PyUnicode_FromString("unregister");
+ bpy_intern_str_bl_rna = PyUnicode_FromString("bl_rna");
+ bpy_intern_str_order = PyUnicode_FromString("order");
+ bpy_intern_str_attr = PyUnicode_FromString("attr");
+ bpy_intern_str___slots__ = PyUnicode_FromString("__slots__");
}
void bpy_intern_string_exit(void)
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index a6426a02e18..ed3b758a6b4 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -76,7 +76,7 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *args);
static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *args);
static PyObject *bpy_lib_dir(BPy_Library *self);
-static PyMethodDef bpy_lib_methods[]= {
+static PyMethodDef bpy_lib_methods[] = {
{"__enter__", (PyCFunction)bpy_lib_enter, METH_NOARGS},
{"__exit__", (PyCFunction)bpy_lib_exit, METH_VARARGS},
{"__dir__", (PyCFunction)bpy_lib_dir, METH_NOARGS},
@@ -90,7 +90,7 @@ static void bpy_lib_dealloc(BPy_Library *self)
}
-static PyTypeObject bpy_lib_Type= {
+static PyTypeObject bpy_lib_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_lib", /* tp_name */
sizeof(BPy_Library), /* tp_basicsize */
@@ -184,25 +184,25 @@ PyDoc_STRVAR(bpy_lib_load_doc,
);
static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
{
- static const char *kwlist[]= {"filepath", "link", "relative", NULL};
+ static const char *kwlist[] = {"filepath", "link", "relative", NULL};
BPy_Library *ret;
- const char* filename= NULL;
- int is_rel= 0, is_link= 0;
+ const char* filename = NULL;
+ int is_rel = 0, is_link = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ii:load", (char **)kwlist, &filename, &is_link, &is_rel))
return NULL;
- ret= PyObject_New(BPy_Library, &bpy_lib_Type);
+ ret = PyObject_New(BPy_Library, &bpy_lib_Type);
BLI_strncpy(ret->relpath, filename, sizeof(ret->relpath));
BLI_strncpy(ret->abspath, filename, sizeof(ret->abspath));
BLI_path_abs(ret->abspath, G.main->name);
- ret->blo_handle= NULL;
+ ret->blo_handle = NULL;
ret->flag= (is_link ? FILE_LINK : 0) |
(is_rel ? FILE_RELPATH : 0);
- ret->dict= PyDict_New();
+ ret->dict = PyDict_New();
return (PyObject *)ret;
}
@@ -213,19 +213,19 @@ static PyObject *_bpy_names(BPy_Library *self, int blocktype)
LinkNode *l, *names;
int totnames;
- names= BLO_blendhandle_get_datablock_names(self->blo_handle, blocktype, &totnames);
+ names = BLO_blendhandle_get_datablock_names(self->blo_handle, blocktype, &totnames);
if (names) {
- int counter= 0;
- list= PyList_New(totnames);
- for (l= names; l; l= l->next) {
+ int counter = 0;
+ list = PyList_New(totnames);
+ for (l = names; l; l = l->next) {
PyList_SET_ITEM(list, counter, PyUnicode_FromString((char *)l->link));
counter++;
}
BLI_linklist_free(names, free); /* free linklist *and* each node's data */
}
else {
- list= PyList_New(0);
+ list = PyList_New(0);
}
return list;
@@ -235,12 +235,12 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
{
PyObject *ret;
BPy_Library *self_from;
- PyObject *from_dict= PyDict_New();
+ PyObject *from_dict = PyDict_New();
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- self->blo_handle= BLO_blendhandle_from_file(self->abspath, &reports);
+ self->blo_handle = BLO_blendhandle_from_file(self->abspath, &reports);
if (self->blo_handle == NULL) {
if (BPy_reports_to_error(&reports, PyExc_IOError, TRUE) != -1) {
@@ -251,11 +251,11 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
return NULL;
}
else {
- int i= 0, code;
- while ((code= BKE_idcode_iter_step(&i))) {
+ int i = 0, code;
+ while ((code = BKE_idcode_iter_step(&i))) {
if (BKE_idcode_is_linkable(code)) {
- const char *name_plural= BKE_idcode_to_name_plural(code);
- PyObject *str= PyUnicode_FromString(name_plural);
+ const char *name_plural = BKE_idcode_to_name_plural(code);
+ PyObject *str = PyUnicode_FromString(name_plural);
PyDict_SetItem(self->dict, str, PyList_New(0));
PyDict_SetItem(from_dict, str, _bpy_names(self, code));
Py_DECREF(str);
@@ -264,16 +264,16 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
}
/* create a dummy */
- self_from= PyObject_New(BPy_Library, &bpy_lib_Type);
+ self_from = PyObject_New(BPy_Library, &bpy_lib_Type);
BLI_strncpy(self_from->relpath, self->relpath, sizeof(self_from->relpath));
BLI_strncpy(self_from->abspath, self->abspath, sizeof(self_from->abspath));
- self_from->blo_handle= NULL;
- self_from->flag= 0;
- self_from->dict= from_dict; /* owns the dict */
+ self_from->blo_handle = NULL;
+ self_from->flag = 0;
+ self_from->dict = from_dict; /* owns the dict */
/* return pair */
- ret= PyTuple_New(2);
+ ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, (PyObject *)self_from);
@@ -317,43 +317,43 @@ static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item)
static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
{
- Main *bmain= CTX_data_main(BPy_GetContext());
- Main *mainl= NULL;
- int err= 0;
+ Main *bmain = CTX_data_main(BPy_GetContext());
+ Main *mainl = NULL;
+ int err = 0;
flag_all_listbases_ids(LIB_PRE_EXISTING, 1);
/* here appending/linking starts */
- mainl= BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath);
+ mainl = BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath);
{
- int i= 0, code;
- while ((code= BKE_idcode_iter_step(&i))) {
+ int i = 0, code;
+ while ((code = BKE_idcode_iter_step(&i))) {
if (BKE_idcode_is_linkable(code)) {
- const char *name_plural= BKE_idcode_to_name_plural(code);
- PyObject *ls= PyDict_GetItemString(self->dict, name_plural);
+ const char *name_plural = BKE_idcode_to_name_plural(code);
+ PyObject *ls = PyDict_GetItemString(self->dict, name_plural);
// printf("lib: %s\n", name_plural);
if (ls && PyList_Check(ls)) {
/* loop */
- Py_ssize_t size= PyList_GET_SIZE(ls);
+ Py_ssize_t size = PyList_GET_SIZE(ls);
Py_ssize_t i;
PyObject *item;
const char *item_str;
- for (i= 0; i < size; i++) {
- item= PyList_GET_ITEM(ls, i);
- item_str= _PyUnicode_AsString(item);
+ for (i = 0; i < size; i++) {
+ item = PyList_GET_ITEM(ls, i);
+ item_str = _PyUnicode_AsString(item);
// printf(" %s\n", item_str);
if (item_str) {
- ID *id= BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code);
+ ID *id = BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code);
if (id) {
#ifdef USE_RNA_DATABLOCKS
PointerRNA id_ptr;
RNA_id_pointer_create(id, &id_ptr);
Py_DECREF(item);
- item= pyrna_struct_CreatePyObject(&id_ptr);
+ item = pyrna_struct_CreatePyObject(&id_ptr);
#endif
}
else {
@@ -361,7 +361,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
/* just warn for now */
/* err = -1; */
#ifdef USE_RNA_DATABLOCKS
- item= Py_None;
+ item = Py_None;
Py_INCREF(item);
#endif
}
@@ -374,7 +374,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
PyErr_Clear();
#ifdef USE_RNA_DATABLOCKS
- item= Py_None;
+ item = Py_None;
Py_INCREF(item);
#endif
}
@@ -391,22 +391,22 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
if (err == -1) {
/* exception raised above, XXX, this leaks some memory */
BLO_blendhandle_close(self->blo_handle);
- self->blo_handle= NULL;
+ self->blo_handle = NULL;
flag_all_listbases_ids(LIB_PRE_EXISTING, 0);
return NULL;
}
else {
- Library *lib= mainl->curlib; /* newly added lib, assign before append end */
+ Library *lib = mainl->curlib; /* newly added lib, assign before append end */
BLO_library_append_end(NULL, mainl, &(self->blo_handle), 0, self->flag);
BLO_blendhandle_close(self->blo_handle);
- self->blo_handle= NULL;
+ self->blo_handle = NULL;
{ /* copied from wm_operator.c */
/* mark all library linked objects to be updated */
recalc_all_library_objects(G.main);
/* append, rather than linking */
- if ((self->flag & FILE_LINK)==0) {
+ if ((self->flag & FILE_LINK) == 0) {
BKE_library_make_local(bmain, lib, 1);
}
}
@@ -425,14 +425,14 @@ static PyObject *bpy_lib_dir(BPy_Library *self)
int bpy_lib_init(PyObject *mod_par)
{
- static PyMethodDef load_meth= {"load", (PyCFunction)bpy_lib_load,
+ static PyMethodDef load_meth = {"load", (PyCFunction)bpy_lib_load,
METH_STATIC|METH_VARARGS|METH_KEYWORDS,
bpy_lib_load_doc};
PyModule_AddObject(mod_par, "_library_load", PyCFunction_New(&load_meth, NULL));
/* some compilers dont like accessing this directly, delay assignment */
- bpy_lib_Type.tp_getattro= PyObject_GenericGetAttr;
+ bpy_lib_Type.tp_getattro = PyObject_GenericGetAttr;
if (PyType_Ready(&bpy_lib_Type) < 0)
return -1;
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 70346a65bf9..6a6e6595ed4 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -66,18 +66,18 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
char *opname;
- PyObject *context_dict= NULL; /* optional args */
+ PyObject *context_dict = NULL; /* optional args */
PyObject *context_dict_back;
- char *context_str= NULL;
+ char *context_str = NULL;
PyObject *ret;
- int context= WM_OP_EXEC_DEFAULT;
+ int context = WM_OP_EXEC_DEFAULT;
/* XXX Todo, work out a better solution for passing on context,
* could make a tuple from self and pack the name and Context into it... */
- bContext *C= (bContext *)BPy_GetContext();
+ bContext *C = (bContext *)BPy_GetContext();
- if (C==NULL) {
+ if (C == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL;
}
@@ -85,7 +85,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "s|Os:_bpy.ops.poll", &opname, &context_dict, &context_str))
return NULL;
- ot= WM_operatortype_find(opname, TRUE);
+ ot = WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format(PyExc_AttributeError,
@@ -95,8 +95,8 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
}
if (context_str) {
- if (RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) {
- char *enum_str= BPy_enum_as_string(operator_context_items);
+ if (RNA_enum_value_from_id(operator_context_items, context_str, &context) == 0) {
+ char *enum_str = BPy_enum_as_string(operator_context_items);
PyErr_Format(PyExc_TypeError,
"Calling operator \"bpy.ops.%s.poll\" error, "
"expected a string enum in (%.200s)",
@@ -106,8 +106,8 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
}
}
- if (context_dict==NULL || context_dict==Py_None) {
- context_dict= NULL;
+ if (context_dict == NULL || context_dict == Py_None) {
+ context_dict = NULL;
}
else if (!PyDict_Check(context_dict)) {
PyErr_Format(PyExc_TypeError,
@@ -117,12 +117,12 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- context_dict_back= CTX_py_dict_get(C);
+ context_dict_back = CTX_py_dict_get(C);
CTX_py_dict_set(C, (void *)context_dict);
Py_XINCREF(context_dict); /* so we done loose it */
/* main purpose of thsi function */
- ret= WM_operator_poll_context((bContext*)C, ot, context) ? Py_True : Py_False;
+ ret = WM_operator_poll_context((bContext *)C, ot, context) ? Py_True : Py_False;
/* restore with original context dict, probably NULL but need this for nested operator calls */
Py_XDECREF(context_dict);
@@ -135,24 +135,24 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
- int error_val= 0;
+ int error_val = 0;
PointerRNA ptr;
- int operator_ret= OPERATOR_CANCELLED;
+ int operator_ret = OPERATOR_CANCELLED;
char *opname;
- char *context_str= NULL;
- PyObject *kw= NULL; /* optional args */
- PyObject *context_dict= NULL; /* optional args */
+ char *context_str = NULL;
+ PyObject *kw = NULL; /* optional args */
+ PyObject *context_dict = NULL; /* optional args */
PyObject *context_dict_back;
/* note that context is an int, python does the conversion in this case */
- int context= WM_OP_EXEC_DEFAULT;
+ int context = WM_OP_EXEC_DEFAULT;
/* XXX Todo, work out a better solution for passing on context,
* could make a tuple from self and pack the name and Context into it... */
- bContext *C= (bContext *)BPy_GetContext();
+ bContext *C = (bContext *)BPy_GetContext();
- if (C==NULL) {
+ if (C == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL;
}
@@ -160,7 +160,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "sO|O!s:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context_str))
return NULL;
- ot= WM_operatortype_find(opname, TRUE);
+ ot = WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format(PyExc_AttributeError,
@@ -178,8 +178,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
}
if (context_str) {
- if (RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) {
- char *enum_str= BPy_enum_as_string(operator_context_items);
+ if (RNA_enum_value_from_id(operator_context_items, context_str, &context) == 0) {
+ char *enum_str = BPy_enum_as_string(operator_context_items);
PyErr_Format(PyExc_TypeError,
"Calling operator \"bpy.ops.%s\" error, "
"expected a string enum in (%.200s)",
@@ -189,8 +189,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
}
}
- if (context_dict==NULL || context_dict==Py_None) {
- context_dict= NULL;
+ if (context_dict == NULL || context_dict == Py_None) {
+ context_dict = NULL;
}
else if (!PyDict_Check(context_dict)) {
PyErr_Format(PyExc_TypeError,
@@ -200,31 +200,31 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- context_dict_back= CTX_py_dict_get(C);
+ context_dict_back = CTX_py_dict_get(C);
CTX_py_dict_set(C, (void *)context_dict);
Py_XINCREF(context_dict); /* so we done loose it */
- if (WM_operator_poll_context((bContext*)C, ot, context) == FALSE) {
- const char *msg= CTX_wm_operator_poll_msg_get(C);
+ if (WM_operator_poll_context((bContext *)C, ot, context) == FALSE) {
+ const char *msg = CTX_wm_operator_poll_msg_get(C);
PyErr_Format(PyExc_RuntimeError,
"Operator bpy.ops.%.200s.poll() %.200s",
opname, msg ? msg : "failed, context is incorrect");
CTX_wm_operator_poll_msg_set(C, NULL); /* better set to NULL else it could be used again */
- error_val= -1;
+ error_val = -1;
}
else {
WM_operator_properties_create_ptr(&ptr, ot);
WM_operator_properties_sanitize(&ptr, 0);
if (kw && PyDict_Size(kw))
- error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
+ error_val = pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
- if (error_val==0) {
+ if (error_val == 0) {
ReportList *reports;
- reports= MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
+ reports = MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these dont move into global reports */
#ifdef BPY_RELEASE_GIL
@@ -233,10 +233,10 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
/* note: I havve not seen any examples of code that does this
* so it may not be officially supported but seems to work ok. */
{
- PyThreadState *ts= PyEval_SaveThread();
+ PyThreadState *ts = PyEval_SaveThread();
#endif
- operator_ret= WM_operator_call_py(C, ot, context, &ptr, reports);
+ operator_ret = WM_operator_call_py(C, ot, context, &ptr, reports);
#ifdef BPY_RELEASE_GIL
/* regain GIL */
@@ -244,11 +244,11 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
}
#endif
- error_val= BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE);
+ error_val = BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE);
/* operator output is nice to have in the terminal/console too */
if (reports->list.first) {
- char *report_str= BKE_reports_string(reports, 0); /* all reports */
+ char *report_str = BKE_reports_string(reports, 0); /* all reports */
if (report_str) {
PySys_WriteStdout("%s\n", report_str);
@@ -285,7 +285,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
Py_XDECREF(context_dict);
CTX_py_dict_set(C, (void *)context_dict_back);
- if (error_val==-1) {
+ if (error_val == -1) {
return NULL;
}
@@ -308,16 +308,16 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
PointerRNA ptr;
char *opname;
- PyObject *kw= NULL; /* optional args */
- int all_args= 1;
- int error_val= 0;
+ PyObject *kw = NULL; /* optional args */
+ int all_args = 1;
+ int error_val = 0;
- char *buf= NULL;
+ char *buf = NULL;
PyObject *pybuf;
- bContext *C= (bContext *)BPy_GetContext();
+ bContext *C = (bContext *)BPy_GetContext();
- if (C==NULL) {
+ if (C == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant get the string representation of this object.");
return NULL;
}
@@ -325,7 +325,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "s|O!i:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args))
return NULL;
- ot= WM_operatortype_find(opname, TRUE);
+ ot = WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format(PyExc_AttributeError,
@@ -339,23 +339,23 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
if (kw && PyDict_Size(kw))
- error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
+ error_val = pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
- if (error_val==0)
- buf= WM_operator_pystring(C, ot, &ptr, all_args);
+ if (error_val == 0)
+ buf = WM_operator_pystring(C, ot, &ptr, all_args);
WM_operator_properties_free(&ptr);
- if (error_val==-1) {
+ if (error_val == -1) {
return NULL;
}
if (buf) {
- pybuf= PyUnicode_FromString(buf);
+ pybuf = PyUnicode_FromString(buf);
MEM_freeN(buf);
}
else {
- pybuf= PyUnicode_FromString("");
+ pybuf = PyUnicode_FromString("");
}
return pybuf;
@@ -363,13 +363,13 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
static PyObject *pyop_dir(PyObject *UNUSED(self))
{
- GHashIterator *iter= WM_operatortype_iter();
- PyObject *list= PyList_New(0), *name;
+ GHashIterator *iter = WM_operatortype_iter();
+ PyObject *list = PyList_New(0), *name;
for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
- wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
+ wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
- name= PyUnicode_FromString(ot->idname);
+ name = PyUnicode_FromString(ot->idname);
PyList_Append(list, name);
Py_DECREF(name);
}
@@ -382,15 +382,15 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
{
wmOperatorType *ot;
PointerRNA ptr;
- const char *opname= _PyUnicode_AsString(value);
- BPy_StructRNA *pyrna= NULL;
+ const char *opname = _PyUnicode_AsString(value);
+ BPy_StructRNA *pyrna = NULL;
- if (opname==NULL) {
+ if (opname == NULL) {
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
return NULL;
}
- ot= WM_operatortype_find(opname, TRUE);
- if (ot==NULL) {
+ ot = WM_operatortype_find(opname, TRUE);
+ if (ot == NULL) {
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
return NULL;
}
@@ -403,9 +403,9 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
WM_operator_properties_sanitize(&ptr, 0);
- pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
+ pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
#ifdef PYRNA_FREE_SUPPORT
- pyrna->freeptr= TRUE;
+ pyrna->freeptr = TRUE;
#endif
return (PyObject *)pyrna;
}
@@ -415,40 +415,40 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
wmOperatorType *ot;
wmOperator *op;
PointerRNA ptr;
- const char *opname= _PyUnicode_AsString(value);
- BPy_StructRNA *pyrna= NULL;
+ const char *opname = _PyUnicode_AsString(value);
+ BPy_StructRNA *pyrna = NULL;
- if (opname==NULL) {
+ if (opname == NULL) {
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_instance() expects a string argument");
return NULL;
}
- ot= WM_operatortype_find(opname, TRUE);
- if (ot==NULL) {
+ ot = WM_operatortype_find(opname, TRUE);
+ if (ot == NULL) {
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname);
return NULL;
}
#ifdef PYRNA_FREE_SUPPORT
- op= MEM_callocN(sizeof(wmOperator), __func__);
+ op = MEM_callocN(sizeof(wmOperator), __func__);
#else
- op= PyMem_MALLOC(sizeof(wmOperator));
+ op = PyMem_MALLOC(sizeof(wmOperator));
memset(op, 0, sizeof(wmOperator));
#endif
BLI_strncpy(op->idname, op->idname, sizeof(op->idname)); /* incase its needed */
- op->type= ot;
+ op->type = ot;
RNA_pointer_create(NULL, &RNA_Operator, op, &ptr);
- pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
+ pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
#ifdef PYRNA_FREE_SUPPORT
- pyrna->freeptr= TRUE;
+ pyrna->freeptr = TRUE;
#endif
- op->ptr= &pyrna->ptr;
+ op->ptr = &pyrna->ptr;
return (PyObject *)pyrna;
}
-static struct PyMethodDef bpy_ops_methods[]= {
+static struct PyMethodDef bpy_ops_methods[] = {
{"poll", (PyCFunction) pyop_poll, METH_VARARGS, NULL},
{"call", (PyCFunction) pyop_call, METH_VARARGS, NULL},
{"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL},
@@ -459,7 +459,7 @@ static struct PyMethodDef bpy_ops_methods[]= {
{NULL, NULL, 0, NULL}
};
-static struct PyModuleDef bpy_ops_module= {
+static struct PyModuleDef bpy_ops_module = {
PyModuleDef_HEAD_INIT,
"_bpy.ops",
NULL,
@@ -472,7 +472,7 @@ PyObject *BPY_operator_module(void)
{
PyObject *submodule;
- submodule= PyModule_Create(&bpy_ops_module);
+ submodule = PyModule_Create(&bpy_ops_module);
return submodule;
}
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index aa458925202..7860762059c 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -45,7 +45,7 @@
static void operator_properties_init(wmOperatorType *ot)
{
- PyObject *py_class= ot->ext.data;
+ PyObject *py_class = ot->ext.data;
RNA_struct_blender_type_set(ot->ext.srna, ot);
/* only call this so pyrna_deferred_register_class gives a useful error
@@ -63,9 +63,9 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
{
/* take care not to overwrite anything set in
* WM_operatortype_append_ptr before opfunc() is called */
- StructRNA *srna= ot->srna;
- *ot= *((wmOperatorType *)userdata);
- ot->srna= srna; /* restore */
+ StructRNA *srna = ot->srna;
+ *ot = *((wmOperatorType *)userdata);
+ ot->srna = srna; /* restore */
operator_properties_init(ot);
@@ -74,25 +74,25 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
PropertyRNA *prop;
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
- prop= RNA_struct_find_property(&ptr, "type");
+ prop = RNA_struct_find_property(&ptr, "type");
if (prop) {
- ot->prop= prop;
+ ot->prop = prop;
}
}
}
void macro_wrapper(wmOperatorType *ot, void *userdata)
{
- wmOperatorType *data= (wmOperatorType *)userdata;
+ wmOperatorType *data = (wmOperatorType *)userdata;
/* only copy a couple of things, the rest is set by the macro registration */
- ot->name= data->name;
- ot->idname= data->idname;
- ot->description= data->description;
+ ot->name = data->name;
+ ot->idname = data->idname;
+ ot->description = data->description;
ot->flag |= data->flag; /* append flags to the one set by registration */
- ot->pyop_poll= data->pyop_poll;
- ot->ui= data->ui;
- ot->ext= data->ext;
+ ot->pyop_poll = data->pyop_poll;
+ ot->ui = data->ui;
+ ot->ext = data->ext;
operator_properties_init(ot);
}
@@ -117,17 +117,17 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
}
/* identifiers */
- srna= srna_from_self(macro, "Macro Define:");
- macroname= RNA_struct_identifier(srna);
+ srna = srna_from_self(macro, "Macro Define:");
+ macroname = RNA_struct_identifier(srna);
- ot= WM_operatortype_find(macroname, TRUE);
+ ot = WM_operatortype_find(macroname, TRUE);
if (!ot) {
PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid macro or hasn't been registered yet", macroname);
return NULL;
}
- otmacro= WM_operatortype_macro_define(ot, opname);
+ otmacro = WM_operatortype_macro_define(ot, opname);
RNA_pointer_create(NULL, &RNA_OperatorMacro, otmacro, &ptr_otmacro);
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index c0d796669d6..9984e7f2fe0 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -56,13 +56,13 @@
extern BPy_StructRNA *bpy_context_module;
-static EnumPropertyItem property_flag_items[]= {
+static EnumPropertyItem property_flag_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem property_flag_enum_items[]= {
+static EnumPropertyItem property_flag_enum_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
@@ -70,7 +70,7 @@ static EnumPropertyItem property_flag_enum_items[]= {
{0, NULL, 0, NULL, NULL}};
/* subtypes */
-static EnumPropertyItem property_subtype_string_items[]= {
+static EnumPropertyItem property_subtype_string_items[] = {
{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILENAME", 0, "Filename", ""},
@@ -80,7 +80,7 @@ static EnumPropertyItem property_subtype_string_items[]= {
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem property_subtype_number_items[]= {
+static EnumPropertyItem property_subtype_number_items[] = {
{PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
{PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
{PROP_FACTOR, "FACTOR", 0, "Factor", ""},
@@ -91,7 +91,7 @@ static EnumPropertyItem property_subtype_number_items[]= {
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem property_subtype_array_items[]= {
+static EnumPropertyItem property_subtype_array_items[] = {
{PROP_COLOR, "COLOR", 0, "Color", ""},
{PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
{PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
@@ -109,29 +109,29 @@ static EnumPropertyItem property_subtype_array_items[]= {
{0, NULL, 0, NULL, NULL}};
/* PyObject's */
-static PyObject *pymeth_BoolProperty= NULL;
-static PyObject *pymeth_BoolVectorProperty= NULL;
-static PyObject *pymeth_IntProperty= NULL;
-static PyObject *pymeth_IntVectorProperty= NULL;
-static PyObject *pymeth_FloatProperty= NULL;
-static PyObject *pymeth_FloatVectorProperty= NULL;
-static PyObject *pymeth_StringProperty= NULL;
-static PyObject *pymeth_EnumProperty= NULL;
-static PyObject *pymeth_PointerProperty= NULL;
-static PyObject *pymeth_CollectionProperty= NULL;
-static PyObject *pymeth_RemoveProperty= NULL;
+static PyObject *pymeth_BoolProperty = NULL;
+static PyObject *pymeth_BoolVectorProperty = NULL;
+static PyObject *pymeth_IntProperty = NULL;
+static PyObject *pymeth_IntVectorProperty = NULL;
+static PyObject *pymeth_FloatProperty = NULL;
+static PyObject *pymeth_FloatVectorProperty = NULL;
+static PyObject *pymeth_StringProperty = NULL;
+static PyObject *pymeth_EnumProperty = NULL;
+static PyObject *pymeth_PointerProperty = NULL;
+static PyObject *pymeth_CollectionProperty = NULL;
+static PyObject *pymeth_RemoveProperty = NULL;
static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
{
- PyObject *self= NULL;
+ PyObject *self = NULL;
/* first get self */
/* operators can store their own instance for later use */
if (ptr->data) {
- void **instance= RNA_struct_instance(ptr);
+ void **instance = RNA_struct_instance(ptr);
if (instance) {
if (*instance) {
- self= *instance;
+ self = *instance;
Py_INCREF(self);
}
}
@@ -139,7 +139,7 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
/* in most cases this will run */
if (self == NULL) {
- self= pyrna_struct_CreatePyObject(ptr);
+ self = pyrna_struct_CreatePyObject(ptr);
}
return self;
@@ -149,7 +149,7 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
static void printf_func_error(PyObject *py_func)
{
/* since we return to C code we can't leave the error */
- PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func);
+ PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(py_func);
PyErr_Print();
PyErr_Clear();
@@ -166,12 +166,12 @@ static void printf_func_error(PyObject *py_func)
* the default args for that operator instance */
static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
{
- PyObject *ret= PyTuple_New(2);
+ PyObject *ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, func);
Py_INCREF(func);
- if (kw==NULL)
- kw= PyDict_New();
+ if (kw == NULL)
+ kw = PyDict_New();
else
Py_INCREF(kw);
@@ -184,12 +184,12 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop)
{
PyGILState_STATE gilstate;
- PyObject **py_data= (PyObject **)RNA_property_py_data_get(prop);
+ PyObject **py_data = (PyObject **)RNA_property_py_data_get(prop);
PyObject *py_func;
PyObject *args;
PyObject *self;
PyObject *ret;
- const int is_write_ok= pyrna_write_check();
+ const int is_write_ok = pyrna_write_check();
BLI_assert(py_data != NULL);
@@ -199,16 +199,16 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
bpy_context_set(C, &gilstate);
- py_func= py_data[BPY_DATA_CB_SLOT_UPDATE];
+ py_func = py_data[BPY_DATA_CB_SLOT_UPDATE];
- args= PyTuple_New(2);
- self= pyrna_struct_as_instance(ptr);
+ args = PyTuple_New(2);
+ self = pyrna_struct_as_instance(ptr);
PyTuple_SET_ITEM(args, 0, self);
PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module);
Py_INCREF(bpy_context_module);
- ret= PyObject_CallObject(py_func, args);
+ ret = PyObject_CallObject(py_func, args);
Py_DECREF(args);
@@ -241,7 +241,7 @@ static int bpy_prop_callback_check(PyObject *py_func, int argcount)
return -1;
}
else {
- PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func);
+ PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(py_func);
if (f_code->co_argcount != argcount) {
PyErr_Format(PyExc_TypeError,
"update keyword: expected a function taking %d arguments, not %d",
@@ -259,9 +259,9 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c
{
/* assume this is already checked for type and arg length */
if (update_cb) {
- PyObject **py_data= MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, __func__);
+ PyObject **py_data = MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, __func__);
RNA_def_property_update_runtime(prop, (void *)bpy_prop_update_cb);
- py_data[BPY_DATA_CB_SLOT_UPDATE]= update_cb;
+ py_data[BPY_DATA_CB_SLOT_UPDATE] = update_cb;
RNA_def_py_data(prop, py_data);
RNA_def_property_flag(prop, PROP_CONTEXT_PROPERTY_UPDATE);
@@ -274,7 +274,7 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c
static int py_long_as_int(PyObject *py_long, int *r_int)
{
if (PyLong_CheckExact(py_long)) {
- *r_int= (int)PyLong_AS_LONG(py_long);
+ *r_int = (int)PyLong_AS_LONG(py_long);
return 0;
}
else {
@@ -287,9 +287,9 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
#define BPY_PROPDEF_HEAD(_func) \
if (PyTuple_GET_SIZE(args) == 1) { \
PyObject *ret; \
- self= PyTuple_GET_ITEM(args, 0); \
- args= PyTuple_New(0); \
- ret= BPy_##_func(self, args, kw); \
+ self = PyTuple_GET_ITEM(args, 0); \
+ args = PyTuple_New(0); \
+ ret = BPy_##_func(self, args, kw); \
Py_DECREF(args); \
return ret; \
} \
@@ -297,8 +297,8 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
PyErr_SetString(PyExc_ValueError, "all args must be keywords"); \
return NULL; \
} \
- srna= srna_from_self(self, #_func"(...):"); \
- if (srna==NULL) { \
+ srna = srna_from_self(self, #_func"(...):"); \
+ if (srna == NULL) { \
if (PyErr_Occurred()) \
return NULL; \
return bpy_prop_deferred_return(pymeth_##_func, kw); \
@@ -310,7 +310,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
if (id_len >= MAX_IDPROP_NAME) { \
PyErr_Format(PyExc_TypeError, \
#_func"(): '%.200s' too long, max length is %d", \
- id, MAX_IDPROP_NAME-1); \
+ id, MAX_IDPROP_NAME - 1); \
return NULL; \
} \
if (RNA_def_property_free_identifier(srna, id) == -1) { \
@@ -322,7 +322,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, \
pyopts, \
&opts, \
- #_func"(options={...}):")) \
+ #_func"(options={ ...}):")) \
{ \
return NULL; \
} \
@@ -331,7 +331,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
BPY_PROPDEF_CHECK(_func, _property_flag_items) \
if (pysubtype && RNA_enum_value_from_id(_subtype, \
pysubtype, \
- &subtype)==0) \
+ &subtype) == 0) \
{ \
PyErr_Format(PyExc_TypeError, \
#_func"(subtype='%s'): invalid subtype", \
@@ -393,17 +393,17 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(BoolProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "name", "description", "default",
"options", "subtype", "update", NULL};
- const char *id=NULL, *name="", *description="";
+ const char *id = NULL, *name = "", *description = "";
int id_len;
- int def=0;
+ int def = 0;
PropertyRNA *prop;
- PyObject *pyopts= NULL;
- int opts=0;
- char *pysubtype= NULL;
- int subtype= PROP_NONE;
- PyObject *update_cb= NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ char *pysubtype = NULL;
+ int subtype = PROP_NONE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|ssiO!sO:BoolProperty",
@@ -421,13 +421,13 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
+ prop = RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
RNA_def_property_boolean_default(prop, def);
RNA_def_property_ui_text(prop, name, description);
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -461,19 +461,19 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(BoolVectorProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "name", "description", "default",
"options", "subtype", "size", "update", NULL};
- const char *id=NULL, *name="", *description="";
+ const char *id = NULL, *name = "", *description = "";
int id_len;
- int def[PYRNA_STACK_ARRAY]={0};
- int size=3;
+ int def[PYRNA_STACK_ARRAY] = {0};
+ int size = 3;
PropertyRNA *prop;
- PyObject *pydef= NULL;
- PyObject *pyopts= NULL;
- int opts=0;
- char *pysubtype= NULL;
- int subtype= PROP_NONE;
- PyObject *update_cb= NULL;
+ PyObject *pydef = NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ char *pysubtype = NULL;
+ int subtype = PROP_NONE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|ssOO!siO:BoolVectorProperty",
@@ -501,15 +501,15 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
return NULL;
}
- // prop= RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description);
- prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
+ // prop = RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description);
+ prop = RNA_def_property(srna, id, PROP_BOOLEAN, subtype);
RNA_def_property_array(prop, size);
if (pydef) RNA_def_property_boolean_array_default(prop, def);
RNA_def_property_ui_text(prop, name, description);
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -539,17 +539,17 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(IntProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "name", "description", "default",
"min", "max", "soft_min", "soft_max", "step", "options", "subtype", "update", NULL};
- const char *id=NULL, *name="", *description="";
+ const char *id = NULL, *name = "", *description = "";
int id_len;
- int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def=0;
+ int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1, def = 0;
PropertyRNA *prop;
- PyObject *pyopts= NULL;
- int opts=0;
- char *pysubtype= NULL;
- int subtype= PROP_NONE;
- PyObject *update_cb= NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ char *pysubtype = NULL;
+ int subtype = PROP_NONE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|ssiiiiiiO!sO:IntProperty",
@@ -568,7 +568,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- prop= RNA_def_property(srna, id, PROP_INT, subtype);
+ prop = RNA_def_property(srna, id, PROP_INT, subtype);
RNA_def_property_int_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
@@ -576,7 +576,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -609,20 +609,21 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(IntVectorProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "name", "description", "default",
"min", "max", "soft_min", "soft_max",
"step", "options", "subtype", "size", "update", NULL};
- const char *id=NULL, *name="", *description="";
+ const char *id = NULL, *name = "", *description = "";
int id_len;
- int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def[PYRNA_STACK_ARRAY]={0};
- int size=3;
+ int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1;
+ int def[PYRNA_STACK_ARRAY] = {0};
+ int size = 3;
PropertyRNA *prop;
- PyObject *pydef= NULL;
- PyObject *pyopts= NULL;
- int opts=0;
- char *pysubtype= NULL;
- int subtype= PROP_NONE;
- PyObject *update_cb= NULL;
+ PyObject *pydef = NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ char *pysubtype = NULL;
+ int subtype = PROP_NONE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|ssOiiiiiO!siO:IntVectorProperty",
@@ -652,7 +653,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
return NULL;
}
- prop= RNA_def_property(srna, id, PROP_INT, subtype);
+ prop = RNA_def_property(srna, id, PROP_INT, subtype);
RNA_def_property_array(prop, size);
if (pydef) RNA_def_property_int_array_default(prop, def);
RNA_def_property_range(prop, min, max);
@@ -661,7 +662,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -692,21 +693,21 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(FloatProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "name", "description", "default",
"min", "max", "soft_min", "soft_max",
"step", "precision", "options", "subtype", "unit", "update", NULL};
- const char *id=NULL, *name="", *description="";
+ const char *id = NULL, *name = "", *description = "";
int id_len;
- float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def=0.0f;
- int precision= 2;
+ float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3, def = 0.0f;
+ int precision = 2;
PropertyRNA *prop;
- PyObject *pyopts= NULL;
- int opts=0;
- char *pysubtype= NULL;
- int subtype= PROP_NONE;
- char *pyunit= NULL;
- int unit= PROP_UNIT_NONE;
- PyObject *update_cb= NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ char *pysubtype = NULL;
+ int subtype = PROP_NONE;
+ char *pyunit = NULL;
+ int unit = PROP_UNIT_NONE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|ssffffffiO!ssO:FloatProperty",
@@ -722,7 +723,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_SUBTYPE_CHECK(FloatProperty, property_flag_items, property_subtype_number_items)
- if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) {
+ if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit) == 0) {
PyErr_Format(PyExc_TypeError, "FloatProperty(unit='%s'): invalid unit", pyunit);
return NULL;
}
@@ -731,7 +732,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- prop= RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
+ prop = RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
RNA_def_property_float_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
@@ -739,7 +740,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -773,22 +774,22 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
BPY_PROPDEF_HEAD(FloatVectorProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "name", "description", "default",
"min", "max", "soft_min", "soft_max",
"step", "precision", "options", "subtype", "unit", "size", "update", NULL};
- const char *id=NULL, *name="", *description="";
+ const char *id = NULL, *name = "", *description = "";
int id_len;
- float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def[PYRNA_STACK_ARRAY]={0.0f};
- int precision= 2, size=3;
+ float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3, def[PYRNA_STACK_ARRAY] = {0.0f};
+ int precision = 2, size = 3;
PropertyRNA *prop;
- PyObject *pydef= NULL;
- PyObject *pyopts= NULL;
- int opts=0;
- char *pysubtype= NULL;
- int subtype= PROP_NONE;
- char *pyunit= NULL;
- int unit= PROP_UNIT_NONE;
- PyObject *update_cb= NULL;
+ PyObject *pydef = NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ char *pysubtype = NULL;
+ int subtype = PROP_NONE;
+ char *pyunit = NULL;
+ int unit = PROP_UNIT_NONE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|ssOfffffiO!ssiO:FloatVectorProperty",
@@ -804,7 +805,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
BPY_PROPDEF_SUBTYPE_CHECK(FloatVectorProperty, property_flag_items, property_subtype_array_items)
- if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) {
+ if (pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit) == 0) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(unit='%s'): invalid unit", pyunit);
return NULL;
}
@@ -823,7 +824,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
return NULL;
}
- prop= RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
+ prop = RNA_def_property(srna, id, PROP_FLOAT, subtype | unit);
RNA_def_property_array(prop, size);
if (pydef) RNA_def_property_float_array_default(prop, def);
RNA_def_property_range(prop, min, max);
@@ -832,7 +833,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -861,17 +862,17 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
BPY_PROPDEF_HEAD(StringProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "name", "description", "default",
"maxlen", "options", "subtype", "update", NULL};
- const char *id=NULL, *name="", *description="", *def="";
+ const char *id = NULL, *name = "", *description = "", *def = "";
int id_len;
- int maxlen=0;
+ int maxlen = 0;
PropertyRNA *prop;
- PyObject *pyopts= NULL;
- int opts=0;
- char *pysubtype= NULL;
- int subtype= PROP_NONE;
- PyObject *update_cb= NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ char *pysubtype = NULL;
+ int subtype = PROP_NONE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#|sssiO!sO:StringProperty",
@@ -889,14 +890,14 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
return NULL;
}
- prop= RNA_def_property(srna, id, PROP_STRING, subtype);
+ prop = RNA_def_property(srna, id, PROP_STRING, subtype);
if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */
if (def) RNA_def_property_string_default(prop, def);
RNA_def_property_ui_text(prop, name, description);
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -909,11 +910,11 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
/* copies orig to buf, then sets orig to buf, returns copy length */
static size_t strswapbufcpy(char *buf, const char **orig)
{
- const char *src= *orig;
- char *dst= buf;
- size_t i= 0;
- *orig= buf;
- while ((*dst= *src)) { dst++; src++; i++; }
+ const char *src = *orig;
+ char *dst = buf;
+ size_t i = 0;
+ *orig = buf;
+ while ((*dst = *src)) { dst++; src++; i++; }
return i + 1; /* include '\0' */
}
#endif
@@ -922,11 +923,11 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
{
EnumPropertyItem *items;
PyObject *item;
- const Py_ssize_t seq_len= PySequence_Fast_GET_SIZE(seq_fast);
- Py_ssize_t totbuf= 0;
+ const Py_ssize_t seq_len = PySequence_Fast_GET_SIZE(seq_fast);
+ Py_ssize_t totbuf = 0;
int i;
- short def_used= 0;
- const char *def_cmp= NULL;
+ short def_used = 0;
+ const char *def_cmp = NULL;
if (is_enum_flag) {
if (seq_len > RNA_ENUM_BITFLAG_SIZE) {
@@ -946,8 +947,8 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
}
else {
if (def) {
- def_cmp= _PyUnicode_AsString(def);
- if (def_cmp==NULL) {
+ def_cmp = _PyUnicode_AsString(def);
+ if (def_cmp == NULL) {
PyErr_Format(PyExc_TypeError,
"EnumProperty(...): default option must be a 'str' "
"type when ENUM_FLAG is disabled, not a '%.200s'",
@@ -958,30 +959,30 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
}
/* blank value */
- *defvalue= 0;
+ *defvalue = 0;
- items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "enum_items_from_py1");
+ items = MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "enum_items_from_py1");
- for (i=0; i<seq_len; i++) {
- EnumPropertyItem tmp= {0, "", 0, "", ""};
+ for (i = 0; i < seq_len; i++) {
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
Py_ssize_t item_size;
Py_ssize_t id_str_size;
Py_ssize_t name_str_size;
Py_ssize_t desc_str_size;
- item= PySequence_Fast_GET_ITEM(seq_fast, i);
+ item = PySequence_Fast_GET_ITEM(seq_fast, i);
- if ( (PyTuple_CheckExact(item)) &&
- (item_size= PyTuple_GET_SIZE(item)) &&
- (item_size == 3 || item_size == 4) &&
- (tmp.identifier= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
- (tmp.name= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
- (tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
- (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1) /* TODO, number isnt ensured to be unique from the script author */
- ) {
+ if ( (PyTuple_CheckExact(item)) &&
+ (item_size = PyTuple_GET_SIZE(item)) &&
+ (item_size == 3 || item_size == 4) &&
+ (tmp.identifier = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
+ (tmp.name = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
+ (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
+ (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1)) /* TODO, number isnt ensured to be unique from the script author */
+ {
if (is_enum_flag) {
if (item_size < 4) {
- tmp.value= 1<<i;
+ tmp.value = 1 << i;
}
if (def && PySet_Contains(def, PyTuple_GET_ITEM(item, 0))) {
@@ -991,16 +992,16 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
}
else {
if (item_size < 4) {
- tmp.value= i;
+ tmp.value = i;
}
- if (def && def_used == 0 && strcmp(def_cmp, tmp.identifier)==0) {
- *defvalue= tmp.value;
+ if (def && def_used == 0 && strcmp(def_cmp, tmp.identifier) == 0) {
+ *defvalue = tmp.value;
def_used++; /* only ever 1 */
}
}
- items[i]= tmp;
+ items[i] = tmp;
/* calculate combine string length */
totbuf += id_str_size + name_str_size + desc_str_size + 3; /* 3 is for '\0's */
@@ -1046,18 +1047,18 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
* immediately after use, so we need to duplicate them, ugh.
* annoying because it works most of the time without this. */
{
- EnumPropertyItem *items_dup= MEM_mallocN((sizeof(EnumPropertyItem) * (seq_len + 1)) + (sizeof(char) * totbuf),
+ EnumPropertyItem *items_dup = MEM_mallocN((sizeof(EnumPropertyItem) * (seq_len + 1)) + (sizeof(char) * totbuf),
"enum_items_from_py2");
- EnumPropertyItem *items_ptr= items_dup;
- char *buf= ((char *)items_dup) + (sizeof(EnumPropertyItem) * (seq_len + 1));
+ EnumPropertyItem *items_ptr = items_dup;
+ char *buf = ((char *)items_dup) + (sizeof(EnumPropertyItem) * (seq_len + 1));
memcpy(items_dup, items, sizeof(EnumPropertyItem) * (seq_len + 1));
- for (i=0; i<seq_len; i++, items_ptr++) {
+ for (i = 0; i < seq_len; i++, items_ptr++) {
buf += strswapbufcpy(buf, &items_ptr->identifier);
buf += strswapbufcpy(buf, &items_ptr->name);
buf += strswapbufcpy(buf, &items_ptr->description);
}
MEM_freeN(items);
- items=items_dup;
+ items = items_dup;
}
/* end string duplication */
#endif
@@ -1069,47 +1070,47 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
{
PyGILState_STATE gilstate;
- PyObject *py_func= RNA_property_enum_py_data_get(prop);
- PyObject *self= NULL;
+ PyObject *py_func = RNA_property_enum_py_data_get(prop);
+ PyObject *self = NULL;
PyObject *args;
PyObject *items; /* returned from the function call */
- EnumPropertyItem *eitems= NULL;
- int err= 0;
+ EnumPropertyItem *eitems = NULL;
+ int err = 0;
bpy_context_set(C, &gilstate);
- args= PyTuple_New(2);
- self= pyrna_struct_as_instance(ptr);
+ args = PyTuple_New(2);
+ self = pyrna_struct_as_instance(ptr);
PyTuple_SET_ITEM(args, 0, self);
/* now get the context */
PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module);
Py_INCREF(bpy_context_module);
- items= PyObject_CallObject(py_func, args);
+ items = PyObject_CallObject(py_func, args);
Py_DECREF(args);
- if (items==NULL) {
- err= -1;
+ if (items == NULL) {
+ err = -1;
}
else {
PyObject *items_fast;
- int defvalue_dummy=0;
+ int defvalue_dummy = 0;
- if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): "
+ if (!(items_fast = PySequence_Fast(items, "EnumProperty(...): "
"return value from the callback was not a sequence")))
{
- err= -1;
+ err = -1;
}
else {
- eitems= enum_items_from_py(items_fast, NULL, &defvalue_dummy, (RNA_property_flag(prop) & PROP_ENUM_FLAG)!=0);
+ eitems = enum_items_from_py(items_fast, NULL, &defvalue_dummy, (RNA_property_flag(prop) & PROP_ENUM_FLAG) != 0);
Py_DECREF(items_fast);
if (!eitems) {
- err= -1;
+ err = -1;
}
}
@@ -1117,12 +1118,12 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
}
if (err != -1) { /* worked */
- *free= 1;
+ *free = 1;
}
else {
printf_func_error(py_func);
- eitems= DummyRNA_NULL_items;
+ eitems = DummyRNA_NULL_items;
}
@@ -1160,19 +1161,19 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(EnumProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "items", "name", "description", "default",
+ static const char *kwlist[] = {"attr", "items", "name", "description", "default",
"options", "update", NULL};
- const char *id=NULL, *name="", *description="";
- PyObject *def= NULL;
+ const char *id = NULL, *name = "", *description = "";
+ PyObject *def = NULL;
int id_len;
- int defvalue=0;
+ int defvalue = 0;
PyObject *items, *items_fast;
EnumPropertyItem *eitems;
PropertyRNA *prop;
- PyObject *pyopts= NULL;
- int opts=0;
- short is_itemf= FALSE;
- PyObject *update_cb= NULL;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ short is_itemf = FALSE;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#O|ssOO!O:EnumProperty",
@@ -1192,7 +1193,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
/* items can be a list or a callable */
if (PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */
- PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(items);
+ PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(items);
if (f_code->co_argcount != 2) {
PyErr_Format(PyExc_ValueError,
"EnumProperty(...): expected 'items' function to take 2 arguments, not %d",
@@ -1207,17 +1208,17 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- is_itemf= TRUE;
- eitems= DummyRNA_NULL_items;
+ is_itemf = TRUE;
+ eitems = DummyRNA_NULL_items;
}
else {
- if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): "
+ if (!(items_fast = PySequence_Fast(items, "EnumProperty(...): "
"expected a sequence of tuples for the enum items or a function")))
{
return NULL;
}
- eitems= enum_items_from_py(items_fast, def, &defvalue, (opts & PROP_ENUM_FLAG)!=0);
+ eitems = enum_items_from_py(items_fast, def, &defvalue, (opts & PROP_ENUM_FLAG) != 0);
Py_DECREF(items_fast);
@@ -1226,8 +1227,8 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
}
}
- if (opts & PROP_ENUM_FLAG) prop= RNA_def_enum_flag(srna, id, eitems, defvalue, name, description);
- else prop= RNA_def_enum(srna, id, eitems, defvalue, name, description);
+ if (opts & PROP_ENUM_FLAG) prop = RNA_def_enum_flag(srna, id, eitems, defvalue, name, description);
+ else prop = RNA_def_enum(srna, id, eitems, defvalue, name, description);
if (is_itemf) {
RNA_def_enum_funcs(prop, bpy_props_enum_itemf);
@@ -1240,7 +1241,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -1257,11 +1258,11 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
{
StructRNA *srna;
- srna= srna_from_self(value, "");
+ srna = srna_from_self(value, "");
if (!srna) {
if (PyErr_Occurred()) {
- PyObject *msg= PyC_ExceptionBuffer();
- const char *msg_char= _PyUnicode_AsString(msg);
+ PyObject *msg = PyC_ExceptionBuffer();
+ const char *msg_char = _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError,
"%.200s expected an RNA type derived from PropertyGroup, failed with: %s",
error_prefix, msg_char);
@@ -1305,15 +1306,15 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
BPY_PROPDEF_HEAD(PointerProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "type", "name", "description", "options", "update", NULL};
- const char *id=NULL, *name="", *description="";
+ static const char *kwlist[] = {"attr", "type", "name", "description", "options", "update", NULL};
+ const char *id = NULL, *name = "", *description = "";
int id_len;
PropertyRNA *prop;
StructRNA *ptype;
- PyObject *type= Py_None;
- PyObject *pyopts= NULL;
- int opts=0;
- PyObject *update_cb= NULL;
+ PyObject *type = Py_None;
+ PyObject *pyopts = NULL;
+ int opts = 0;
+ PyObject *update_cb = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#O|ssO!O:PointerProperty",
@@ -1327,7 +1328,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
BPY_PROPDEF_CHECK(PointerProperty, property_flag_items)
- ptype= pointer_type_from_py(type, "PointerProperty(...):");
+ ptype = pointer_type_from_py(type, "PointerProperty(...):");
if (!ptype)
return NULL;
@@ -1335,10 +1336,10 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
return NULL;
}
- prop= RNA_def_pointer_runtime(srna, id, ptype, name, description);
+ prop = RNA_def_pointer_runtime(srna, id, ptype, name, description);
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
bpy_prop_callback_assign(prop, update_cb);
@@ -1366,14 +1367,14 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(CollectionProperty)
if (srna) {
- static const char *kwlist[]= {"attr", "type", "name", "description", "options", NULL};
- const char *id=NULL, *name="", *description="";
+ static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL};
+ const char *id = NULL, *name = "", *description = "";
int id_len;
PropertyRNA *prop;
StructRNA *ptype;
- PyObject *type= Py_None;
- PyObject *pyopts= NULL;
- int opts=0;
+ PyObject *type = Py_None;
+ PyObject *pyopts = NULL;
+ int opts = 0;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#O|ssO!:CollectionProperty",
@@ -1386,14 +1387,14 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_CHECK(CollectionProperty, property_flag_items)
- ptype= pointer_type_from_py(type, "CollectionProperty(...):");
+ ptype = pointer_type_from_py(type, "CollectionProperty(...):");
if (!ptype)
return NULL;
- prop= RNA_def_collection_runtime(srna, id, ptype, name, description);
+ prop = RNA_def_collection_runtime(srna, id, ptype, name, description);
if (pyopts) {
if (opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
- if ((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ if ((opts & PROP_ANIMATABLE) == 0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
if (opts & PROP_SKIP_SAVE) RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
RNA_def_property_duplicate_pointers(srna, prop);
@@ -1415,9 +1416,9 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
if (PyTuple_GET_SIZE(args) == 1) {
PyObject *ret;
- self= PyTuple_GET_ITEM(args, 0);
- args= PyTuple_New(0);
- ret= BPy_RemoveProperty(self, args, kw);
+ self = PyTuple_GET_ITEM(args, 0);
+ args = PyTuple_New(0);
+ ret = BPy_RemoveProperty(self, args, kw);
Py_DECREF(args);
return ret;
}
@@ -1426,18 +1427,18 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
return NULL;
}
- srna= srna_from_self(self, "RemoveProperty(...):");
- if (srna==NULL && PyErr_Occurred()) {
+ srna = srna_from_self(self, "RemoveProperty(...):");
+ if (srna == NULL && PyErr_Occurred()) {
return NULL; /* self's type was compatible but error getting the srna */
}
- else if (srna==NULL) {
+ else if (srna == NULL) {
PyErr_SetString(PyExc_TypeError, "RemoveProperty(): struct rna not available for this type");
return NULL;
}
else {
- static const char *kwlist[]= {"attr", NULL};
+ static const char *kwlist[] = {"attr", NULL};
- char *id=NULL;
+ char *id = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s:RemoveProperty",
@@ -1454,7 +1455,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
Py_RETURN_NONE;
}
-static struct PyMethodDef props_methods[]= {
+static struct PyMethodDef props_methods[] = {
{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolProperty_doc},
{"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolVectorProperty_doc},
{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntProperty_doc},
@@ -1470,7 +1471,7 @@ static struct PyMethodDef props_methods[]= {
{NULL, NULL, 0, NULL}
};
-static struct PyModuleDef props_module= {
+static struct PyModuleDef props_module = {
PyModuleDef_HEAD_INIT,
"bpy.props",
"This module defines properties to extend blenders internal data, the result of these functions"
@@ -1485,7 +1486,7 @@ PyObject *BPY_rna_props(void)
PyObject *submodule;
PyObject *submodule_dict;
- submodule= PyModule_Create(&props_module);
+ submodule = PyModule_Create(&props_module);
PyDict_SetItemString(PyImport_GetModuleDict(), props_module.m_name, submodule);
/* INCREF since its its assumed that all these functions return the
@@ -1494,9 +1495,9 @@ PyObject *BPY_rna_props(void)
Py_INCREF(submodule);
/* api needs the PyObjects internally */
- submodule_dict= PyModule_GetDict(submodule);
+ submodule_dict = PyModule_GetDict(submodule);
-#define ASSIGN_STATIC(_name) pymeth_##_name= PyDict_GetItemString(submodule_dict, #_name)
+#define ASSIGN_STATIC(_name) pymeth_##_name = PyDict_GetItemString(submodule_dict, #_name)
ASSIGN_STATIC(BoolProperty);
ASSIGN_STATIC(BoolVectorProperty);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index f099994fc57..b23db759603 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -120,13 +120,13 @@ int pyrna_prop_validity_check(BPy_PropertyRNA *self)
#if defined(USE_PYRNA_INVALIDATE_GC) || defined(USE_PYRNA_INVALIDATE_WEAKREF)
static void pyrna_invalidate(BPy_DummyPointerRNA *self)
{
- self->ptr.type= NULL; /* this is checked for validity */
- self->ptr.id.data= NULL; /* should not be needed but prevent bad pointer access, just incase */
+ self->ptr.type = NULL; /* this is checked for validity */
+ self->ptr.id.data = NULL; /* should not be needed but prevent bad pointer access, just incase */
}
#endif
#ifdef USE_PYRNA_INVALIDATE_GC
-#define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1))
+#define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g) + 1))
/* only for sizeof() */
struct gc_generation {
@@ -138,15 +138,15 @@ struct gc_generation {
static void id_release_gc(struct ID *id)
{
unsigned int j;
- // unsigned int i= 0;
- for (j=0; j<3; j++) {
+ // unsigned int i = 0;
+ for (j = 0; j < 3; j++) {
/* hack below to get the 2 other lists from _PyGC_generation0 that are normally not exposed */
- PyGC_Head *gen= (PyGC_Head *)(((char *)_PyGC_generation0) + (sizeof(gc_generation) * j));
- PyGC_Head *g= gen->gc.gc_next;
- while ((g= g->gc.gc_next) != gen) {
- PyObject *ob= FROM_GC(g);
+ PyGC_Head *gen = (PyGC_Head *)(((char *)_PyGC_generation0) + (sizeof(gc_generation) * j));
+ PyGC_Head *g = gen->gc.gc_next;
+ while ((g = g->gc.gc_next) != gen) {
+ PyObject *ob = FROM_GC(g);
if (PyType_IsSubtype(Py_TYPE(ob), &pyrna_struct_Type) || PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type)) {
- BPy_DummyPointerRNA *ob_ptr= (BPy_DummyPointerRNA *)ob;
+ BPy_DummyPointerRNA *ob_ptr = (BPy_DummyPointerRNA *)ob;
if (ob_ptr->ptr.id.data == id) {
pyrna_invalidate(ob_ptr);
// printf("freeing: %p %s, %.200s\n", (void *)ob, id->name, Py_TYPE(ob)->tp_name);
@@ -162,27 +162,27 @@ static void id_release_gc(struct ID *id)
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
//#define DEBUG_RNA_WEAKREF
-struct GHash *id_weakref_pool= NULL;
+struct GHash *id_weakref_pool = NULL;
static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref);
-static PyMethodDef id_free_weakref_cb_def= {"id_free_weakref_cb", (PyCFunction)id_free_weakref_cb, METH_O, NULL};
+static PyMethodDef id_free_weakref_cb_def = {"id_free_weakref_cb", (PyCFunction)id_free_weakref_cb, METH_O, NULL};
/* adds a reference to the list, remember to decref */
static GHash *id_weakref_pool_get(ID *id)
{
- GHash *weakinfo_hash= NULL;
+ GHash *weakinfo_hash = NULL;
if (id_weakref_pool) {
- weakinfo_hash= BLI_ghash_lookup(id_weakref_pool, (void *)id);
+ weakinfo_hash = BLI_ghash_lookup(id_weakref_pool, (void *)id);
}
else {
/* first time, allocate pool */
- id_weakref_pool= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_global_pool");
- weakinfo_hash= NULL;
+ id_weakref_pool = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_global_pool");
+ weakinfo_hash = NULL;
}
- if (weakinfo_hash==NULL) {
+ if (weakinfo_hash == NULL) {
/* we're using a ghash as a set, could use libHX's HXMAP_SINGULAR but would be an extra dep. */
- weakinfo_hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_id");
+ weakinfo_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_id");
BLI_ghash_insert(id_weakref_pool, (void *)id, weakinfo_hash);
}
@@ -197,14 +197,14 @@ void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna)
PyObject *weakref_cb_py;
/* create a new function instance and insert the list as 'self' so we can remove ourself from it */
- GHash *weakinfo_hash= id_weakref_pool_get(id); /* new or existing */
+ GHash *weakinfo_hash = id_weakref_pool_get(id); /* new or existing */
- weakref_capsule= PyCapsule_New(weakinfo_hash, NULL, NULL);
- weakref_cb_py= PyCFunction_New(&id_free_weakref_cb_def, weakref_capsule);
+ weakref_capsule = PyCapsule_New(weakinfo_hash, NULL, NULL);
+ weakref_cb_py = PyCFunction_New(&id_free_weakref_cb_def, weakref_capsule);
Py_DECREF(weakref_capsule);
/* add weakref to weakinfo_hash list */
- weakref= PyWeakref_NewRef((PyObject *)pyrna, weakref_cb_py);
+ weakref = PyWeakref_NewRef((PyObject *)pyrna, weakref_cb_py);
Py_DECREF(weakref_cb_py); /* function owned by the weakref now */
@@ -218,14 +218,14 @@ void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna)
static ID *_id_tmp_ptr;
static void value_id_set(void *id)
{
- _id_tmp_ptr= (ID *)id;
+ _id_tmp_ptr = (ID *)id;
}
static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash);
static PyObject *id_free_weakref_cb(PyObject *weakinfo_capsule, PyObject *weakref)
{
/* important to search backwards */
- GHash *weakinfo_hash= PyCapsule_GetPointer(weakinfo_capsule, NULL);
+ GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_capsule, NULL);
if (BLI_ghash_size(weakinfo_hash) > 1) {
@@ -252,8 +252,8 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
#endif
while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter)) {
- PyObject *weakref= (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
- PyObject *item= PyWeakref_GET_OBJECT(weakref);
+ PyObject *weakref = (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
+ PyObject *item = PyWeakref_GET_OBJECT(weakref);
if (item != Py_None) {
#ifdef DEBUG_RNA_WEAKREF
@@ -273,7 +273,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
if (BLI_ghash_size(id_weakref_pool) == 0) {
BLI_ghash_free(id_weakref_pool, NULL, NULL);
- id_weakref_pool= NULL;
+ id_weakref_pool = NULL;
#ifdef DEBUG_RNA_WEAKREF
printf("id_release_weakref freeing pool\n");
#endif
@@ -282,7 +282,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
static void id_release_weakref(struct ID *id)
{
- GHash *weakinfo_hash= BLI_ghash_lookup(id_weakref_pool, (void *)id);
+ GHash *weakinfo_hash = BLI_ghash_lookup(id_weakref_pool, (void *)id);
if (weakinfo_hash) {
id_release_weakref_list(id, weakinfo_hash);
}
@@ -298,7 +298,7 @@ void BPY_id_release(struct ID *id)
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
if (id_weakref_pool) {
- PyGILState_STATE gilstate= PyGILState_Ensure();
+ PyGILState_STATE gilstate = PyGILState_Ensure();
id_release_weakref(id);
@@ -310,25 +310,25 @@ void BPY_id_release(struct ID *id)
}
#ifdef USE_PEDANTIC_WRITE
-static short rna_disallow_writes= FALSE;
+static short rna_disallow_writes = FALSE;
static int rna_id_write_error(PointerRNA *ptr, PyObject *key)
{
- ID *id= ptr->id.data;
+ ID *id = ptr->id.data;
if (id) {
- const short idcode= GS(id->name);
+ const short idcode = GS(id->name);
if (!ELEM(idcode, ID_WM, ID_SCR)) { /* may need more added here */
- const char *idtype= BKE_idcode_to_name(idcode);
+ const char *idtype = BKE_idcode_to_name(idcode);
const char *pyname;
- if (key && PyUnicode_Check(key)) pyname= _PyUnicode_AsString(key);
- else pyname= "<UNKNOWN>";
+ if (key && PyUnicode_Check(key)) pyname = _PyUnicode_AsString(key);
+ else pyname = "<UNKNOWN>";
/* make a nice string error */
BLI_assert(idtype != NULL);
PyErr_Format(PyExc_AttributeError,
"Writing to ID classes in this context is not allowed: "
"%.200s, %.200s datablock, error setting %.200s.%.200s",
- id->name+2, idtype, RNA_struct_identifier(ptr->type), pyname);
+ id->name + 2, idtype, RNA_struct_identifier(ptr->type), pyname);
return TRUE;
}
@@ -346,7 +346,7 @@ int pyrna_write_check(void)
void pyrna_write_set(int val)
{
- rna_disallow_writes= !val;
+ rna_disallow_writes = !val;
}
#else // USE_PEDANTIC_WRITE
int pyrna_write_check(void)
@@ -372,7 +372,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
/* bpyrna vector/euler/quat callbacks */
-static int mathutils_rna_array_cb_index= -1; /* index for our callbacks */
+static int mathutils_rna_array_cb_index = -1; /* index for our callbacks */
/* subtype not used much yet */
#define MATHUTILS_CB_SUBTYPE_EUL 0
@@ -382,7 +382,7 @@ static int mathutils_rna_array_cb_index= -1; /* index for our callbacks */
static int mathutils_rna_generic_check(BaseMathObject *bmo)
{
- BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+ BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
PYRNA_PROP_CHECK_INT(self);
@@ -391,20 +391,20 @@ static int mathutils_rna_generic_check(BaseMathObject *bmo)
static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
{
- BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+ BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
PYRNA_PROP_CHECK_INT(self);
- if (self->prop==NULL)
+ if (self->prop == NULL)
return -1;
RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
/* Euler order exception */
- if (subtype==MATHUTILS_CB_SUBTYPE_EUL) {
- EulerObject *eul= (EulerObject *)bmo;
- PropertyRNA *prop_eul_order= NULL;
- eul->order= pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
+ if (subtype == MATHUTILS_CB_SUBTYPE_EUL) {
+ EulerObject *eul = (EulerObject *)bmo;
+ PropertyRNA *prop_eul_order = NULL;
+ eul->order = pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
}
return 0;
@@ -412,12 +412,12 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
{
- BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+ BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
float min, max;
PYRNA_PROP_CHECK_INT(self);
- if (self->prop==NULL)
+ if (self->prop == NULL)
return -1;
#ifdef USE_PEDANTIC_WRITE
@@ -436,8 +436,8 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
RNA_property_float_range(&self->ptr, self->prop, &min, &max);
if (min != FLT_MIN || max != FLT_MAX) {
- int i, len= RNA_property_array_length(&self->ptr, self->prop);
- for (i=0; i<len; i++) {
+ int i, len = RNA_property_array_length(&self->ptr, self->prop);
+ for (i = 0; i < len; i++) {
CLAMP(bmo->data[i], min, max);
}
}
@@ -448,10 +448,10 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
}
/* Euler order exception */
- if (subtype==MATHUTILS_CB_SUBTYPE_EUL) {
- EulerObject *eul= (EulerObject *)bmo;
- PropertyRNA *prop_eul_order= NULL;
- short order= pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
+ if (subtype == MATHUTILS_CB_SUBTYPE_EUL) {
+ EulerObject *eul = (EulerObject *)bmo;
+ PropertyRNA *prop_eul_order = NULL;
+ short order = pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order);
if (order != eul->order) {
RNA_property_enum_set(&self->ptr, prop_eul_order, eul->order);
if (RNA_property_update_check(prop_eul_order)) {
@@ -464,24 +464,24 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
{
- BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+ BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
PYRNA_PROP_CHECK_INT(self);
- if (self->prop==NULL)
+ if (self->prop == NULL)
return -1;
- bmo->data[index]= RNA_property_float_get_index(&self->ptr, self->prop, index);
+ bmo->data[index] = RNA_property_float_get_index(&self->ptr, self->prop, index);
return 0;
}
static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
{
- BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+ BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
PYRNA_PROP_CHECK_INT(self);
- if (self->prop==NULL)
+ if (self->prop == NULL)
return -1;
#ifdef USE_PEDANTIC_WRITE
@@ -507,7 +507,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
return 0;
}
-static Mathutils_Callback mathutils_rna_array_cb= {
+static Mathutils_Callback mathutils_rna_array_cb = {
(BaseMathCheckFunc) mathutils_rna_generic_check,
(BaseMathGetFunc) mathutils_rna_vector_get,
(BaseMathSetFunc) mathutils_rna_vector_set,
@@ -517,15 +517,15 @@ static Mathutils_Callback mathutils_rna_array_cb= {
/* bpyrna matrix callbacks */
-static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
+static int mathutils_rna_matrix_cb_index = -1; /* index for our callbacks */
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
{
- BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+ BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
PYRNA_PROP_CHECK_INT(self);
- if (self->prop==NULL)
+ if (self->prop == NULL)
return -1;
RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
@@ -534,11 +534,11 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
{
- BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
+ BPy_PropertyRNA *self = (BPy_PropertyRNA *)bmo->cb_user;
PYRNA_PROP_CHECK_INT(self);
- if (self->prop==NULL)
+ if (self->prop == NULL)
return -1;
#ifdef USE_PEDANTIC_WRITE
@@ -563,7 +563,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
return 0;
}
-static Mathutils_Callback mathutils_rna_matrix_cb= {
+static Mathutils_Callback mathutils_rna_matrix_cb = {
mathutils_rna_generic_check,
mathutils_rna_matrix_get,
mathutils_rna_matrix_set,
@@ -574,11 +574,11 @@ static Mathutils_Callback mathutils_rna_matrix_cb= {
static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback)
{
/* attempt to get order */
- if (*prop_eul_order==NULL)
- *prop_eul_order= RNA_struct_find_property(ptr, "rotation_mode");
+ if (*prop_eul_order == NULL)
+ *prop_eul_order = RNA_struct_find_property(ptr, "rotation_mode");
if (*prop_eul_order) {
- short order= RNA_property_enum_get(ptr, *prop_eul_order);
+ short order = RNA_property_enum_get(ptr, *prop_eul_order);
if (order >= EULER_ORDER_XYZ && order <= EULER_ORDER_ZYX) /* could be quat or axisangle */
return order;
}
@@ -602,107 +602,107 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_
PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
{
- PyObject *ret= NULL;
+ PyObject *ret = NULL;
#ifdef USE_MATHUTILS
int subtype, totdim;
int len;
int is_thick;
- const int flag= RNA_property_flag(prop);
+ const int flag = RNA_property_flag(prop);
/* disallow dynamic sized arrays to be wrapped since the size could change
* to a size mathutils does not support */
if ((RNA_property_type(prop) != PROP_FLOAT) || (flag & PROP_DYNAMIC))
return NULL;
- len= RNA_property_array_length(ptr, prop);
- subtype= RNA_property_subtype(prop);
- totdim= RNA_property_array_dimension(ptr, prop, NULL);
- is_thick= (flag & PROP_THICK_WRAP);
+ len = RNA_property_array_length(ptr, prop);
+ subtype = RNA_property_subtype(prop);
+ totdim = RNA_property_array_dimension(ptr, prop, NULL);
+ is_thick = (flag & PROP_THICK_WRAP);
if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) {
if (!is_thick)
- ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
+ ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
- switch(subtype) {
+ switch (subtype) {
case PROP_ALL_VECTOR_SUBTYPES:
- if (len>=2 && len <= 4) {
+ if (len >= 2 && len <= 4) {
if (is_thick) {
- ret= Vector_CreatePyObject(NULL, len, Py_NEW, NULL);
+ ret = Vector_CreatePyObject(NULL, len, Py_NEW, NULL);
RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec);
}
else {
- PyObject *vec_cb= Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
+ PyObject *vec_cb = Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
Py_DECREF(ret); /* the vector owns now */
- ret= vec_cb; /* return the vector instead */
+ ret = vec_cb; /* return the vector instead */
}
}
break;
case PROP_MATRIX:
- if (len==16) {
+ if (len == 16) {
if (is_thick) {
- ret= Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL);
- RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr);
+ ret = Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL);
+ RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
}
else {
- PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
+ PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
Py_DECREF(ret); /* the matrix owns now */
- ret= mat_cb; /* return the matrix instead */
+ ret = mat_cb; /* return the matrix instead */
}
}
- else if (len==9) {
+ else if (len == 9) {
if (is_thick) {
- ret= Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL);
- RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr);
+ ret = Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL);
+ RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
}
else {
- PyObject *mat_cb= Matrix_CreatePyObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
+ PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
Py_DECREF(ret); /* the matrix owns now */
- ret= mat_cb; /* return the matrix instead */
+ ret = mat_cb; /* return the matrix instead */
}
}
break;
case PROP_EULER:
case PROP_QUATERNION:
- if (len==3) { /* euler */
+ if (len == 3) { /* euler */
if (is_thick) {
/* attempt to get order, only needed for thick types since wrapped with update via callbacks */
- PropertyRNA *prop_eul_order= NULL;
- short order= pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ);
+ PropertyRNA *prop_eul_order = NULL;
+ short order = pyrna_rotation_euler_order_get(ptr, &prop_eul_order, EULER_ORDER_XYZ);
- ret= Euler_CreatePyObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA
+ ret = Euler_CreatePyObject(NULL, order, Py_NEW, NULL); // TODO, get order from RNA
RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul);
}
else {
/* order will be updated from callback on use */
- PyObject *eul_cb= Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
+ PyObject *eul_cb = Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
Py_DECREF(ret); /* the euler owns now */
- ret= eul_cb; /* return the euler instead */
+ ret = eul_cb; /* return the euler instead */
}
}
- else if (len==4) {
+ else if (len == 4) {
if (is_thick) {
- ret= Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
+ ret = Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat);
}
else {
- PyObject *quat_cb= Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
+ PyObject *quat_cb = Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
Py_DECREF(ret); /* the quat owns now */
- ret= quat_cb; /* return the quat instead */
+ ret = quat_cb; /* return the quat instead */
}
}
break;
case PROP_COLOR:
case PROP_COLOR_GAMMA:
- if (len==3) { /* color */
+ if (len == 3) { /* color */
if (is_thick) {
- ret= Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
+ ret = Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col);
}
else {
- PyObject *col_cb= Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
+ PyObject *col_cb = Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
Py_DECREF(ret); /* the color owns now */
- ret= col_cb; /* return the color instead */
+ ret = col_cb; /* return the color instead */
}
}
default:
@@ -710,14 +710,14 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
}
}
- if (ret==NULL) {
+ if (ret == NULL) {
if (is_thick) {
/* this is an array we cant reference (since its not thin wrappable)
* and cannot be coerced into a mathutils type, so return as a list */
- ret= pyrna_prop_array_subscript_slice(NULL, ptr, prop, 0, len, len);
+ ret = pyrna_prop_array_subscript_slice(NULL, ptr, prop, 0, len, len);
}
else {
- ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
+ ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
}
}
#else // USE_MATHUTILS
@@ -732,7 +732,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix)
{
if (RNA_enum_value_from_id(item, identifier, value) == 0) {
- const char *enum_str= BPy_enum_as_string(item);
+ const char *enum_str = BPy_enum_as_string(item);
PyErr_Format(PyExc_TypeError,
"%s: '%.200s' not found in (%s)",
error_prefix, identifier, enum_str);
@@ -745,34 +745,34 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
{
- return (a->ptr.data==b->ptr.data) ? 0 : -1;
+ return (a->ptr.data == b->ptr.data) ? 0 : -1;
}
static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
{
- return (a->prop==b->prop && a->ptr.data==b->ptr.data) ? 0 : -1;
+ return (a->prop == b->prop && a->ptr.data == b->ptr.data) ? 0 : -1;
}
static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
{
PyObject *res;
- int ok= -1; /* zero is true */
+ int ok = -1; /* zero is true */
if (BPy_StructRNA_Check(a) && BPy_StructRNA_Check(b))
- ok= pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
+ ok = pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
switch (op) {
case Py_NE:
- ok= !ok; /* pass through */
+ ok = !ok; /* pass through */
case Py_EQ:
- res= ok ? Py_False : Py_True;
+ res = ok ? Py_False : Py_True;
break;
case Py_LT:
case Py_LE:
case Py_GT:
case Py_GE:
- res= Py_NotImplemented;
+ res = Py_NotImplemented;
break;
default:
PyErr_BadArgument();
@@ -785,23 +785,23 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
{
PyObject *res;
- int ok= -1; /* zero is true */
+ int ok = -1; /* zero is true */
if (BPy_PropertyRNA_Check(a) && BPy_PropertyRNA_Check(b))
- ok= pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
+ ok = pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
switch (op) {
case Py_NE:
- ok= !ok; /* pass through */
+ ok = !ok; /* pass through */
case Py_EQ:
- res= ok ? Py_False : Py_True;
+ res = ok ? Py_False : Py_True;
break;
case Py_LT:
case Py_LE:
case Py_GT:
case Py_GE:
- res= Py_NotImplemented;
+ res = Py_NotImplemented;
break;
default:
PyErr_BadArgument();
@@ -823,9 +823,9 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
}
/* print name if available */
- name= RNA_struct_name_get_alloc(&self->ptr, NULL, 0, NULL);
+ name = RNA_struct_name_get_alloc(&self->ptr, NULL, 0, NULL);
if (name) {
- ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
+ ret = PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
RNA_struct_identifier(self->ptr.type),
name);
MEM_freeN((void *)name);
@@ -839,32 +839,32 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
{
- ID *id= self->ptr.id.data;
+ ID *id = self->ptr.id.data;
PyObject *tmp_str;
PyObject *ret;
if (id == NULL || !PYRNA_STRUCT_IS_VALID(self))
return pyrna_struct_str(self); /* fallback */
- tmp_str= PyUnicode_FromString(id->name+2);
+ tmp_str = PyUnicode_FromString(id->name + 2);
if (RNA_struct_is_ID(self->ptr.type)) {
- ret= PyUnicode_FromFormat("bpy.data.%s[%R]",
+ ret = PyUnicode_FromFormat("bpy.data.%s[%R]",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str);
}
else {
const char *path;
- path= RNA_path_from_ID_to_struct(&self->ptr);
+ path = RNA_path_from_ID_to_struct(&self->ptr);
if (path) {
- ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+ ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str,
path);
MEM_freeN((void *)path);
}
else { /* cant find, print something sane */
- ret= PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
+ ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str,
RNA_struct_identifier(self->ptr.type));
@@ -881,30 +881,30 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
PyObject *ret;
PointerRNA ptr;
const char *name;
- const char *type_id= NULL;
- char type_fmt[64]= "";
+ const char *type_id = NULL;
+ char type_fmt[64] = "";
int type;
PYRNA_PROP_CHECK_OBJ(self);
- type= RNA_property_type(self->prop);
+ type = RNA_property_type(self->prop);
- if (RNA_enum_id_from_value(property_type_items, type, &type_id)==0) {
+ if (RNA_enum_id_from_value(property_type_items, type, &type_id) == 0) {
PyErr_SetString(PyExc_RuntimeError, "could not use property type, internal error"); /* should never happen */
return NULL;
}
else {
/* this should never fail */
- int len= -1;
- char *c= type_fmt;
+ int len = -1;
+ char *c = type_fmt;
while ((*c++= tolower(*type_id++))) {} ;
- if (type==PROP_COLLECTION) {
- len= pyrna_prop_collection_length(self);
+ if (type == PROP_COLLECTION) {
+ len = pyrna_prop_collection_length(self);
}
else if (RNA_property_array_check(self->prop)) {
- len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
+ len = pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
}
if (len != -1)
@@ -913,11 +913,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
/* if a pointer, try to print name of pointer target too */
if (type == PROP_POINTER) {
- ptr= RNA_property_pointer_get(&self->ptr, self->prop);
- name= RNA_struct_name_get_alloc(&ptr, NULL, 0, NULL);
+ ptr = RNA_property_pointer_get(&self->ptr, self->prop);
+ name = RNA_struct_name_get_alloc(&ptr, NULL, 0, NULL);
if (name) {
- ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
+ ret = PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
type_fmt,
RNA_struct_identifier(self->ptr.type),
RNA_property_identifier(self->prop),
@@ -943,7 +943,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
{
- ID *id= self->ptr.id.data;
+ ID *id = self->ptr.id.data;
PyObject *tmp_str;
PyObject *ret;
const char *path;
@@ -953,18 +953,18 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
if (id == NULL)
return pyrna_prop_str(self); /* fallback */
- tmp_str= PyUnicode_FromString(id->name+2);
+ tmp_str = PyUnicode_FromString(id->name + 2);
- path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
+ path = RNA_path_from_ID_to_property(&self->ptr, self->prop);
if (path) {
- ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+ ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str,
path);
MEM_freeN((void *)path);
}
else { /* cant find, print something sane */
- ret= PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
+ ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str,
RNA_property_identifier(self->prop));
@@ -995,18 +995,18 @@ static long pyrna_prop_hash(BPy_PropertyRNA *self)
{
long x, y;
if (self->ptr.data == NULL)
- x= 0;
+ x = 0;
else {
- x= _Py_HashPointer(self->ptr.data);
+ x = _Py_HashPointer(self->ptr.data);
if (x == -1)
return -1;
}
- y= _Py_HashPointer((void*)(self->prop));
+ y = _Py_HashPointer((void *)(self->prop));
if (y == -1)
return -1;
x ^= y;
if (x == -1)
- x= -2;
+ x = -2;
return x;
}
@@ -1031,7 +1031,7 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
if (self->freeptr && self->ptr.data) {
IDP_FreeProperty(self->ptr.data);
MEM_freeN(self->ptr.data);
- self->ptr.data= NULL;
+ self->ptr.data = NULL;
}
#endif /* PYRNA_FREE_SUPPORT */
@@ -1056,15 +1056,15 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
static void pyrna_struct_reference_set(BPy_StructRNA *self, PyObject *reference)
{
if (self->reference) {
-// PyObject_GC_UnTrack(self); /* INITIALIZED TRACKED? */
+// PyObject_GC_UnTrack(self); /* INITIALIZED TRACKED ? */
pyrna_struct_clear(self);
}
/* reference is now NULL */
if (reference) {
- self->reference= reference;
+ self->reference = reference;
Py_INCREF(reference);
-// PyObject_GC_Track(self); /* INITIALIZED TRACKED? */
+// PyObject_GC_Track(self); /* INITIALIZED TRACKED ? */
}
}
#endif /* !USE_PYRNA_STRUCT_REFERENCE */
@@ -1096,14 +1096,14 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
{
EnumPropertyItem *item;
const char *result;
- int free= FALSE;
+ int free = FALSE;
RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
if (item) {
- result= BPy_enum_as_string(item);
+ result = BPy_enum_as_string(item);
}
else {
- result= "";
+ result = "";
}
if (free)
@@ -1115,10 +1115,10 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *prop, int *val, const char *error_prefix)
{
- const char *param= _PyUnicode_AsString(item);
+ const char *param = _PyUnicode_AsString(item);
- if (param==NULL) {
- const char *enum_str= pyrna_enum_as_string(ptr, prop);
+ if (param == NULL) {
+ const char *enum_str = pyrna_enum_as_string(ptr, prop);
PyErr_Format(PyExc_TypeError,
"%.200s expected a string enum type in (%.200s)",
error_prefix, enum_str);
@@ -1131,7 +1131,7 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
if (!RNA_property_enum_value(BPy_GetContext(), ptr, prop, param, val)) {
- const char *enum_str= pyrna_enum_as_string(ptr, prop);
+ const char *enum_str = pyrna_enum_as_string(ptr, prop);
PyErr_Format(PyExc_TypeError,
"%.200s enum \"%.200s\" not found in (%.200s)",
error_prefix, param, enum_str);
@@ -1147,19 +1147,19 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
{
/* set of enum items, concatenate all values with OR */
- int ret, flag= 0;
+ int ret, flag = 0;
/* set looping */
- Py_ssize_t pos= 0;
- Py_ssize_t hash= 0;
+ Py_ssize_t pos = 0;
+ Py_ssize_t hash = 0;
PyObject *key;
- *r_value= 0;
+ *r_value = 0;
while (_PySet_NextEntry(value, &pos, &key, &hash)) {
- const char *param= _PyUnicode_AsString(key);
+ const char *param = _PyUnicode_AsString(key);
- if (param==NULL) {
+ if (param == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s expected a string, not %.200s",
error_prefix, Py_TYPE(key)->tp_name);
@@ -1173,7 +1173,7 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_
flag |= ret;
}
- *r_value= flag;
+ *r_value = flag;
return 0;
}
@@ -1181,9 +1181,9 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
{
EnumPropertyItem *item;
int ret;
- int free= FALSE;
+ int free = FALSE;
- *r_value= 0;
+ *r_value = 0;
if (!PyAnySet_Check(value)) {
PyErr_Format(PyExc_TypeError,
@@ -1196,17 +1196,17 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
if (item) {
- ret= pyrna_set_to_enum_bitfield(item, value, r_value, error_prefix);
+ ret = pyrna_set_to_enum_bitfield(item, value, r_value, error_prefix);
}
else {
if (PySet_GET_SIZE(value)) {
PyErr_Format(PyExc_TypeError,
"%.200s: empty enum \"%.200s\" could not have any values assigned",
error_prefix, RNA_property_identifier(prop));
- ret= -1;
+ ret = -1;
}
else {
- ret= 0;
+ ret = 0;
}
}
@@ -1218,14 +1218,14 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value)
{
- PyObject *ret= PySet_New(NULL);
+ PyObject *ret = PySet_New(NULL);
const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];
if (RNA_enum_bitflag_identifiers(items, value, identifier)) {
PyObject *item;
int index;
- for (index=0; identifier[index]; index++) {
- item= PyUnicode_FromString(identifier[index]);
+ for (index = 0; identifier[index]; index++) {
+ item = PyUnicode_FromString(identifier[index]);
PySet_Add(ret, item);
Py_DECREF(item);
}
@@ -1236,18 +1236,18 @@ PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value)
static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
{
- PyObject *item, *ret= NULL;
+ PyObject *item, *ret = NULL;
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];
- ret= PySet_New(NULL);
+ ret = PySet_New(NULL);
if (RNA_property_enum_bitflag_identifiers(BPy_GetContext(), ptr, prop, val, identifier)) {
int index;
- for (index=0; identifier[index]; index++) {
- item= PyUnicode_FromString(identifier[index]);
+ for (index = 0; identifier[index]; index++) {
+ item = PyUnicode_FromString(identifier[index]);
PySet_Add(ret, item);
Py_DECREF(item);
}
@@ -1257,20 +1257,20 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
else {
const char *identifier;
if (RNA_property_enum_identifier(BPy_GetContext(), ptr, prop, val, &identifier)) {
- ret= PyUnicode_FromString(identifier);
+ ret = PyUnicode_FromString(identifier);
}
else {
EnumPropertyItem *enum_item;
- int free= FALSE;
+ int free = FALSE;
/* don't throw error here, can't trust blender 100% to give the
* right values, python code should not generate error for that */
RNA_property_enum_items(BPy_GetContext(), ptr, prop, &enum_item, NULL, &free);
if (enum_item && enum_item->identifier) {
- ret= PyUnicode_FromString(enum_item->identifier);
+ ret = PyUnicode_FromString(enum_item->identifier);
}
else {
- const char *ptr_name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
+ const char *ptr_name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
/* prefer not fail silently incase of api errors, maybe disable it later */
printf("RNA Warning: Current value \"%d\" "
@@ -1292,7 +1292,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
if (ptr_name)
MEM_freeN((void *)ptr_name);
- ret= PyUnicode_FromString("");
+ ret = PyUnicode_FromString("");
}
if (free)
@@ -1300,7 +1300,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
/*
PyErr_Format(PyExc_AttributeError,
"RNA Error: Current value \"%d\" matches no enum", val);
- ret= NULL;
+ ret = NULL;
*/
}
}
@@ -1311,7 +1311,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
{
PyObject *ret;
- const int type= RNA_property_type(prop);
+ const int type = RNA_property_type(prop);
if (RNA_property_array_check(prop)) {
return pyrna_py_from_array(ptr, prop);
@@ -1320,39 +1320,39 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
/* see if we can coorce into a python type - PropertyType */
switch (type) {
case PROP_BOOLEAN:
- ret= PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
+ ret = PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
break;
case PROP_INT:
- ret= PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
+ ret = PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
break;
case PROP_FLOAT:
- ret= PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
+ ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
break;
case PROP_STRING:
{
- const int subtype= RNA_property_subtype(prop);
+ const int subtype = RNA_property_subtype(prop);
const char *buf;
int buf_len;
char buf_fixed[32];
- buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len);
+ buf = RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len);
#ifdef USE_STRING_COERCE
/* only file paths get special treatment, they may contain non utf-8 chars */
if (subtype == PROP_BYTESTRING) {
- ret= PyBytes_FromStringAndSize(buf, buf_len);
+ ret = PyBytes_FromStringAndSize(buf, buf_len);
}
else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
- ret= PyC_UnicodeFromByteAndSize(buf, buf_len);
+ ret = PyC_UnicodeFromByteAndSize(buf, buf_len);
}
else {
- ret= PyUnicode_FromStringAndSize(buf, buf_len);
+ ret = PyUnicode_FromStringAndSize(buf, buf_len);
}
#else // USE_STRING_COERCE
if (subtype == PROP_BYTESTRING) {
- ret= PyBytes_FromStringAndSize(buf, buf_len);
+ ret = PyBytes_FromStringAndSize(buf, buf_len);
}
else {
- ret= PyUnicode_FromStringAndSize(buf, buf_len);
+ ret = PyUnicode_FromStringAndSize(buf, buf_len);
}
#endif // USE_STRING_COERCE
if (buf_fixed != buf) {
@@ -1362,29 +1362,29 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
}
case PROP_ENUM:
{
- ret= pyrna_enum_to_py(ptr, prop, RNA_property_enum_get(ptr, prop));
+ ret = pyrna_enum_to_py(ptr, prop, RNA_property_enum_get(ptr, prop));
break;
}
case PROP_POINTER:
{
PointerRNA newptr;
- newptr= RNA_property_pointer_get(ptr, prop);
+ newptr = RNA_property_pointer_get(ptr, prop);
if (newptr.data) {
- ret= pyrna_struct_CreatePyObject(&newptr);
+ ret = pyrna_struct_CreatePyObject(&newptr);
}
else {
- ret= Py_None;
+ ret = Py_None;
Py_INCREF(ret);
}
break;
}
case PROP_COLLECTION:
- ret= pyrna_prop_CreatePyObject(ptr, prop);
+ ret = pyrna_prop_CreatePyObject(ptr, prop);
break;
default:
PyErr_Format(PyExc_TypeError,
"bpy_struct internal error: unknown type '%d' (pyrna_prop_to_py)", type);
- ret= NULL;
+ ret = NULL;
break;
}
@@ -1395,40 +1395,40 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
* Its takes keyword args and fills them with property values */
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix)
{
- int error_val= 0;
+ int error_val = 0;
int totkw;
- const char *arg_name= NULL;
+ const char *arg_name = NULL;
PyObject *item;
- totkw= kw ? PyDict_Size(kw):0;
+ totkw = kw ? PyDict_Size(kw):0;
RNA_STRUCT_BEGIN(ptr, prop) {
- arg_name= RNA_property_identifier(prop);
+ arg_name = RNA_property_identifier(prop);
- if (strcmp(arg_name, "rna_type")==0) continue;
+ if (strcmp(arg_name, "rna_type") == 0) continue;
- if (kw==NULL) {
+ if (kw == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s: no keywords, expected \"%.200s\"",
error_prefix, arg_name ? arg_name : "<UNKNOWN>");
- error_val= -1;
+ error_val = -1;
break;
}
- item= PyDict_GetItemString(kw, arg_name); /* wont set an error */
+ item = PyDict_GetItemString(kw, arg_name); /* wont set an error */
if (item == NULL) {
if (all_args) {
PyErr_Format(PyExc_TypeError,
"%.200s: keyword \"%.200s\" missing",
error_prefix, arg_name ? arg_name : "<UNKNOWN>");
- error_val= -1; /* pyrna_py_to_prop sets the error */
+ error_val = -1; /* pyrna_py_to_prop sets the error */
break;
}
}
else {
if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) {
- error_val= -1;
+ error_val = -1;
break;
}
totkw--;
@@ -1436,20 +1436,20 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
}
RNA_STRUCT_END;
- if (error_val==0 && totkw > 0) { /* some keywords were given that were not used :/ */
+ if (error_val == 0 && totkw > 0) { /* some keywords were given that were not used :/ */
PyObject *key, *value;
- Py_ssize_t pos= 0;
+ Py_ssize_t pos = 0;
while (PyDict_Next(kw, &pos, &key, &value)) {
- arg_name= _PyUnicode_AsString(key);
+ arg_name = _PyUnicode_AsString(key);
if (RNA_struct_find_property(ptr, arg_name) == NULL) break;
- arg_name= NULL;
+ arg_name = NULL;
}
PyErr_Format(PyExc_TypeError,
"%.200s: keyword \"%.200s\" unrecognized",
error_prefix, arg_name ? arg_name : "<UNKNOWN>");
- error_val= -1;
+ error_val = -1;
}
return error_val;
@@ -1458,9 +1458,9 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
static PyObject *pyrna_func_to_py(PointerRNA *ptr, FunctionRNA *func)
{
- BPy_FunctionRNA* pyfunc= (BPy_FunctionRNA *) PyObject_NEW(BPy_FunctionRNA, &pyrna_func_Type);
- pyfunc->ptr= *ptr;
- pyfunc->func= func;
+ BPy_FunctionRNA* pyfunc = (BPy_FunctionRNA *) PyObject_NEW(BPy_FunctionRNA, &pyrna_func_Type);
+ pyfunc->ptr = *ptr;
+ pyfunc->func = func;
return (PyObject *)pyfunc;
}
@@ -1468,7 +1468,7 @@ static PyObject *pyrna_func_to_py(PointerRNA *ptr, FunctionRNA *func)
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix)
{
/* XXX hard limits should be checked here */
- const int type= RNA_property_type(prop);
+ const int type = RNA_property_type(prop);
if (RNA_property_array_check(prop)) {
@@ -1489,9 +1489,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
* however so many poll functions return None or a valid Object.
* its a hassle to convert these into a bool before returning, */
if (RNA_property_flag(prop) & PROP_OUTPUT)
- param= PyObject_IsTrue(value);
+ param = PyObject_IsTrue(value);
else
- param= PyLong_AsLong(value);
+ param = PyLong_AsLong(value);
if (param < 0) {
PyErr_Format(PyExc_TypeError,
@@ -1501,7 +1501,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
else {
- if (data) *((int*)data)= param;
+ if (data) *((int *)data)= param;
else RNA_property_boolean_set(ptr, prop, param);
}
break;
@@ -1509,7 +1509,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
case PROP_INT:
{
int overflow;
- long param= PyLong_AsLongAndOverflow(value, &overflow);
+ long param = PyLong_AsLongAndOverflow(value, &overflow);
if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
PyErr_Format(PyExc_ValueError,
"%.200s %.200s.%.200s value not in 'int' range "
@@ -1518,7 +1518,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
RNA_property_identifier(prop));
return -1;
}
- else if (param==-1 && PyErr_Occurred()) {
+ else if (param == -1 && PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s expected an int type, not %.200s",
error_prefix, RNA_struct_identifier(ptr->type),
@@ -1526,16 +1526,16 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
else {
- int param_i= (int)param;
+ int param_i = (int)param;
RNA_property_int_clamp(ptr, prop, &param_i);
- if (data) *((int*)data)= param_i;
+ if (data) *((int *)data)= param_i;
else RNA_property_int_set(ptr, prop, param_i);
}
break;
}
case PROP_FLOAT:
{
- float param= PyFloat_AsDouble(value);
+ float param = PyFloat_AsDouble(value);
if (PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s expected a float type, not %.200s",
@@ -1545,23 +1545,23 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
RNA_property_float_clamp(ptr, prop, (float *)&param);
- if (data) *((float*)data)= param;
+ if (data) *((float *)data)= param;
else RNA_property_float_set(ptr, prop, param);
}
break;
}
case PROP_STRING:
{
- const int subtype= RNA_property_subtype(prop);
+ const int subtype = RNA_property_subtype(prop);
const char *param;
if (subtype == PROP_BYTESTRING) {
/* Byte String */
- param= PyBytes_AsString(value);
+ param = PyBytes_AsString(value);
- if (param==NULL) {
+ if (param == NULL) {
if (PyBytes_Check(value)) {
/* there was an error assigning a string type,
* rather than setting a new error, prefix the existing one
@@ -1582,7 +1582,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
/* same as unicode */
- if (data) *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
+ if (data) *((char **)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
else RNA_property_string_set(ptr, prop, param);
}
}
@@ -1591,25 +1591,25 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
/* Unicode String */
#ifdef USE_STRING_COERCE
- PyObject *value_coerce= NULL;
+ PyObject *value_coerce = NULL;
if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
/* TODO, get size */
- param= PyC_UnicodeAsByte(value, &value_coerce);
+ param = PyC_UnicodeAsByte(value, &value_coerce);
}
else {
- param= _PyUnicode_AsString(value);
+ param = _PyUnicode_AsString(value);
#ifdef WITH_INTERNATIONAL
if (subtype == PROP_TRANSLATE) {
- param= IFACE_(param);
+ param = IFACE_(param);
}
#endif // WITH_INTERNATIONAL
}
#else // USE_STRING_COERCE
- param= _PyUnicode_AsString(value);
+ param = _PyUnicode_AsString(value);
#endif // USE_STRING_COERCE
- if (param==NULL) {
+ if (param == NULL) {
if (PyUnicode_Check(value)) {
/* there was an error assigning a string type,
* rather than setting a new error, prefix the existing one
@@ -1630,7 +1630,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
/* same as bytes */
- if (data) *((char**)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
+ if (data) *((char **)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
else RNA_property_string_set(ptr, prop, param);
}
#ifdef USE_STRING_COERCE
@@ -1641,7 +1641,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
case PROP_ENUM:
{
- int val= 0;
+ int val = 0;
/* type checkins is done by each function */
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
@@ -1657,17 +1657,17 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
}
- if (data) *((int*)data)= val;
+ if (data) *((int *)data)= val;
else RNA_property_enum_set(ptr, prop, val);
break;
}
case PROP_POINTER:
{
- PyObject *value_new= NULL;
+ PyObject *value_new = NULL;
- StructRNA *ptr_type= RNA_property_pointer_type(ptr, prop);
- int flag= RNA_property_flag(prop);
+ StructRNA *ptr_type = RNA_property_pointer_type(ptr, prop);
+ int flag = RNA_property_flag(prop);
/* this is really nasty!, so we can fake the operator having direct properties eg:
* layout.prop(self, "filepath")
@@ -1675,7 +1675,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
* layout.prop(self.properties, "filepath")
*
* we need to do this trick.
- * if the prop is not an operator type and the pyobject is an operator, use its properties in place of its self.
+ * if the prop is not an operator type and the pyobject is an operator,
+ * use its properties in place of its self.
*
* this is so bad that its almost a good reason to do away with fake 'self.properties -> self' class mixing
* if this causes problems in the future it should be removed.
@@ -1684,24 +1685,25 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
(BPy_StructRNA_Check(value)) &&
(RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator))
) {
- value= PyObject_GetAttrString(value, "properties");
- value_new= value;
+ value = PyObject_GetAttrString(value, "properties");
+ value_new = value;
}
- /* if property is an OperatorProperties pointer and value is a map, forward back to pyrna_pydict_to_props */
+ /* if property is an OperatorProperties pointer and value is a map,
+ * forward back to pyrna_pydict_to_props */
if (RNA_struct_is_a(ptr_type, &RNA_OperatorProperties) && PyDict_Check(value)) {
- PointerRNA opptr= RNA_property_pointer_get(ptr, prop);
+ PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
return pyrna_pydict_to_props(&opptr, value, 0, error_prefix);
}
/* another exception, allow to pass a collection as an RNA property */
- if (Py_TYPE(value)==&pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
+ if (Py_TYPE(value) == &pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
PointerRNA c_ptr;
- BPy_PropertyRNA *value_prop= (BPy_PropertyRNA *)value;
+ BPy_PropertyRNA *value_prop = (BPy_PropertyRNA *)value;
if (RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
- value= pyrna_struct_CreatePyObject(&c_ptr);
- value_new= value;
+ value = pyrna_struct_CreatePyObject(&c_ptr);
+ value_new = value;
}
else {
PyErr_Format(PyExc_TypeError,
@@ -1728,7 +1730,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
RNA_property_identifier(prop), RNA_struct_identifier(ptr_type));
Py_XDECREF(value_new); return -1;
}
- else if (value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) {
+ else if ((value != Py_None) &&
+ ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA *)value)->ptr.id.data))
+ {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s ID type does not support assignment to its self",
error_prefix, RNA_struct_identifier(ptr->type),
@@ -1736,30 +1740,30 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
Py_XDECREF(value_new); return -1;
}
else {
- BPy_StructRNA *param= (BPy_StructRNA*)value;
- int raise_error= FALSE;
+ BPy_StructRNA *param = (BPy_StructRNA *)value;
+ int raise_error = FALSE;
if (data) {
if (flag & PROP_RNAPTR) {
if (value == Py_None)
memset(data, 0, sizeof(PointerRNA));
else
- *((PointerRNA*)data)= param->ptr;
+ *((PointerRNA *)data)= param->ptr;
}
else if (value == Py_None) {
- *((void**)data)= NULL;
+ *((void **)data)= NULL;
}
else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
- *((void**)data)= param->ptr.data;
+ *((void **)data)= param->ptr.data;
}
else {
- raise_error= TRUE;
+ raise_error = TRUE;
}
}
else {
- /* data==NULL, assign to RNA */
+ /* data == NULL, assign to RNA */
if (value == Py_None) {
- PointerRNA valueptr= {{NULL}};
+ PointerRNA valueptr = {{NULL}};
RNA_property_pointer_set(ptr, prop, valueptr);
}
else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
@@ -1801,7 +1805,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
ListBase *lb;
CollectionPointerLink *link;
- lb= (data)? (ListBase*)data: NULL;
+ lb = (data) ? (ListBase *)data : NULL;
/* convert a sequence of dict's into a collection */
if (!PySequence_Check(value)) {
@@ -1812,11 +1816,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
- seq_len= PySequence_Size(value);
- for (i=0; i < seq_len; i++) {
- item= PySequence_GetItem(value, i);
+ seq_len = PySequence_Size(value);
+ for (i = 0; i < seq_len; i++) {
+ item = PySequence_GetItem(value, i);
- if (item==NULL) {
+ if (item == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection",
error_prefix, RNA_struct_identifier(ptr->type),
@@ -1825,7 +1829,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
- if (PyDict_Check(item)==0) {
+ if (PyDict_Check(item) == 0) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s expected a each sequence "
"member to be a dict for an RNA collection, not %.200s",
@@ -1836,16 +1840,16 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
if (lb) {
- link= MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink");
- link->ptr= itemptr;
+ link = MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink");
+ link->ptr = itemptr;
BLI_addtail(lb, link);
}
else
RNA_property_collection_add(ptr, prop, &itemptr);
- if (pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection")==-1) {
- PyObject *msg= PyC_ExceptionBuffer();
- const char *msg_char= _PyUnicode_AsString(msg);
+ if (pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection") == -1) {
+ PyObject *msg = PyC_ExceptionBuffer();
+ const char *msg_char = _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s error converting a member of a collection "
@@ -1888,17 +1892,17 @@ static PyObject *pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int in
static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, PyObject *value)
{
- int ret= 0;
- PointerRNA *ptr= &self->ptr;
- PropertyRNA *prop= self->prop;
+ int ret = 0;
+ PointerRNA *ptr = &self->ptr;
+ PropertyRNA *prop = self->prop;
- const int totdim= RNA_property_array_dimension(ptr, prop, NULL);
+ const int totdim = RNA_property_array_dimension(ptr, prop, NULL);
if (totdim > 1) {
/* char error_str[512]; */
if (pyrna_py_to_array_index(&self->ptr, self->prop, self->arraydim, self->arrayoffset, index, value, "") == -1) {
/* error is set */
- ret= -1;
+ ret = -1;
}
}
else {
@@ -1906,11 +1910,11 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
{
- int param= PyLong_AsLong(value);
+ int param = PyLong_AsLong(value);
if (param < 0 || param > 1) {
PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1");
- ret= -1;
+ ret = -1;
}
else {
RNA_property_boolean_set_index(ptr, prop, index, param);
@@ -1919,10 +1923,10 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
}
case PROP_INT:
{
- int param= PyLong_AsLong(value);
- if (param==-1 && PyErr_Occurred()) {
+ int param = PyLong_AsLong(value);
+ if (param == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
- ret= -1;
+ ret = -1;
}
else {
RNA_property_int_clamp(ptr, prop, &param);
@@ -1932,10 +1936,10 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
}
case PROP_FLOAT:
{
- float param= PyFloat_AsDouble(value);
+ float param = PyFloat_AsDouble(value);
if (PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected a float type");
- ret= -1;
+ ret = -1;
}
else {
RNA_property_float_clamp(ptr, prop, &param);
@@ -1945,7 +1949,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
}
default:
PyErr_SetString(PyExc_AttributeError, "not an array type");
- ret= -1;
+ ret = -1;
break;
}
}
@@ -1994,7 +1998,7 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
PYRNA_PROP_CHECK_INT(self);
RNA_property_collection_begin(&self->ptr, self->prop, &iter);
- test= iter.valid;
+ test = iter.valid;
RNA_property_collection_end(&iter);
return test;
}
@@ -2018,7 +2022,7 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
{
PointerRNA newptr;
- Py_ssize_t keynum_abs= keynum;
+ Py_ssize_t keynum_abs = keynum;
PYRNA_PROP_CHECK_OBJ(self);
@@ -2028,7 +2032,7 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
return pyrna_struct_CreatePyObject(&newptr);
}
else {
- const int len= RNA_property_collection_length(&self->ptr, self->prop);
+ const int len = RNA_property_collection_length(&self->ptr, self->prop);
if (keynum_abs >= len) {
PyErr_Format(PyExc_IndexError,
"bpy_prop_collection[index]: "
@@ -2048,15 +2052,15 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
/* values type must have been already checked */
static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum, PyObject *value)
{
- Py_ssize_t keynum_abs= keynum;
- const PointerRNA *ptr= (value == Py_None) ? (&PointerRNA_NULL) : &((BPy_StructRNA *)value)->ptr;
+ Py_ssize_t keynum_abs = keynum;
+ const PointerRNA *ptr = (value == Py_None) ? (&PointerRNA_NULL) : &((BPy_StructRNA *)value)->ptr;
PYRNA_PROP_CHECK_INT(self);
PYRNA_PROP_COLLECTION_ABS_INDEX(-1);
if (RNA_property_collection_assign_int(&self->ptr, self->prop, keynum_abs, ptr) == 0) {
- const int len= RNA_property_collection_length(&self->ptr, self->prop);
+ const int len = RNA_property_collection_length(&self->ptr, self->prop);
if (keynum_abs >= len) {
PyErr_Format(PyExc_IndexError,
"bpy_prop_collection[index] = value: "
@@ -2080,7 +2084,7 @@ static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int
PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
- len= pyrna_prop_array_length(self);
+ len = pyrna_prop_array_length(self);
if (keynum < 0) keynum += len;
@@ -2135,24 +2139,24 @@ int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyOb
err_prefix, RNA_struct_identifier(self->ptr.type));
return -1;
}
- else if ((keyname= _PyUnicode_AsString(PyTuple_GET_ITEM(key, 0))) == NULL) {
+ else if ((keyname = _PyUnicode_AsString(PyTuple_GET_ITEM(key, 0))) == NULL) {
PyErr_Format(PyExc_KeyError,
"%s: id must be a string, not %.200s",
err_prefix, Py_TYPE(PyTuple_GET_ITEM(key, 0))->tp_name);
return -1;
}
else {
- PyObject *keylib= PyTuple_GET_ITEM(key, 1);
+ PyObject *keylib = PyTuple_GET_ITEM(key, 1);
Library *lib;
- int found= FALSE;
+ int found = FALSE;
if (keylib == Py_None) {
- lib= NULL;
+ lib = NULL;
}
else if (PyUnicode_Check(keylib)) {
- Main *bmain= self->ptr.data;
- const char *keylib_str= _PyUnicode_AsString(keylib);
- lib= BLI_findstring(&bmain->library, keylib_str, offsetof(Library, name));
+ Main *bmain = self->ptr.data;
+ const char *keylib_str = _PyUnicode_AsString(keylib);
+ lib = BLI_findstring(&bmain->library, keylib_str, offsetof(Library, name));
if (lib == NULL) {
if (err_not_found) {
PyErr_Format(PyExc_KeyError,
@@ -2178,11 +2182,11 @@ int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyOb
* either way can do direct comparison with id.lib */
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
- ID *id= itemptr.data; /* always an ID */
- if (id->lib == lib && (strncmp(keyname, id->name+2, sizeof(id->name)-2) == 0)) {
- found= TRUE;
+ ID *id = itemptr.data; /* always an ID */
+ if (id->lib == lib && (strncmp(keyname, id->name + 2, sizeof(id->name) - 2) == 0)) {
+ found = TRUE;
if (r_ptr) {
- *r_ptr= itemptr;
+ *r_ptr = itemptr;
}
break;
}
@@ -2206,7 +2210,7 @@ static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *s
const char *err_prefix, const short err_not_found)
{
PointerRNA ptr;
- const int contains= pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key, err_prefix, err_not_found, &ptr);
+ const int contains = pyrna_prop_collection_subscript_str_lib_pair_ptr(self, key, err_prefix, err_not_found, &ptr);
if (contains == 1) {
return pyrna_struct_CreatePyObject(&ptr);
@@ -2220,21 +2224,21 @@ static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *s
static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py_ssize_t start, Py_ssize_t stop)
{
CollectionPropertyIterator rna_macro_iter;
- int count= 0;
+ int count = 0;
PyObject *list;
PyObject *item;
PYRNA_PROP_CHECK_OBJ(self);
- list= PyList_New(0);
+ list = PyList_New(0);
/* first loop up-until the start */
for (RNA_property_collection_begin(&self->ptr, self->prop, &rna_macro_iter);
rna_macro_iter.valid;
RNA_property_collection_next(&rna_macro_iter))
{
- /* PointerRNA itemptr= rna_macro_iter.ptr; */
+ /* PointerRNA itemptr = rna_macro_iter.ptr; */
if (count == start) {
break;
}
@@ -2245,7 +2249,7 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py
for (; rna_macro_iter.valid;
RNA_property_collection_next(&rna_macro_iter))
{
- item= pyrna_struct_CreatePyObject(&rna_macro_iter.ptr);
+ item = pyrna_struct_CreatePyObject(&rna_macro_iter.ptr);
PyList_Append(list, item);
Py_DECREF(item);
@@ -2272,14 +2276,14 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
- tuple= PyTuple_New(stop - start);
+ tuple = PyTuple_New(stop - start);
/* PYRNA_PROP_CHECK_OBJ(self); isn't needed, internal use only */
- totdim= RNA_property_array_dimension(ptr, prop, NULL);
+ totdim = RNA_property_array_dimension(ptr, prop, NULL);
if (totdim > 1) {
- for (count= start; count < stop; count++)
+ for (count = start; count < stop; count++)
PyTuple_SET_ITEM(tuple, count - start, pyrna_prop_array_to_py_index(self, count));
}
else {
@@ -2288,11 +2292,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
{
float values_stack[PYRNA_STACK_ARRAY];
float *values;
- if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(float) * length); }
- else { values= values_stack; }
+ if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(float) * length); }
+ else { values = values_stack; }
RNA_property_float_get_array(ptr, prop, values);
- for (count=start; count<stop; count++)
+ for (count = start; count < stop; count++)
PyTuple_SET_ITEM(tuple, count-start, PyFloat_FromDouble(values[count]));
if (values != values_stack) {
@@ -2304,11 +2308,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
{
int values_stack[PYRNA_STACK_ARRAY];
int *values;
- if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); }
- else { values= values_stack; }
+ if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); }
+ else { values = values_stack; }
RNA_property_boolean_get_array(ptr, prop, values);
- for (count=start; count<stop; count++)
+ for (count = start; count < stop; count++)
PyTuple_SET_ITEM(tuple, count-start, PyBool_FromLong(values[count]));
if (values != values_stack) {
@@ -2320,11 +2324,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
{
int values_stack[PYRNA_STACK_ARRAY];
int *values;
- if (length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(int) * length); }
- else { values= values_stack; }
+ if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); }
+ else { values = values_stack; }
RNA_property_int_get_array(ptr, prop, values);
- for (count=start; count<stop; count++)
+ for (count = start; count < stop; count++)
PyTuple_SET_ITEM(tuple, count-start, PyLong_FromSsize_t(values[count]));
if (values != values_stack) {
@@ -2337,7 +2341,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
PyErr_SetString(PyExc_TypeError, "not an array type");
Py_DECREF(tuple);
- tuple= NULL;
+ tuple = NULL;
}
}
return tuple;
@@ -2351,15 +2355,15 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
return pyrna_prop_collection_subscript_str(self, _PyUnicode_AsString(key));
}
else if (PyIndex_Check(key)) {
- Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError);
+ Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return NULL;
return pyrna_prop_collection_subscript_int(self, i);
}
else if (PySlice_Check(key)) {
- PySliceObject *key_slice= (PySliceObject *)key;
- Py_ssize_t step= 1;
+ PySliceObject *key_slice = (PySliceObject *)key;
+ Py_ssize_t step = 1;
if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
return NULL;
@@ -2372,7 +2376,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
}
else {
- Py_ssize_t start= 0, stop= PY_SSIZE_T_MAX;
+ Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
@@ -2380,7 +2384,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
if (start < 0 || stop < 0) {
/* only get the length for negative values */
- Py_ssize_t len= (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
+ Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
if (start < 0) start += len;
if (stop < 0) start += len;
}
@@ -2431,8 +2435,8 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val
Py_TYPE(value)->tp_name);
return -1;
}
- else if ((prop_srna= RNA_property_pointer_type(&self->ptr, self->prop))) {
- StructRNA *value_srna= ((BPy_StructRNA *)value)->ptr.type;
+ else if ((prop_srna = RNA_property_pointer_type(&self->ptr, self->prop))) {
+ StructRNA *value_srna = ((BPy_StructRNA *)value)->ptr.type;
if (RNA_struct_is_a(value_srna, prop_srna) == 0) {
PyErr_Format(PyExc_TypeError,
"bpy_prop_collection[key] = value: invalid, "
@@ -2476,7 +2480,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
else
#endif
if (PyIndex_Check(key)) {
- Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError);
+ Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return -1;
@@ -2484,8 +2488,8 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
}
#if 0 /* TODO, fake slice assignment */
else if (PySlice_Check(key)) {
- PySliceObject *key_slice= (PySliceObject *)key;
- Py_ssize_t step= 1;
+ PySliceObject *key_slice = (PySliceObject *)key;
+ Py_ssize_t step = 1;
if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
return NULL;
@@ -2498,7 +2502,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
}
else {
- Py_ssize_t start= 0, stop= PY_SSIZE_T_MAX;
+ Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
@@ -2506,7 +2510,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
if (start < 0 || stop < 0) {
/* only get the length for negative values */
- Py_ssize_t len= (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
+ Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
if (start < 0) start += len;
if (stop < 0) start += len;
}
@@ -2538,14 +2542,14 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
}
else */
if (PyIndex_Check(key)) {
- Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError);
+ Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return NULL;
return pyrna_prop_array_subscript_int(self, PyLong_AsLong(key));
}
else if (PySlice_Check(key)) {
- Py_ssize_t step= 1;
- PySliceObject *key_slice= (PySliceObject *)key;
+ Py_ssize_t step = 1;
+ PySliceObject *key_slice = (PySliceObject *)key;
if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
return NULL;
@@ -2556,11 +2560,11 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
}
else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
/* note, no significant advantage with optimizing [:] slice as with collections but include here for consistency with collection slice func */
- Py_ssize_t len= (Py_ssize_t)pyrna_prop_array_length(self);
+ Py_ssize_t len = (Py_ssize_t)pyrna_prop_array_length(self);
return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
}
else {
- int len= pyrna_prop_array_length(self);
+ int len = pyrna_prop_array_length(self);
Py_ssize_t start, stop, slicelength;
if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0)
@@ -2586,23 +2590,23 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
{
PyObject *value;
int count;
- void *values_alloc= NULL;
- int ret= 0;
+ void *values_alloc = NULL;
+ int ret = 0;
if (value_orig == NULL) {
PyErr_SetString(PyExc_TypeError,
- "bpy_prop_array[slice]= value: deleting with list types is not supported by bpy_struct");
+ "bpy_prop_array[slice] = value: deleting with list types is not supported by bpy_struct");
return -1;
}
- if (!(value=PySequence_Fast(value_orig, "bpy_prop_array[slice]= value: assignment is not a sequence type"))) {
+ if (!(value = PySequence_Fast(value_orig, "bpy_prop_array[slice] = value: assignment is not a sequence type"))) {
return -1;
}
if (PySequence_Fast_GET_SIZE(value) != stop-start) {
Py_DECREF(value);
PyErr_SetString(PyExc_TypeError,
- "bpy_prop_array[slice]= value: resizing bpy_struct arrays isn't supported");
+ "bpy_prop_array[slice] = value: resizing bpy_struct arrays isn't supported");
return -1;
}
@@ -2615,18 +2619,18 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
float min, max;
RNA_property_float_range(ptr, prop, &min, &max);
- if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(float) * length); }
- else { values= values_stack; }
+ if (length > PYRNA_STACK_ARRAY) { values = values_alloc = PyMem_MALLOC(sizeof(float) * length); }
+ else { values = values_stack; }
if (start != 0 || stop != length) /* partial assignment? - need to get the array */
RNA_property_float_get_array(ptr, prop, values);
- for (count=start; count<stop; count++) {
- fval= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start));
+ for (count = start; count < stop; count++) {
+ fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start));
CLAMP(fval, min, max);
- values[count]= fval;
+ values[count] = fval;
}
- if (PyErr_Occurred()) ret= -1;
+ if (PyErr_Occurred()) ret = -1;
else RNA_property_float_set_array(ptr, prop, values);
break;
}
@@ -2634,16 +2638,16 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
{
int values_stack[PYRNA_STACK_ARRAY];
int *values;
- if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); }
- else { values= values_stack; }
+ if (length > PYRNA_STACK_ARRAY) { values = values_alloc = PyMem_MALLOC(sizeof(int) * length); }
+ else { values = values_stack; }
if (start != 0 || stop != length) /* partial assignment? - need to get the array */
RNA_property_boolean_get_array(ptr, prop, values);
- for (count=start; count<stop; count++)
- values[count]= PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+ for (count = start; count < stop; count++)
+ values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
- if (PyErr_Occurred()) ret= -1;
+ if (PyErr_Occurred()) ret = -1;
else RNA_property_boolean_set_array(ptr, prop, values);
break;
}
@@ -2655,25 +2659,25 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
int min, max;
RNA_property_int_range(ptr, prop, &min, &max);
- if (length > PYRNA_STACK_ARRAY) { values= values_alloc= PyMem_MALLOC(sizeof(int) * length); }
- else { values= values_stack; }
+ if (length > PYRNA_STACK_ARRAY) { values = values_alloc = PyMem_MALLOC(sizeof(int) * length); }
+ else { values = values_stack; }
if (start != 0 || stop != length) /* partial assignment? - need to get the array */
RNA_property_int_get_array(ptr, prop, values);
- for (count=start; count<stop; count++) {
- ival= PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+ for (count = start; count < stop; count++) {
+ ival = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
CLAMP(ival, min, max);
- values[count]= ival;
+ values[count] = ival;
}
- if (PyErr_Occurred()) ret= -1;
+ if (PyErr_Occurred()) ret = -1;
else RNA_property_int_set_array(ptr, prop, values);
break;
}
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
- ret= -1;
+ ret = -1;
}
Py_DECREF(value);
@@ -2692,7 +2696,7 @@ static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t k
PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self);
- len= pyrna_prop_array_length(self);
+ len = pyrna_prop_array_length(self);
if (keynum < 0) keynum += len;
@@ -2706,8 +2710,8 @@ static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t k
static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *key, PyObject *value)
{
- /* char *keyname= NULL; */ /* not supported yet */
- int ret= -1;
+ /* char *keyname = NULL; */ /* not supported yet */
+ int ret = -1;
PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self);
@@ -2715,39 +2719,39 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
PyErr_Format(PyExc_AttributeError,
"bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only",
RNA_property_identifier(self->prop), RNA_struct_identifier(self->ptr.type));
- ret= -1;
+ ret = -1;
}
else if (PyIndex_Check(key)) {
- Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError);
+ Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred()) {
- ret= -1;
+ ret = -1;
}
else {
- ret= prop_subscript_ass_array_int(self, i, value);
+ ret = prop_subscript_ass_array_int(self, i, value);
}
}
else if (PySlice_Check(key)) {
- int len= RNA_property_array_length(&self->ptr, self->prop);
+ int len = RNA_property_array_length(&self->ptr, self->prop);
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0) {
- ret= -1;
+ ret = -1;
}
else if (slicelength <= 0) {
- ret= 0; /* do nothing */
+ ret = 0; /* do nothing */
}
else if (step == 1) {
- ret= prop_subscript_ass_array_slice(&self->ptr, self->prop, start, stop, len, value);
+ ret = prop_subscript_ass_array_slice(&self->ptr, self->prop, start, stop, len, value);
}
else {
PyErr_SetString(PyExc_TypeError, "slice steps not supported with rna");
- ret= -1;
+ ret = -1;
}
}
else {
PyErr_SetString(PyExc_AttributeError, "invalid key, key must be an int");
- ret= -1;
+ ret = -1;
}
if (ret != -1) {
@@ -2760,20 +2764,20 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
}
/* for slice only */
-static PyMappingMethods pyrna_prop_array_as_mapping= {
+static PyMappingMethods pyrna_prop_array_as_mapping = {
(lenfunc) pyrna_prop_array_length, /* mp_length */
(binaryfunc) pyrna_prop_array_subscript, /* mp_subscript */
(objobjargproc) pyrna_prop_array_ass_subscript, /* mp_ass_subscript */
};
-static PyMappingMethods pyrna_prop_collection_as_mapping= {
+static PyMappingMethods pyrna_prop_collection_as_mapping = {
(lenfunc) pyrna_prop_collection_length, /* mp_length */
(binaryfunc) pyrna_prop_collection_subscript, /* mp_subscript */
(objobjargproc) pyrna_prop_collection_ass_subscript, /* mp_ass_subscript */
};
/* only for fast bool's, large structs, assign nb_bool on init */
-static PyNumberMethods pyrna_prop_array_as_number= {
+static PyNumberMethods pyrna_prop_array_as_number = {
NULL, /* nb_add */
NULL, /* nb_subtract */
NULL, /* nb_multiply */
@@ -2785,7 +2789,7 @@ static PyNumberMethods pyrna_prop_array_as_number= {
NULL, /* nb_absolute */
(inquiry) pyrna_prop_array_bool, /* nb_bool */
};
-static PyNumberMethods pyrna_prop_collection_as_number= {
+static PyNumberMethods pyrna_prop_collection_as_number = {
NULL, /* nb_add */
NULL, /* nb_subtract */
NULL, /* nb_multiply */
@@ -2815,9 +2819,9 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
else {
/* key in dict style check */
- const char *keyname= _PyUnicode_AsString(key);
+ const char *keyname = _PyUnicode_AsString(key);
- if (keyname==NULL) {
+ if (keyname == NULL) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.__contains__: expected a string or a typle of strings");
return -1;
}
@@ -2832,7 +2836,7 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
{
IDProperty *group;
- const char *name= _PyUnicode_AsString(value);
+ const char *name = _PyUnicode_AsString(value);
PYRNA_STRUCT_CHECK_INT(self);
@@ -2841,12 +2845,12 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
return -1;
}
- if (RNA_struct_idprops_check(self->ptr.type)==0) {
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
PyErr_SetString(PyExc_TypeError, "bpy_struct: this type doesn't support IDProperties");
return -1;
}
- group= RNA_struct_idprops(&self->ptr, 0);
+ group = RNA_struct_idprops(&self->ptr, 0);
if (!group)
return 0;
@@ -2854,7 +2858,7 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
return IDP_GetPropertyFromGroup(group, name) ? 1:0;
}
-static PySequenceMethods pyrna_prop_array_as_sequence= {
+static PySequenceMethods pyrna_prop_array_as_sequence = {
(lenfunc)pyrna_prop_array_length, /* Cant set the len otherwise it can evaluate as false */
NULL, /* sq_concat */
NULL, /* sq_repeat */
@@ -2867,7 +2871,7 @@ static PySequenceMethods pyrna_prop_array_as_sequence= {
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
-static PySequenceMethods pyrna_prop_collection_as_sequence= {
+static PySequenceMethods pyrna_prop_collection_as_sequence = {
(lenfunc)pyrna_prop_collection_length, /* Cant set the len otherwise it can evaluate as false */
NULL, /* sq_concat */
NULL, /* sq_repeat */
@@ -2880,7 +2884,7 @@ static PySequenceMethods pyrna_prop_collection_as_sequence= {
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
-static PySequenceMethods pyrna_struct_as_sequence= {
+static PySequenceMethods pyrna_struct_as_sequence = {
NULL, /* Cant set the len otherwise it can evaluate as false */
NULL, /* sq_concat */
NULL, /* sq_repeat */
@@ -2897,30 +2901,30 @@ static PyObject *pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key)
{
/* mostly copied from BPy_IDGroup_Map_GetItem */
IDProperty *group, *idprop;
- const char *name= _PyUnicode_AsString(key);
+ const char *name = _PyUnicode_AsString(key);
PYRNA_STRUCT_CHECK_OBJ(self);
- if (RNA_struct_idprops_check(self->ptr.type)==0) {
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
PyErr_SetString(PyExc_TypeError, "this type doesn't support IDProperties");
return NULL;
}
- if (name==NULL) {
+ if (name == NULL) {
PyErr_SetString(PyExc_TypeError, "bpy_struct[key]: only strings are allowed as keys of ID properties");
return NULL;
}
- group= RNA_struct_idprops(&self->ptr, 0);
+ group = RNA_struct_idprops(&self->ptr, 0);
- if (group==NULL) {
+ if (group == NULL) {
PyErr_Format(PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name);
return NULL;
}
- idprop= IDP_GetPropertyFromGroup(group, name);
+ idprop = IDP_GetPropertyFromGroup(group, name);
- if (idprop==NULL) {
+ if (idprop == NULL) {
PyErr_Format(PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name);
return NULL;
}
@@ -2934,7 +2938,7 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
PYRNA_STRUCT_CHECK_INT(self);
- group= RNA_struct_idprops(&self->ptr, 1);
+ group = RNA_struct_idprops(&self->ptr, 1);
#ifdef USE_PEDANTIC_WRITE
if (rna_disallow_writes && rna_id_write_error(&self->ptr, key)) {
@@ -2942,15 +2946,15 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
}
#endif // USE_PEDANTIC_WRITE
- if (group==NULL) {
- PyErr_SetString(PyExc_TypeError, "bpy_struct[key]= val: id properties not supported for this type");
+ if (group == NULL) {
+ PyErr_SetString(PyExc_TypeError, "bpy_struct[key] = val: id properties not supported for this type");
return -1;
}
return BPy_Wrap_SetMapItem(group, key, value);
}
-static PyMappingMethods pyrna_struct_as_mapping= {
+static PyMappingMethods pyrna_struct_as_mapping = {
(lenfunc) NULL, /* mp_length */
(binaryfunc) pyrna_struct_subscript, /* mp_subscript */
(objobjargproc) pyrna_struct_ass_subscript, /* mp_ass_subscript */
@@ -2971,14 +2975,14 @@ static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
{
IDProperty *group;
- if (RNA_struct_idprops_check(self->ptr.type)==0) {
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
PyErr_SetString(PyExc_TypeError, "bpy_struct.keys(): this type doesn't support IDProperties");
return NULL;
}
- group= RNA_struct_idprops(&self->ptr, 0);
+ group = RNA_struct_idprops(&self->ptr, 0);
- if (group==NULL)
+ if (group == NULL)
return PyList_New(0);
return BPy_Wrap_GetKeys(group);
@@ -2999,14 +3003,14 @@ static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
{
IDProperty *group;
- if (RNA_struct_idprops_check(self->ptr.type)==0) {
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
PyErr_SetString(PyExc_TypeError, "bpy_struct.items(): this type doesn't support IDProperties");
return NULL;
}
- group= RNA_struct_idprops(&self->ptr, 0);
+ group = RNA_struct_idprops(&self->ptr, 0);
- if (group==NULL)
+ if (group == NULL)
return PyList_New(0);
return BPy_Wrap_GetItems(self->ptr.id.data, group);
@@ -3027,14 +3031,14 @@ static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
{
IDProperty *group;
- if (RNA_struct_idprops_check(self->ptr.type)==0) {
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
PyErr_SetString(PyExc_TypeError, "bpy_struct.values(): this type doesn't support IDProperties");
return NULL;
}
- group= RNA_struct_idprops(&self->ptr, 0);
+ group = RNA_struct_idprops(&self->ptr, 0);
- if (group==NULL)
+ if (group == NULL)
return PyList_New(0);
return BPy_Wrap_GetValues(self->ptr.id.data, group);
@@ -3060,7 +3064,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
if (!PyArg_ParseTuple(args, "s:is_property_set", &name))
return NULL;
- if ((prop= RNA_struct_find_property(&self->ptr, name)) == NULL) {
+ if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s.is_property_set(\"%.200s\") not found",
RNA_struct_identifier(self->ptr.type), name);
@@ -3070,16 +3074,16 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
/* double property lookup, could speed up */
/* return PyBool_FromLong(RNA_property_is_set(&self->ptr, name)); */
if (RNA_property_flag(prop) & PROP_IDPROPERTY) {
- IDProperty *group= RNA_struct_idprops(&self->ptr, 0);
+ IDProperty *group = RNA_struct_idprops(&self->ptr, 0);
if (group) {
- ret= IDP_GetPropertyFromGroup(group, name) ? 1:0;
+ ret = IDP_GetPropertyFromGroup(group, name) ? 1:0;
}
else {
- ret= 0;
+ ret = 0;
}
}
else {
- ret= 1;
+ ret = 1;
}
return PyBool_FromLong(ret);
@@ -3103,7 +3107,7 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *
if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name))
return NULL;
- if ((prop= RNA_struct_find_property(&self->ptr, name)) == NULL) {
+ if ((prop = RNA_struct_find_property(&self->ptr, name)) == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s.is_property_hidden(\"%.200s\") not found",
RNA_struct_identifier(self->ptr.type), name);
@@ -3127,10 +3131,10 @@ PyDoc_STRVAR(pyrna_struct_path_resolve_doc,
static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
{
const char *path;
- PyObject *coerce= Py_True;
+ PyObject *coerce = Py_True;
PointerRNA r_ptr;
PropertyRNA *r_prop;
- int index= -1;
+ int index = -1;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -3185,7 +3189,7 @@ PyDoc_STRVAR(pyrna_struct_path_from_id_doc,
);
static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
{
- const char *name= NULL;
+ const char *name = NULL;
const char *path;
PropertyRNA *prop;
PyObject *ret;
@@ -3196,21 +3200,21 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
return NULL;
if (name) {
- prop= RNA_struct_find_property(&self->ptr, name);
- if (prop==NULL) {
+ prop = RNA_struct_find_property(&self->ptr, name);
+ if (prop == NULL) {
PyErr_Format(PyExc_AttributeError,
"%.200s.path_from_id(\"%.200s\") not found",
RNA_struct_identifier(self->ptr.type), name);
return NULL;
}
- path= RNA_path_from_ID_to_property(&self->ptr, prop);
+ path = RNA_path_from_ID_to_property(&self->ptr, prop);
}
else {
- path= RNA_path_from_ID_to_struct(&self->ptr);
+ path = RNA_path_from_ID_to_struct(&self->ptr);
}
- if (path==NULL) {
+ if (path == NULL) {
if (name) {
PyErr_Format(PyExc_ValueError,
"%.200s.path_from_id(\"%s\") found but does not support path creation",
@@ -3224,7 +3228,7 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
return NULL;
}
- ret= PyUnicode_FromString(path);
+ ret = PyUnicode_FromString(path);
MEM_freeN((void *)path);
return ret;
@@ -3241,19 +3245,19 @@ PyDoc_STRVAR(pyrna_prop_path_from_id_doc,
static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
{
const char *path;
- PropertyRNA *prop= self->prop;
+ PropertyRNA *prop = self->prop;
PyObject *ret;
- path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
+ path = RNA_path_from_ID_to_property(&self->ptr, self->prop);
- if (path==NULL) {
+ if (path == NULL) {
PyErr_Format(PyExc_ValueError,
"%.200s.%.200s.path_from_id() does not support path creation for this type",
RNA_struct_identifier(self->ptr.type), RNA_property_identifier(prop));
return NULL;
}
- ret= PyUnicode_FromString(path);
+ ret = PyUnicode_FromString(path);
MEM_freeN((void *)path);
return ret;
@@ -3284,17 +3288,17 @@ static void pyrna_dir_members_py(PyObject *list, PyObject *self)
PyObject **dict_ptr;
PyObject *list_tmp;
- dict_ptr= _PyObject_GetDictPtr((PyObject *)self);
+ dict_ptr = _PyObject_GetDictPtr((PyObject *)self);
- if (dict_ptr && (dict=*dict_ptr)) {
- list_tmp= PyDict_Keys(dict);
+ if (dict_ptr && (dict = *dict_ptr)) {
+ list_tmp = PyDict_Keys(dict);
PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
Py_DECREF(list_tmp);
}
- dict= ((PyTypeObject *)Py_TYPE(self))->tp_dict;
+ dict = ((PyTypeObject *)Py_TYPE(self))->tp_dict;
if (dict) {
- list_tmp= PyDict_Keys(dict);
+ list_tmp = PyDict_Keys(dict);
PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
Py_DECREF(list_tmp);
}
@@ -3311,12 +3315,12 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
{
RNA_pointer_create(NULL, &RNA_Struct, ptr->type, &tptr);
- iterprop= RNA_struct_find_property(&tptr, "functions");
+ iterprop = RNA_struct_find_property(&tptr, "functions");
RNA_PROP_BEGIN(&tptr, itemptr, iterprop) {
- idname= RNA_function_identifier(itemptr.data);
+ idname = RNA_function_identifier(itemptr.data);
- pystring= PyUnicode_FromString(idname);
+ pystring = PyUnicode_FromString(idname);
PyList_Append(list, pystring);
Py_DECREF(pystring);
}
@@ -3330,13 +3334,13 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
char name[256], *nameptr;
int namelen;
- iterprop= RNA_struct_iterator_property(ptr->type);
+ iterprop = RNA_struct_iterator_property(ptr->type);
RNA_PROP_BEGIN(ptr, itemptr, iterprop) {
- nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
+ nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {
- pystring= PyUnicode_FromStringAndSize(nameptr, namelen);
+ pystring = PyUnicode_FromStringAndSize(nameptr, namelen);
PyList_Append(list, pystring);
Py_DECREF(pystring);
@@ -3360,7 +3364,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
/* Include this incase this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
* */
- ret= PyList_New(0);
+ ret = PyList_New(0);
if (!BPy_StructRNA_CheckExact(self))
pyrna_dir_members_py(ret, (PyObject *)self);
@@ -3368,11 +3372,11 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
pyrna_dir_members_rna(ret, &self->ptr);
if (self->ptr.type == &RNA_Context) {
- ListBase lb= CTX_data_dir_get(self->ptr.data);
+ ListBase lb = CTX_data_dir_get(self->ptr.data);
LinkData *link;
- for (link=lb.first; link; link=link->next) {
- pystring= PyUnicode_FromString(link->data);
+ for (link = lb.first; link; link = link->next) {
+ pystring = PyUnicode_FromString(link->data);
PyList_Append(ret, pystring);
Py_DECREF(pystring);
}
@@ -3384,10 +3388,10 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
/* set(), this is needed to remove-doubles because the deferred
* register-props will be in both the python __dict__ and accessed as RNA */
- PyObject *set= PySet_New(ret);
+ PyObject *set = PySet_New(ret);
Py_DECREF(ret);
- ret= PySequence_List(set);
+ ret = PySequence_List(set);
Py_DECREF(set);
}
@@ -3397,7 +3401,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
//---------------getattr--------------------------------------------
static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
{
- const char *name= _PyUnicode_AsString(pyname);
+ const char *name = _PyUnicode_AsString(pyname);
PyObject *ret;
PropertyRNA *prop;
FunctionRNA *func;
@@ -3406,49 +3410,49 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: __getattr__ must be a string");
- ret= NULL;
+ ret = NULL;
}
- else if (name[0]=='_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups
+ else if (name[0] == '_') { // rna can't start with a "_", so for __dict__ and similar we can skip using rna lookups
/* annoying exception, maybe we need to have different types for this... */
- if ((strcmp(name, "__getitem__")==0 || strcmp(name, "__setitem__")==0) && !RNA_struct_idprops_check(self->ptr.type)) {
+ if ((strcmp(name, "__getitem__") == 0 || strcmp(name, "__setitem__") == 0) && !RNA_struct_idprops_check(self->ptr.type)) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: no __getitem__ support for this type");
- ret= NULL;
+ ret = NULL;
}
else {
- ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
+ ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
}
}
- else if ((prop= RNA_struct_find_property(&self->ptr, name))) {
- ret= pyrna_prop_to_py(&self->ptr, prop);
+ else if ((prop = RNA_struct_find_property(&self->ptr, name))) {
+ ret = pyrna_prop_to_py(&self->ptr, prop);
}
/* RNA function only if callback is declared (no optional functions) */
- else if ((func= RNA_struct_find_function(&self->ptr, name)) && RNA_function_defined(func)) {
- ret= pyrna_func_to_py(&self->ptr, func);
+ else if ((func = RNA_struct_find_function(&self->ptr, name)) && RNA_function_defined(func)) {
+ ret = pyrna_func_to_py(&self->ptr, func);
}
else if (self->ptr.type == &RNA_Context) {
- bContext *C= self->ptr.data;
- if (C==NULL) {
+ bContext *C = self->ptr.data;
+ if (C == NULL) {
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context is 'NULL', can't get \"%.200s\" from context",
name);
- ret= NULL;
+ ret = NULL;
}
else {
PointerRNA newptr;
ListBase newlb;
short newtype;
- int done= CTX_data_get(C, name, &newptr, &newlb, &newtype);
+ int done = CTX_data_get(C, name, &newptr, &newlb, &newtype);
- if (done==1) { /* found */
- switch(newtype) {
+ if (done == 1) { /* found */
+ switch (newtype) {
case CTX_DATA_TYPE_POINTER:
if (newptr.data == NULL) {
- ret= Py_None;
+ ret = Py_None;
Py_INCREF(ret);
}
else {
- ret= pyrna_struct_CreatePyObject(&newptr);
+ ret = pyrna_struct_CreatePyObject(&newptr);
}
break;
case CTX_DATA_TYPE_COLLECTION:
@@ -3456,10 +3460,10 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
CollectionPointerLink *link;
PyObject *linkptr;
- ret= PyList_New(0);
+ ret = PyList_New(0);
- for (link=newlb.first; link; link=link->next) {
- linkptr= pyrna_struct_CreatePyObject(&link->ptr);
+ for (link = newlb.first; link; link = link->next) {
+ linkptr = pyrna_struct_CreatePyObject(&link->ptr);
PyList_Append(ret, linkptr);
Py_DECREF(linkptr);
}
@@ -3472,16 +3476,16 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
newtype, name);
- ret= NULL;
+ ret = NULL;
}
}
- else if (done==-1) { /* found but not set */
- ret= Py_None;
+ else if (done == -1) { /* found but not set */
+ ret = Py_None;
Py_INCREF(ret);
}
else { /* not found in the context */
/* lookup the subclass. raise an error if its not found */
- ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
+ ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
}
BLI_freelistN(&newlb);
@@ -3492,7 +3496,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
PyErr_Format(PyExc_AttributeError,
"bpy_struct: attribute \"%.200s\" not found",
name);
- ret= NULL;
+ ret = NULL;
#endif
/* Include this incase this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
@@ -3501,7 +3505,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
* */
/* The error raised here will be displayed */
- ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
+ ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
}
return ret;
@@ -3510,8 +3514,8 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
#if 0
static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname)
{
- PyObject *dict= *(_PyObject_GetDictPtr((PyObject *)self));
- if (dict==NULL) /* unlikely */
+ PyObject *dict = *(_PyObject_GetDictPtr((PyObject *)self));
+ if (dict == NULL) /* unlikely */
return 0;
return PyDict_Contains(dict, pyname);
@@ -3530,10 +3534,10 @@ static int pyrna_is_deferred_prop(const PyObject *value)
#if 0
static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr)
{
- PyObject *ret= PyType_Type.tp_getattro(cls, attr);
+ PyObject *ret = PyType_Type.tp_getattro(cls, attr);
/* Allows:
- * >>> bpy.types.Scene.foo= BoolProperty()
+ * >>> bpy.types.Scene.foo = BoolProperty()
* >>> bpy.types.Scene.foo
* <bpy_struct, BoolProperty("foo")>
* ...rather than returning the deferred class register tuple as checked by pyrna_is_deferred_prop()
@@ -3541,14 +3545,14 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr
* Disable for now, this is faking internal behavior in a way thats too tricky to maintain well. */
#if 0
if (ret == NULL) { // || pyrna_is_deferred_prop(ret)
- StructRNA *srna= srna_from_self(cls, "StructRNA.__getattr__");
+ StructRNA *srna = srna_from_self(cls, "StructRNA.__getattr__");
if (srna) {
- PropertyRNA *prop= RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr));
+ PropertyRNA *prop = RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr));
if (prop) {
PointerRNA tptr;
PyErr_Clear(); /* clear error from tp_getattro */
RNA_pointer_create(NULL, &RNA_Property, prop, &tptr);
- ret= pyrna_struct_CreatePyObject(&tptr);
+ ret = pyrna_struct_CreatePyObject(&tptr);
}
}
}
@@ -3560,9 +3564,9 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr
static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyObject *value)
{
- StructRNA *srna= srna_from_self(cls, "StructRNA.__setattr__");
- const int is_deferred_prop= (value && pyrna_is_deferred_prop(value));
- const char *attr_str= _PyUnicode_AsString(attr);
+ StructRNA *srna = srna_from_self(cls, "StructRNA.__setattr__");
+ const int is_deferred_prop = (value && pyrna_is_deferred_prop(value));
+ const char *attr_str = _PyUnicode_AsString(attr);
if (srna && !pyrna_write_check() && (is_deferred_prop || RNA_struct_type_find_property(srna, attr_str))) {
PyErr_Format(PyExc_AttributeError,
@@ -3590,7 +3594,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
if (value) {
/* check if the value is a property */
if (is_deferred_prop) {
- int ret= deferred_register_prop(srna, attr, value);
+ int ret = deferred_register_prop(srna, attr, value);
if (ret == -1) {
/* error set */
return ret;
@@ -3607,7 +3611,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
}
else { /* __delattr__ */
/* first find if this is a registered property */
- const int ret= RNA_def_property_free_identifier(srna, attr_str);
+ const int ret = RNA_def_property_free_identifier(srna, attr_str);
if (ret == -1) {
PyErr_Format(PyExc_TypeError,
"struct_meta_idprop.detattr(): '%s' not a dynamic property",
@@ -3622,8 +3626,8 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject *value)
{
- const char *name= _PyUnicode_AsString(pyname);
- PropertyRNA *prop= NULL;
+ const char *name = _PyUnicode_AsString(pyname);
+ PropertyRNA *prop = NULL;
PYRNA_STRUCT_CHECK_INT(self);
@@ -3637,7 +3641,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
PyErr_SetString(PyExc_AttributeError, "bpy_struct: __setattr__ must be a string");
return -1;
}
- else if (name[0] != '_' && (prop= RNA_struct_find_property(&self->ptr, name))) {
+ else if (name[0] != '_' && (prop = RNA_struct_find_property(&self->ptr, name))) {
if (!RNA_property_editable_flag(&self->ptr, prop)) {
PyErr_Format(PyExc_AttributeError,
"bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only",
@@ -3647,8 +3651,8 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
}
else if (self->ptr.type == &RNA_Context) {
/* code just raises correct error, context prop's cant be set, unless its apart of the py class */
- bContext *C= self->ptr.data;
- if (C==NULL) {
+ bContext *C = self->ptr.data;
+ if (C == NULL) {
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context is 'NULL', can't set \"%.200s\" from context",
name);
@@ -3659,9 +3663,9 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
ListBase newlb;
short newtype;
- int done= CTX_data_get(C, name, &newptr, &newlb, &newtype);
+ int done = CTX_data_get(C, name, &newptr, &newlb, &newtype);
- if (done==1) {
+ if (done == 1) {
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context property \"%.200s\" is read-only",
name);
@@ -3679,7 +3683,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
return -1;
}
- return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr= val:");
+ return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:");
}
else {
return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
@@ -3694,7 +3698,7 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
/* Include this incase this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
* */
- ret= PyList_New(0);
+ ret = PyList_New(0);
if (!BPy_PropertyRNA_CheckExact(self)) {
pyrna_dir_members_py(ret, (PyObject *)self);
@@ -3717,7 +3721,7 @@ static PyObject *pyrna_prop_array_getattro(BPy_PropertyRNA *self, PyObject *pyna
static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject *pyname)
{
- const char *name= _PyUnicode_AsString(pyname);
+ const char *name = _PyUnicode_AsString(pyname);
if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_prop_collection: __getattr__ must be a string");
@@ -3730,14 +3734,14 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
PointerRNA r_ptr;
if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
- if ((prop= RNA_struct_find_property(&r_ptr, name))) {
- ret= pyrna_prop_to_py(&r_ptr, prop);
+ if ((prop = RNA_struct_find_property(&r_ptr, name))) {
+ ret = pyrna_prop_to_py(&r_ptr, prop);
return ret;
}
- else if ((func= RNA_struct_find_function(&r_ptr, name))) {
- PyObject *self_collection= pyrna_struct_CreatePyObject(&r_ptr);
- ret= pyrna_func_to_py(&((BPy_DummyPointerRNA *)self_collection)->ptr, func);
+ else if ((func = RNA_struct_find_function(&r_ptr, name))) {
+ PyObject *self_collection = pyrna_struct_CreatePyObject(&r_ptr);
+ ret = pyrna_func_to_py(&((BPy_DummyPointerRNA *)self_collection)->ptr, func);
Py_DECREF(self_collection);
return ret;
@@ -3754,7 +3758,7 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
* so as to support 'bpy.data.library.load()'
* note, this _only_ supports static methods */
- PyObject *ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
+ PyObject *ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
if (ret == NULL && name[0] != '_') { /* avoid inheriting __call__ and similar */
/* since this is least common case, handle it last */
@@ -3766,8 +3770,8 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
PyErr_Fetch(&error_type, &error_value, &error_traceback);
PyErr_Clear();
- cls= pyrna_struct_Subtype(&r_ptr); /* borrows */
- ret= PyObject_GenericGetAttr(cls, pyname);
+ cls = pyrna_struct_Subtype(&r_ptr); /* borrows */
+ ret = PyObject_GenericGetAttr(cls, pyname);
/* restore the original error */
if (ret == NULL) {
PyErr_Restore(error_type, error_value, error_traceback);
@@ -3783,7 +3787,7 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
//--------------- setattr-------------------------------------------
static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pyname, PyObject *value)
{
- const char *name= _PyUnicode_AsString(pyname);
+ const char *name = _PyUnicode_AsString(pyname);
PropertyRNA *prop;
PointerRNA r_ptr;
@@ -3802,7 +3806,7 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam
return -1;
}
else if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
- if ((prop= RNA_struct_find_property(&r_ptr, name))) {
+ if ((prop = RNA_struct_find_property(&r_ptr, name))) {
/* pyrna_py_to_prop sets its own exceptions */
return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
}
@@ -3831,9 +3835,9 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyObject *value)
{
- int key= PyLong_AsLong(value);
+ int key = PyLong_AsLong(value);
- if (key==-1 && PyErr_Occurred()) {
+ if (key == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove(): expected one int argument");
return NULL;
}
@@ -3848,7 +3852,7 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObject *args)
{
- int key=0, pos=0;
+ int key = 0, pos = 0;
if (!PyArg_ParseTuple(args, "ii", &key, &pos)) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move(): expected two ints as arguments");
@@ -3903,14 +3907,14 @@ static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self)
/* Python attributes get/set structure: */
/*****************************************************************************/
-static PyGetSetDef pyrna_prop_getseters[]= {
+static PyGetSetDef pyrna_prop_getseters[] = {
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)pyrna_struct_get_id_data_doc, NULL},
{(char *)"data", (getter)pyrna_struct_get_data, (setter)NULL, (char *)pyrna_struct_get_data_doc, NULL},
{(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)pyrna_struct_get_rna_type_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
-static PyGetSetDef pyrna_struct_getseters[]= {
+static PyGetSetDef pyrna_struct_getseters[] = {
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)pyrna_struct_get_id_data_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -3927,17 +3931,17 @@ PyDoc_STRVAR(pyrna_prop_collection_keys_doc,
);
static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
{
- PyObject *ret= PyList_New(0);
+ PyObject *ret = PyList_New(0);
PyObject *item;
char name[256], *nameptr;
int namelen;
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
- nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
+ nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {
/* add to python list */
- item= PyUnicode_FromStringAndSize(nameptr, namelen);
+ item = PyUnicode_FromStringAndSize(nameptr, namelen);
PyList_Append(ret, item);
Py_DECREF(item);
/* done */
@@ -3963,17 +3967,17 @@ PyDoc_STRVAR(pyrna_prop_collection_items_doc,
);
static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
{
- PyObject *ret= PyList_New(0);
+ PyObject *ret = PyList_New(0);
PyObject *item;
char name[256], *nameptr;
int namelen;
- int i= 0;
+ int i = 0;
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
if (itemptr.data) {
/* add to python list */
- item= PyTuple_New(2);
- nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
+ item = PyTuple_New(2);
+ nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {
PyTuple_SET_ITEM(item, 0, PyUnicode_FromStringAndSize(nameptr, namelen));
if (name != nameptr)
@@ -4030,7 +4034,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
IDProperty *group, *idprop;
const char *key;
- PyObject* def= Py_None;
+ PyObject* def = Py_None;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -4038,14 +4042,14 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
return NULL;
/* mostly copied from BPy_IDGroup_Map_GetItem */
- if (RNA_struct_idprops_check(self->ptr.type)==0) {
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
PyErr_SetString(PyExc_TypeError, "this type doesn't support IDProperties");
return NULL;
}
- group= RNA_struct_idprops(&self->ptr, 0);
+ group = RNA_struct_idprops(&self->ptr, 0);
if (group) {
- idprop= IDP_GetPropertyFromGroup(group, key);
+ idprop = IDP_GetPropertyFromGroup(group, key);
if (idprop) {
return BPy_IDGroup_WrapData(self->ptr.id.data, idprop, group);
@@ -4089,7 +4093,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
PointerRNA newptr;
PyObject *key_ob;
- PyObject* def= Py_None;
+ PyObject* def = Py_None;
PYRNA_PROP_CHECK_OBJ(self);
@@ -4097,13 +4101,13 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
return NULL;
if (PyUnicode_Check(key_ob)) {
- const char *key= _PyUnicode_AsString(key_ob);
+ const char *key = _PyUnicode_AsString(key_ob);
if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr))
return pyrna_struct_CreatePyObject(&newptr);
}
else if (PyTuple_Check(key_ob)) {
- PyObject *ret= pyrna_prop_collection_subscript_str_lib_pair(self, key_ob,
+ PyObject *ret = pyrna_prop_collection_subscript_str_lib_pair(self, key_ob,
"bpy_prop_collection.get((id, lib))", FALSE);
if (ret) {
return ret;
@@ -4123,16 +4127,16 @@ static void foreach_attr_type( BPy_PropertyRNA *self, const char *attr,
RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
{
PropertyRNA *prop;
- *raw_type= PROP_RAW_UNSET;
- *attr_tot= 0;
- *attr_signed= FALSE;
+ *raw_type = PROP_RAW_UNSET;
+ *attr_tot = 0;
+ *attr_signed = FALSE;
/* note: this is fail with zero length lists, so dont let this get caled in that case */
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
- prop= RNA_struct_find_property(&itemptr, attr);
- *raw_type= RNA_property_raw_type(prop);
- *attr_tot= RNA_property_array_length(&itemptr, prop);
- *attr_signed= (RNA_property_subtype(prop)==PROP_UNSIGNED) ? FALSE:TRUE;
+ prop = RNA_struct_find_property(&itemptr, attr);
+ *raw_type = RNA_property_raw_type(prop);
+ *attr_tot = RNA_property_array_length(&itemptr, prop);
+ *attr_signed = (RNA_property_subtype(prop) == PROP_UNSIGNED) ? FALSE:TRUE;
break;
}
RNA_PROP_END;
@@ -4152,31 +4156,31 @@ static int foreach_parse_args(
int target_tot;
#endif
- *size= *attr_tot= *attr_signed= FALSE;
- *raw_type= PROP_RAW_UNSET;
+ *size = *attr_tot = *attr_signed = FALSE;
+ *raw_type = PROP_RAW_UNSET;
if (!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) {
PyErr_SetString(PyExc_TypeError, "foreach_get(attr, sequence) expects a string and a sequence");
return -1;
}
- *tot= PySequence_Size(*seq); // TODO - buffer may not be a sequence! array.array() is tho.
+ *tot = PySequence_Size(*seq); // TODO - buffer may not be a sequence! array.array() is tho.
- if (*tot>0) {
+ if (*tot > 0) {
foreach_attr_type(self, *attr, raw_type, attr_tot, attr_signed);
- *size= RNA_raw_type_sizeof(*raw_type);
+ *size = RNA_raw_type_sizeof(*raw_type);
#if 0 // works fine but not strictly needed, we could allow RNA_property_collection_raw_* to do the checks
if ((*attr_tot) < 1)
- *attr_tot= 1;
+ *attr_tot = 1;
if (RNA_property_type(self->prop) == PROP_COLLECTION)
- array_tot= RNA_property_collection_length(&self->ptr, self->prop);
+ array_tot = RNA_property_collection_length(&self->ptr, self->prop);
else
- array_tot= RNA_property_array_length(&self->ptr, self->prop);
+ array_tot = RNA_property_array_length(&self->ptr, self->prop);
- target_tot= array_tot * (*attr_tot);
+ target_tot = array_tot * (*attr_tot);
/* rna_access.c - rna_raw_access(...) uses this same method */
if (target_tot != (*tot)) {
@@ -4199,22 +4203,22 @@ static int foreach_parse_args(
static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, const char *format)
{
- char f= format ? *format:'B'; /* B is assumed when not set */
+ char f = format ? *format:'B'; /* B is assumed when not set */
- switch(raw_type) {
+ switch (raw_type) {
case PROP_RAW_CHAR:
- if (attr_signed) return (f=='b') ? 1:0;
- else return (f=='B') ? 1:0;
+ if (attr_signed) return (f == 'b') ? 1:0;
+ else return (f == 'B') ? 1:0;
case PROP_RAW_SHORT:
- if (attr_signed) return (f=='h') ? 1:0;
- else return (f=='H') ? 1:0;
+ if (attr_signed) return (f == 'h') ? 1:0;
+ else return (f == 'H') ? 1:0;
case PROP_RAW_INT:
- if (attr_signed) return (f=='i') ? 1:0;
- else return (f=='I') ? 1:0;
+ if (attr_signed) return (f == 'i') ? 1:0;
+ else return (f == 'I') ? 1:0;
case PROP_RAW_FLOAT:
- return (f=='f') ? 1:0;
+ return (f == 'f') ? 1:0;
case PROP_RAW_DOUBLE:
- return (f=='d') ? 1:0;
+ return (f == 'd') ? 1:0;
case PROP_RAW_UNSET:
return 0;
}
@@ -4224,9 +4228,9 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
{
- PyObject *item= NULL;
- int i=0, ok=0, buffer_is_compat;
- void *array= NULL;
+ PyObject *item = NULL;
+ int i = 0, ok = 0, buffer_is_compat;
+ void *array = NULL;
/* get/set both take the same args currently */
const char *attr;
@@ -4237,23 +4241,23 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
if (foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) < 0)
return NULL;
- if (tot==0)
+ if (tot == 0)
Py_RETURN_NONE;
if (set) { /* get the array from python */
- buffer_is_compat= FALSE;
+ buffer_is_compat = FALSE;
if (PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
/* check if the buffer matches */
- buffer_is_compat= foreach_compat_buffer(raw_type, attr_signed, buf.format);
+ buffer_is_compat = foreach_compat_buffer(raw_type, attr_signed, buf.format);
if (buffer_is_compat) {
- ok= RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
+ ok = RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
}
PyBuffer_Release(&buf);
@@ -4261,25 +4265,25 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
/* could not use the buffer, fallback to sequence */
if (!buffer_is_compat) {
- array= PyMem_Malloc(size * tot);
+ array = PyMem_Malloc(size * tot);
- for ( ; i<tot; i++) {
- item= PySequence_GetItem(seq, i);
- switch(raw_type) {
+ for ( ; i < tot; i++) {
+ item = PySequence_GetItem(seq, i);
+ switch (raw_type) {
case PROP_RAW_CHAR:
- ((char *)array)[i]= (char)PyLong_AsLong(item);
+ ((char *)array)[i] = (char)PyLong_AsLong(item);
break;
case PROP_RAW_SHORT:
- ((short *)array)[i]= (short)PyLong_AsLong(item);
+ ((short *)array)[i] = (short)PyLong_AsLong(item);
break;
case PROP_RAW_INT:
- ((int *)array)[i]= (int)PyLong_AsLong(item);
+ ((int *)array)[i] = (int)PyLong_AsLong(item);
break;
case PROP_RAW_FLOAT:
- ((float *)array)[i]= (float)PyFloat_AsDouble(item);
+ ((float *)array)[i] = (float)PyFloat_AsDouble(item);
break;
case PROP_RAW_DOUBLE:
- ((double *)array)[i]= (double)PyFloat_AsDouble(item);
+ ((double *)array)[i] = (double)PyFloat_AsDouble(item);
break;
case PROP_RAW_UNSET:
/* should never happen */
@@ -4290,21 +4294,21 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
Py_DECREF(item);
}
- ok= RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
+ ok = RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
}
}
else {
- buffer_is_compat= FALSE;
+ buffer_is_compat = FALSE;
if (PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
/* check if the buffer matches, TODO - signed/unsigned types */
- buffer_is_compat= foreach_compat_buffer(raw_type, attr_signed, buf.format);
+ buffer_is_compat = foreach_compat_buffer(raw_type, attr_signed, buf.format);
if (buffer_is_compat) {
- ok= RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
+ ok = RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
}
PyBuffer_Release(&buf);
@@ -4312,34 +4316,34 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
/* could not use the buffer, fallback to sequence */
if (!buffer_is_compat) {
- array= PyMem_Malloc(size * tot);
+ array = PyMem_Malloc(size * tot);
- ok= RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
+ ok = RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
- if (!ok) i= tot; /* skip the loop */
+ if (!ok) i = tot; /* skip the loop */
- for ( ; i<tot; i++) {
+ for ( ; i < tot; i++) {
- switch(raw_type) {
+ switch (raw_type) {
case PROP_RAW_CHAR:
- item= PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
+ item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
break;
case PROP_RAW_SHORT:
- item= PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
+ item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
break;
case PROP_RAW_INT:
- item= PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
+ item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
break;
case PROP_RAW_FLOAT:
- item= PyFloat_FromDouble((double) ((float *)array)[i]);
+ item = PyFloat_FromDouble((double) ((float *)array)[i]);
break;
case PROP_RAW_DOUBLE:
- item= PyFloat_FromDouble((double) ((double *)array)[i]);
+ item = PyFloat_FromDouble((double) ((double *)array)[i]);
break;
default: /* PROP_RAW_UNSET */
/* should never happen */
BLI_assert(!"Invalid array type - get");
- item= Py_None;
+ item = Py_None;
Py_INCREF(item);
break;
}
@@ -4377,7 +4381,7 @@ PyDoc_STRVAR(pyrna_prop_collection_foreach_get_doc,
" collection.foreach_get(someseq, attr)\n"
"\n"
" # Python equivalent\n"
-" for i in range(len(seq)): someseq[i]= getattr(collection, attr)\n"
+" for i in range(len(seq)): someseq[i] = getattr(collection, attr)\n"
"\n"
);
static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
@@ -4413,18 +4417,18 @@ static PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
{
/* Try get values from a collection */
PyObject *ret;
- PyObject *iter= NULL;
+ PyObject *iter = NULL;
int len;
PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
- len= pyrna_prop_array_length(self);
- ret= pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
+ len = pyrna_prop_array_length(self);
+ ret = pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
/* we know this is a list so no need to PyIter_Check
* otherwise it could be NULL (unlikely) if conversion failed */
if (ret) {
- iter= PyObject_GetIter(ret);
+ iter = PyObject_GetIter(ret);
Py_DECREF(ret);
}
@@ -4438,13 +4442,13 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
{
/* Try get values from a collection */
PyObject *ret;
- PyObject *iter= NULL;
- ret= pyrna_prop_collection_values(self);
+ PyObject *iter = NULL;
+ ret = pyrna_prop_collection_values(self);
/* we know this is a list so no need to PyIter_Check
* otherwise it could be NULL (unlikely) if conversion failed */
if (ret) {
- iter= PyObject_GetIter(ret);
+ iter = PyObject_GetIter(ret);
Py_DECREF(ret);
}
@@ -4452,7 +4456,7 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
}
#endif /* # !USE_PYRNA_ITER */
-static struct PyMethodDef pyrna_struct_methods[]= {
+static struct PyMethodDef pyrna_struct_methods[] = {
/* only for PointerRNA's with ID'props */
{"keys", (PyCFunction)pyrna_struct_keys, METH_NOARGS, pyrna_struct_keys_doc},
@@ -4482,17 +4486,17 @@ static struct PyMethodDef pyrna_struct_methods[]= {
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_methods[]= {
+static struct PyMethodDef pyrna_prop_methods[] = {
{"path_from_id", (PyCFunction)pyrna_prop_path_from_id, METH_NOARGS, pyrna_prop_path_from_id_doc},
{"__dir__", (PyCFunction)pyrna_prop_dir, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_array_methods[]= {
+static struct PyMethodDef pyrna_prop_array_methods[] = {
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_collection_methods[]= {
+static struct PyMethodDef pyrna_prop_collection_methods[] = {
{"foreach_get", (PyCFunction)pyrna_prop_collection_foreach_get, METH_VARARGS, pyrna_prop_collection_foreach_get_doc},
{"foreach_set", (PyCFunction)pyrna_prop_collection_foreach_set, METH_VARARGS, pyrna_prop_collection_foreach_set_doc},
@@ -4504,7 +4508,7 @@ static struct PyMethodDef pyrna_prop_collection_methods[]= {
{NULL, NULL, 0, NULL}
};
-static struct PyMethodDef pyrna_prop_collection_idprop_methods[]= {
+static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
{"add", (PyCFunction)pyrna_prop_collection_idprop_add, METH_NOARGS, NULL},
{"remove", (PyCFunction)pyrna_prop_collection_idprop_remove, METH_O, NULL},
{"move", (PyCFunction)pyrna_prop_collection_idprop_move, METH_VARARGS, NULL},
@@ -4516,7 +4520,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[]= {
static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
{
if (PyTuple_GET_SIZE(args) == 1) {
- BPy_StructRNA *base= (BPy_StructRNA *)PyTuple_GET_ITEM(args, 0);
+ BPy_StructRNA *base = (BPy_StructRNA *)PyTuple_GET_ITEM(args, 0);
if (Py_TYPE(base) == type) {
Py_INCREF(base);
return (PyObject *)base;
@@ -4529,15 +4533,15 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
... def test_func(self):
... print(100)
...
- >>> myob= MyObSubclass(bpy.context.object)
+ >>> myob = MyObSubclass(bpy.context.object)
>>> myob.test_func()
100
*
* Keep this since it could be useful.
*/
BPy_StructRNA *ret;
- if ((ret= (BPy_StructRNA *)type->tp_alloc(type, 0))) {
- ret->ptr= base->ptr;
+ if ((ret = (BPy_StructRNA *)type->tp_alloc(type, 0))) {
+ ret->ptr = base->ptr;
}
/* pass on exception & NULL if tp_alloc fails */
return (PyObject *)ret;
@@ -4570,9 +4574,9 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
return (PyObject *)base;
}
else if (PyType_IsSubtype(type, &pyrna_prop_Type)) {
- BPy_PropertyRNA *ret= (BPy_PropertyRNA *) type->tp_alloc(type, 0);
- ret->ptr= base->ptr;
- ret->prop= base->prop;
+ BPy_PropertyRNA *ret = (BPy_PropertyRNA *) type->tp_alloc(type, 0);
+ ret->ptr = base->ptr;
+ ret->prop = base->prop;
return (PyObject *)ret;
}
else {
@@ -4586,19 +4590,19 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
{
PyObject *ret;
- const int type= RNA_property_type(prop);
- const int flag= RNA_property_flag(prop);
+ const int type = RNA_property_type(prop);
+ const int flag = RNA_property_flag(prop);
if (RNA_property_array_check(prop)) {
int a, len;
if (flag & PROP_DYNAMIC) {
- ParameterDynAlloc *data_alloc= data;
- len= data_alloc->array_tot;
- data= data_alloc->array;
+ ParameterDynAlloc *data_alloc = data;
+ len = data_alloc->array_tot;
+ data = data_alloc->array;
}
else
- len= RNA_property_array_length(ptr, prop);
+ len = RNA_property_array_length(ptr, prop);
/* resolve the array from a new pytype */
@@ -4606,36 +4610,36 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
switch (type) {
case PROP_BOOLEAN:
- ret= PyTuple_New(len);
- for (a=0; a<len; a++)
- PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int*)data)[a]));
+ ret = PyTuple_New(len);
+ for (a = 0; a < len; a++)
+ PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int *)data)[a]));
break;
case PROP_INT:
- ret= PyTuple_New(len);
- for (a=0; a<len; a++)
- PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int*)data)[a]));
+ ret = PyTuple_New(len);
+ for (a = 0; a < len; a++)
+ PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int *)data)[a]));
break;
case PROP_FLOAT:
- switch(RNA_property_subtype(prop)) {
+ switch (RNA_property_subtype(prop)) {
#ifdef USE_MATHUTILS
case PROP_ALL_VECTOR_SUBTYPES:
- ret= Vector_CreatePyObject(data, len, Py_NEW, NULL);
+ ret = Vector_CreatePyObject(data, len, Py_NEW, NULL);
break;
case PROP_MATRIX:
- if (len==16) {
- ret= Matrix_CreatePyObject(data, 4, 4, Py_NEW, NULL);
+ if (len == 16) {
+ ret = Matrix_CreatePyObject(data, 4, 4, Py_NEW, NULL);
break;
}
- else if (len==9) {
- ret= Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL);
+ else if (len == 9) {
+ ret = Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL);
break;
}
/* pass through */
#endif
default:
- ret= PyTuple_New(len);
- for (a=0; a<len; a++)
- PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float*)data)[a]));
+ ret = PyTuple_New(len);
+ for (a = 0; a < len; a++)
+ PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float *)data)[a]));
}
break;
@@ -4643,7 +4647,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
PyErr_Format(PyExc_TypeError,
"RNA Error: unknown array type \"%d\" (pyrna_param_to_py)",
type);
- ret= NULL;
+ ret = NULL;
break;
}
}
@@ -4651,41 +4655,41 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
/* see if we can coorce into a python type - PropertyType */
switch (type) {
case PROP_BOOLEAN:
- ret= PyBool_FromLong(*(int*)data);
+ ret = PyBool_FromLong(*(int *)data);
break;
case PROP_INT:
- ret= PyLong_FromSsize_t((Py_ssize_t)*(int*)data);
+ ret = PyLong_FromSsize_t((Py_ssize_t)*(int *)data);
break;
case PROP_FLOAT:
- ret= PyFloat_FromDouble(*(float*)data);
+ ret = PyFloat_FromDouble(*(float *)data);
break;
case PROP_STRING:
{
char *data_ch;
- PyObject *value_coerce= NULL;
- const int subtype= RNA_property_subtype(prop);
+ PyObject *value_coerce = NULL;
+ const int subtype = RNA_property_subtype(prop);
if (flag & PROP_THICK_WRAP)
- data_ch= (char *)data;
+ data_ch = (char *)data;
else
- data_ch= *(char **)data;
+ data_ch = *(char **)data;
#ifdef USE_STRING_COERCE
if (subtype == PROP_BYTESTRING) {
- ret= PyBytes_FromString(data_ch);
+ ret = PyBytes_FromString(data_ch);
}
else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
- ret= PyC_UnicodeFromByte(data_ch);
+ ret = PyC_UnicodeFromByte(data_ch);
}
else {
- ret= PyUnicode_FromString(data_ch);
+ ret = PyUnicode_FromString(data_ch);
}
#else
if (subtype == PROP_BYTESTRING) {
- ret= PyBytes_FromString(buf);
+ ret = PyBytes_FromString(buf);
}
else {
- ret= PyUnicode_FromString(data_ch);
+ ret = PyUnicode_FromString(data_ch);
}
#endif
@@ -4697,50 +4701,50 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
}
case PROP_ENUM:
{
- ret= pyrna_enum_to_py(ptr, prop, *(int*)data);
+ ret = pyrna_enum_to_py(ptr, prop, *(int *)data);
break;
}
case PROP_POINTER:
{
PointerRNA newptr;
- StructRNA *ptype= RNA_property_pointer_type(ptr, prop);
+ StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
if (flag & PROP_RNAPTR) {
/* in this case we get the full ptr */
- newptr= *(PointerRNA*)data;
+ newptr = *(PointerRNA *)data;
}
else {
if (RNA_struct_is_ID(ptype)) {
- RNA_id_pointer_create(*(void**)data, &newptr);
+ RNA_id_pointer_create(*(void **)data, &newptr);
}
else {
/* note: this is taken from the function's ID pointer
* and will break if a function returns a pointer from
* another ID block, watch this! - it should at least be
* easy to debug since they are all ID's */
- RNA_pointer_create(ptr->id.data, ptype, *(void**)data, &newptr);
+ RNA_pointer_create(ptr->id.data, ptype, *(void **)data, &newptr);
}
}
if (newptr.data) {
- ret= pyrna_struct_CreatePyObject(&newptr);
+ ret = pyrna_struct_CreatePyObject(&newptr);
}
else {
- ret= Py_None;
+ ret = Py_None;
Py_INCREF(ret);
}
break;
}
case PROP_COLLECTION:
{
- ListBase *lb= (ListBase*)data;
+ ListBase *lb = (ListBase *)data;
CollectionPointerLink *link;
PyObject *linkptr;
- ret= PyList_New(0);
+ ret = PyList_New(0);
- for (link=lb->first; link; link=link->next) {
- linkptr= pyrna_struct_CreatePyObject(&link->ptr);
+ for (link = lb->first; link; link = link->next) {
+ linkptr = pyrna_struct_CreatePyObject(&link->ptr);
PyList_Append(ret, linkptr);
Py_DECREF(linkptr);
}
@@ -4751,7 +4755,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
PyErr_Format(PyExc_TypeError,
"RNA Error: unknown type \"%d\" (pyrna_param_to_py)",
type);
- ret= NULL;
+ ret = NULL;
break;
}
}
@@ -4764,13 +4768,13 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
* works on small dict's such as keyword args. */
static PyObject *small_dict_get_item_string(PyObject *dict, const char *key_lookup)
{
- PyObject *key= NULL;
+ PyObject *key = NULL;
Py_ssize_t pos = 0;
PyObject *value = NULL;
while (PyDict_Next(dict, &pos, &key, &value)) {
if (PyUnicode_Check(key)) {
- if (strcmp(key_lookup, _PyUnicode_AsString(key))==0) {
+ if (strcmp(key_lookup, _PyUnicode_AsString(key)) == 0) {
return value;
}
}
@@ -4782,36 +4786,36 @@ static PyObject *small_dict_get_item_string(PyObject *dict, const char *key_look
static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject *kw)
{
/* Note, both BPy_StructRNA and BPy_PropertyRNA can be used here */
- PointerRNA *self_ptr= &self->ptr;
- FunctionRNA *self_func= self->func;
+ PointerRNA *self_ptr = &self->ptr;
+ FunctionRNA *self_func = self->func;
PointerRNA funcptr;
ParameterList parms;
ParameterIterator iter;
PropertyRNA *parm;
PyObject *ret, *item;
- int i, pyargs_len, pykw_len, parms_len, ret_len, flag, err= 0, kw_tot= 0, kw_arg;
+ int i, pyargs_len, pykw_len, parms_len, ret_len, flag, err = 0, kw_tot = 0, kw_arg;
- PropertyRNA *pret_single= NULL;
- void *retdata_single= NULL;
+ PropertyRNA *pret_single = NULL;
+ void *retdata_single = NULL;
/* enable this so all strings are copied and freed after calling.
* this exposes bugs where the pointer to the string is held and re-used */
// #define DEBUG_STRING_FREE
#ifdef DEBUG_STRING_FREE
- PyObject *string_free_ls= PyList_New(0);
+ PyObject *string_free_ls = PyList_New(0);
#endif
/* Should never happen but it does in rare cases */
BLI_assert(self_ptr != NULL);
- if (self_ptr==NULL) {
+ if (self_ptr == NULL) {
PyErr_SetString(PyExc_RuntimeError, "rna functions internal rna pointer is NULL, this is a bug. aborting");
return NULL;
}
- if (self_func==NULL) {
+ if (self_func == NULL) {
PyErr_Format(PyExc_RuntimeError,
"%.200s.<unknown>(): rna function internal function is NULL, this is a bug. aborting",
RNA_struct_identifier(self_ptr->type));
@@ -4834,13 +4838,13 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
* the same ID as the functions. */
RNA_pointer_create(self_ptr->id.data, &RNA_Function, self_func, &funcptr);
- pyargs_len= PyTuple_GET_SIZE(args);
- pykw_len= kw ? PyDict_Size(kw) : 0;
+ pyargs_len = PyTuple_GET_SIZE(args);
+ pykw_len = kw ? PyDict_Size(kw) : 0;
RNA_parameter_list_create(&parms, self_ptr, self_func);
RNA_parameter_list_begin(&parms, &iter);
- parms_len= RNA_parameter_list_arg_count(&parms);
- ret_len= 0;
+ parms_len = RNA_parameter_list_arg_count(&parms);
+ ret_len = 0;
if (pyargs_len + pykw_len > parms_len) {
RNA_parameter_list_end(&iter);
@@ -4848,53 +4852,53 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
"%.200s.%.200s(): takes at most %d arguments, got %d",
RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func),
parms_len, pyargs_len + pykw_len);
- err= -1;
+ err = -1;
}
/* parse function parameters */
- for (i= 0; iter.valid && err==0; RNA_parameter_list_next(&iter)) {
- parm= iter.parm;
- flag= RNA_property_flag(parm);
+ for (i = 0; iter.valid && err == 0; RNA_parameter_list_next(&iter)) {
+ parm = iter.parm;
+ flag = RNA_property_flag(parm);
/* only useful for single argument returns, we'll need another list loop for multiple */
if (flag & PROP_OUTPUT) {
ret_len++;
- if (pret_single==NULL) {
- pret_single= parm;
- retdata_single= iter.data;
+ if (pret_single == NULL) {
+ pret_single = parm;
+ retdata_single = iter.data;
}
continue;
}
- item= NULL;
+ item = NULL;
if (i < pyargs_len) {
- item= PyTuple_GET_ITEM(args, i);
- kw_arg= FALSE;
+ item = PyTuple_GET_ITEM(args, i);
+ kw_arg = FALSE;
}
else if (kw != NULL) {
#if 0
- item= PyDict_GetItemString(kw, RNA_property_identifier(parm)); /* borrow ref */
+ item = PyDict_GetItemString(kw, RNA_property_identifier(parm)); /* borrow ref */
#else
- item= small_dict_get_item_string(kw, RNA_property_identifier(parm)); /* borrow ref */
+ item = small_dict_get_item_string(kw, RNA_property_identifier(parm)); /* borrow ref */
#endif
if (item)
kw_tot++; /* make sure invalid keywords are not given */
- kw_arg= TRUE;
+ kw_arg = TRUE;
}
i++; /* current argument */
- if (item==NULL) {
+ if (item == NULL) {
if (flag & PROP_REQUIRED) {
PyErr_Format(PyExc_TypeError,
"%.200s.%.200s(): required parameter \"%.200s\" not specified",
RNA_struct_identifier(self_ptr->type),
RNA_function_identifier(self_func),
RNA_property_identifier(parm));
- err= -1;
+ err = -1;
break;
}
else { /* PyDict_GetItemString wont raise an error */
@@ -4905,21 +4909,21 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#ifdef DEBUG_STRING_FREE
if (item) {
if (PyUnicode_Check(item)) {
- item= PyUnicode_FromString(_PyUnicode_AsString(item));
+ item = PyUnicode_FromString(_PyUnicode_AsString(item));
PyList_Append(string_free_ls, item);
Py_DECREF(item);
}
}
#endif
- err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, "");
+ err = pyrna_py_to_prop(&funcptr, parm, iter.data, item, "");
- if (err!=0) {
+ if (err != 0) {
/* the error generated isn't that useful, so generate it again with a useful prefix
* could also write a function to prepend to error messages */
char error_prefix[512];
PyErr_Clear(); /* re-raise */
- if (kw_arg==TRUE)
+ if (kw_arg == TRUE)
BLI_snprintf(error_prefix, sizeof(error_prefix),
"%.200s.%.200s(): error with keyword argument \"%.200s\" - ",
RNA_struct_identifier(self_ptr->type),
@@ -4948,59 +4952,59 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
*/
if (err == 0 && kw && (pykw_len > kw_tot)) {
PyObject *key, *value;
- Py_ssize_t pos= 0;
+ Py_ssize_t pos = 0;
- DynStr *bad_args= BLI_dynstr_new();
- DynStr *good_args= BLI_dynstr_new();
+ DynStr *bad_args = BLI_dynstr_new();
+ DynStr *good_args = BLI_dynstr_new();
const char *arg_name, *bad_args_str, *good_args_str;
- int found= FALSE, first= TRUE;
+ int found = FALSE, first = TRUE;
while (PyDict_Next(kw, &pos, &key, &value)) {
- arg_name= _PyUnicode_AsString(key);
- found= FALSE;
+ arg_name = _PyUnicode_AsString(key);
+ found = FALSE;
- if (arg_name==NULL) { /* unlikely the argname is not a string but ignore if it is*/
+ if (arg_name == NULL) { /* unlikely the argname is not a string but ignore if it is*/
PyErr_Clear();
}
else {
/* Search for arg_name */
RNA_parameter_list_begin(&parms, &iter);
for (; iter.valid; RNA_parameter_list_next(&iter)) {
- parm= iter.parm;
- if (strcmp(arg_name, RNA_property_identifier(parm))==0) {
- found= TRUE;
+ parm = iter.parm;
+ if (strcmp(arg_name, RNA_property_identifier(parm)) == 0) {
+ found = TRUE;
break;
}
}
RNA_parameter_list_end(&iter);
- if (found==FALSE) {
+ if (found == FALSE) {
BLI_dynstr_appendf(bad_args, first ? "%s" : ", %s", arg_name);
- first= FALSE;
+ first = FALSE;
}
}
}
/* list good args */
- first= TRUE;
+ first = TRUE;
RNA_parameter_list_begin(&parms, &iter);
for (; iter.valid; RNA_parameter_list_next(&iter)) {
- parm= iter.parm;
+ parm = iter.parm;
if (RNA_property_flag(parm) & PROP_OUTPUT)
continue;
BLI_dynstr_appendf(good_args, first ? "%s" : ", %s", RNA_property_identifier(parm));
- first= FALSE;
+ first = FALSE;
}
RNA_parameter_list_end(&iter);
- bad_args_str= BLI_dynstr_get_cstring(bad_args);
- good_args_str= BLI_dynstr_get_cstring(good_args);
+ bad_args_str = BLI_dynstr_get_cstring(bad_args);
+ good_args_str = BLI_dynstr_get_cstring(good_args);
PyErr_Format(PyExc_TypeError,
"%.200s.%.200s(): was called with invalid keyword arguments(s) (%s), expected (%s)",
@@ -5012,32 +5016,32 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
MEM_freeN((void *)bad_args_str);
MEM_freeN((void *)good_args_str);
- err= -1;
+ err = -1;
}
- ret= NULL;
- if (err==0) {
+ ret = NULL;
+ if (err == 0) {
/* call function */
ReportList reports;
- bContext *C= BPy_GetContext();
+ bContext *C = BPy_GetContext();
BKE_reports_init(&reports, RPT_STORE);
RNA_function_call(C, &reports, self_ptr, self_func, &parms);
- err= (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE));
+ err = (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE));
/* return value */
if (err != -1) {
if (ret_len > 0) {
if (ret_len > 1) {
- ret= PyTuple_New(ret_len);
- i= 0; /* arg index */
+ ret = PyTuple_New(ret_len);
+ i = 0; /* arg index */
RNA_parameter_list_begin(&parms, &iter);
for (; iter.valid; RNA_parameter_list_next(&iter)) {
- parm= iter.parm;
- flag= RNA_property_flag(parm);
+ parm = iter.parm;
+ flag = RNA_property_flag(parm);
if (flag & PROP_OUTPUT)
PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data));
@@ -5046,11 +5050,11 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
RNA_parameter_list_end(&iter);
}
else
- ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single);
+ ret = pyrna_param_to_py(&funcptr, pret_single, retdata_single);
/* possible there is an error in conversion */
- if (ret==NULL)
- err= -1;
+ if (ret == NULL)
+ err = -1;
}
}
}
@@ -5069,7 +5073,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
if (ret)
return ret;
- if (err==-1)
+ if (err == -1)
return NULL;
Py_RETURN_NONE;
@@ -5078,7 +5082,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
/* subclasses of pyrna_struct_Type which support idprop definitions use this as a metaclass */
/* note: tp_base member is set to &PyType_Type on init */
-PyTypeObject pyrna_struct_meta_idprop_Type= {
+PyTypeObject pyrna_struct_meta_idprop_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_struct_meta_idprop", /* tp_name */
sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's
@@ -5160,7 +5164,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= {
/*-----------------------BPy_StructRNA method def------------------------------*/
-PyTypeObject pyrna_struct_Type= {
+PyTypeObject pyrna_struct_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_struct", /* tp_name */
sizeof(BPy_StructRNA), /* tp_basicsize */
@@ -5249,7 +5253,7 @@ PyTypeObject pyrna_struct_Type= {
};
/*-----------------------BPy_PropertyRNA method def------------------------------*/
-PyTypeObject pyrna_prop_Type= {
+PyTypeObject pyrna_prop_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop", /* tp_name */
sizeof(BPy_PropertyRNA), /* tp_basicsize */
@@ -5333,7 +5337,7 @@ PyTypeObject pyrna_prop_Type= {
NULL
};
-PyTypeObject pyrna_prop_array_Type= {
+PyTypeObject pyrna_prop_array_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_array", /* tp_name */
sizeof(BPy_PropertyArrayRNA), /* tp_basicsize */
@@ -5416,7 +5420,7 @@ PyTypeObject pyrna_prop_array_Type= {
NULL
};
-PyTypeObject pyrna_prop_collection_Type= {
+PyTypeObject pyrna_prop_collection_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_collection", /* tp_name */
sizeof(BPy_PropertyRNA), /* tp_basicsize */
@@ -5501,7 +5505,7 @@ PyTypeObject pyrna_prop_collection_Type= {
};
/* only for add/remove/move methods */
-static PyTypeObject pyrna_prop_collection_idprop_Type= {
+static PyTypeObject pyrna_prop_collection_idprop_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_collection_idprop", /* tp_name */
sizeof(BPy_PropertyRNA), /* tp_basicsize */
@@ -5586,7 +5590,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= {
};
/*-----------------------BPy_PropertyRNA method def------------------------------*/
-PyTypeObject pyrna_func_Type= {
+PyTypeObject pyrna_func_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_func", /* tp_name */
sizeof(BPy_FunctionRNA), /* tp_basicsize */
@@ -5682,7 +5686,7 @@ PyTypeObject pyrna_func_Type= {
static void pyrna_prop_collection_iter_dealloc(BPy_PropertyCollectionIterRNA *self);
static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self);
-PyTypeObject pyrna_prop_collection_iter_Type= {
+PyTypeObject pyrna_prop_collection_iter_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_collection_iter", /* tp_name */
sizeof(BPy_PropertyCollectionIterRNA), /* tp_basicsize */
@@ -5775,10 +5779,10 @@ PyTypeObject pyrna_prop_collection_iter_Type= {
PyObject *pyrna_prop_collection_iter_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
{
- BPy_PropertyCollectionIterRNA *self= PyObject_New(BPy_PropertyCollectionIterRNA, &pyrna_prop_collection_iter_Type);
+ BPy_PropertyCollectionIterRNA *self = PyObject_New(BPy_PropertyCollectionIterRNA, &pyrna_prop_collection_iter_Type);
#ifdef USE_WEAKREFS
- self->in_weakreflist= NULL;
+ self->in_weakreflist = NULL;
#endif
RNA_property_collection_begin(ptr, prop, &self->iter);
@@ -5798,7 +5802,7 @@ static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *
return NULL;
}
else {
- BPy_StructRNA *pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&self->iter.ptr);
+ BPy_StructRNA *pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&self->iter.ptr);
#ifdef USE_PYRNA_STRUCT_REFERENCE
if (pyrna) { /* unlikely but may fail */
@@ -5854,7 +5858,7 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
/* python deals with the circular ref */
RNA_pointer_create(NULL, &RNA_Struct, srna, &ptr);
- item= pyrna_struct_CreatePyObject(&ptr);
+ item = pyrna_struct_CreatePyObject(&ptr);
/* note, must set the class not the __dict__ else the internal slots are not updated correctly */
PyObject_SetAttr(newclass, bpy_intern_str_bl_rna, item);
@@ -5871,19 +5875,19 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict
/* Assume RNA_struct_py_type_get(srna) was already checked */
StructRNA *base;
- PyObject *py_base= NULL;
+ PyObject *py_base = NULL;
/* get the base type */
- base= RNA_struct_base(srna);
+ base = RNA_struct_base(srna);
if (base && base != srna) {
/*/printf("debug subtype %s %p\n", RNA_struct_identifier(srna), srna); */
- py_base= pyrna_srna_Subtype(base); //, bpy_types_dict);
+ py_base = pyrna_srna_Subtype(base); //, bpy_types_dict);
Py_DECREF(py_base); /* srna owns, this is only to pass as an arg */
}
- if (py_base==NULL) {
- py_base= (PyObject *)&pyrna_struct_Type;
+ if (py_base == NULL) {
+ py_base = (PyObject *)&pyrna_struct_Type;
}
return py_base;
@@ -5891,47 +5895,47 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict
/* check if we have a native python subclass, use it when it exists
* return a borrowed reference */
-static PyObject *bpy_types_dict= NULL;
+static PyObject *bpy_types_dict = NULL;
static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
{
- const char *idname= RNA_struct_identifier(srna);
+ const char *idname = RNA_struct_identifier(srna);
PyObject *newclass;
- if (bpy_types_dict==NULL) {
- PyObject *bpy_types= PyImport_ImportModuleLevel((char *)"bpy_types", NULL, NULL, NULL, 0);
+ if (bpy_types_dict == NULL) {
+ PyObject *bpy_types = PyImport_ImportModuleLevel((char *)"bpy_types", NULL, NULL, NULL, 0);
- if (bpy_types==NULL) {
+ if (bpy_types == NULL) {
PyErr_Print();
PyErr_Clear();
fprintf(stderr, "%s: failed to find 'bpy_types' module\n", __func__);
return NULL;
}
- bpy_types_dict= PyModule_GetDict(bpy_types); // borrow
+ bpy_types_dict = PyModule_GetDict(bpy_types); // borrow
Py_DECREF(bpy_types); // fairly safe to assume the dict is kept
}
- newclass= PyDict_GetItemString(bpy_types_dict, idname);
+ newclass = PyDict_GetItemString(bpy_types_dict, idname);
/* sanity check, could skip this unless in debug mode */
if (newclass) {
- PyObject *base_compare= pyrna_srna_PyBase(srna);
- //PyObject *slots= PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values!
- //PyObject *bases= PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to.
- PyObject *tp_bases= ((PyTypeObject *)newclass)->tp_bases;
- PyObject *tp_slots= PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__);
+ PyObject *base_compare = pyrna_srna_PyBase(srna);
+ //PyObject *slots = PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values!
+ //PyObject *bases = PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to.
+ PyObject *tp_bases = ((PyTypeObject *)newclass)->tp_bases;
+ PyObject *tp_slots = PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__);
- if (tp_slots==NULL) {
+ if (tp_slots == NULL) {
fprintf(stderr, "%s: expected class '%s' to have __slots__ defined\n\nSee bpy_types.py\n", __func__, idname);
- newclass= NULL;
+ newclass = NULL;
}
else if (PyTuple_GET_SIZE(tp_bases)) {
- PyObject *base= PyTuple_GET_ITEM(tp_bases, 0);
+ PyObject *base = PyTuple_GET_ITEM(tp_bases, 0);
if (base_compare != base) {
fprintf(stderr, "%s: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", __func__, idname);
PyC_ObSpit("Expected! ", base_compare);
- newclass= NULL;
+ newclass = NULL;
}
else {
if (G.f & G_DEBUG)
@@ -5945,16 +5949,16 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
static PyObject* pyrna_srna_Subtype(StructRNA *srna)
{
- PyObject *newclass= NULL;
+ PyObject *newclass = NULL;
/* stupid/simple case */
if (srna == NULL) {
- newclass= NULL; /* Nothing to do */
+ newclass = NULL; /* Nothing to do */
} /* the class may have already been declared & allocated */
- else if ((newclass= RNA_struct_py_type_get(srna))) {
+ else if ((newclass = RNA_struct_py_type_get(srna))) {
Py_INCREF(newclass);
} /* check if bpy_types.py module has the class defined in it */
- else if ((newclass= pyrna_srna_ExternalType(srna))) {
+ else if ((newclass = pyrna_srna_ExternalType(srna))) {
pyrna_subtype_set_rna(newclass, srna);
Py_INCREF(newclass);
} /* create a new class instance with the C api
@@ -5962,32 +5966,32 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
else {
/* subclass equivalents
- class myClass(myBase):
- some='value' # or ...
- - myClass= type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
+ some = 'value' # or ...
+ - myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
*/
/* Assume RNA_struct_py_type_get(srna) was already checked */
- PyObject *py_base= pyrna_srna_PyBase(srna);
+ PyObject *py_base = pyrna_srna_PyBase(srna);
PyObject *metaclass;
- const char *idname= RNA_struct_identifier(srna);
+ const char *idname = RNA_struct_identifier(srna);
/* remove __doc__ for now */
- // const char *descr= RNA_struct_ui_description(srna);
- // if (!descr) descr= "(no docs)";
+ // const char *descr = RNA_struct_ui_description(srna);
+ // if (!descr) descr = "(no docs)";
// "__doc__", descr
if ( RNA_struct_idprops_check(srna) &&
!PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
{
- metaclass= (PyObject *)&pyrna_struct_meta_idprop_Type;
+ metaclass = (PyObject *)&pyrna_struct_meta_idprop_Type;
}
else {
- metaclass= (PyObject *)&PyType_Type;
+ metaclass = (PyObject *)&PyType_Type;
}
/* always use O not N when calling, N causes refcount errors */
- newclass= PyObject_CallFunction(metaclass, (char *)"s(O){sss()}",
- idname, py_base, "__module__","bpy.types", "__slots__");
+ newclass = PyObject_CallFunction(metaclass, (char *)"s(O){sss()}",
+ idname, py_base, "__module__","bpy.types", "__slots__");
/* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */
@@ -6031,24 +6035,24 @@ static PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
/*-----------------------CreatePyObject---------------------------------*/
PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
{
- BPy_StructRNA *pyrna= NULL;
+ BPy_StructRNA *pyrna = NULL;
/* note: don't rely on this to return None since NULL data with a valid type can often crash */
- if (ptr->data==NULL && ptr->type==NULL) { /* Operator RNA has NULL data */
+ if (ptr->data == NULL && ptr->type == NULL) { /* Operator RNA has NULL data */
Py_RETURN_NONE;
}
else {
- PyTypeObject *tp= (PyTypeObject *)pyrna_struct_Subtype(ptr);
+ PyTypeObject *tp = (PyTypeObject *)pyrna_struct_Subtype(ptr);
if (tp) {
- pyrna= (BPy_StructRNA *) tp->tp_alloc(tp, 0);
+ pyrna = (BPy_StructRNA *) tp->tp_alloc(tp, 0);
Py_DECREF(tp); /* srna owns, cant hold a ref */
}
else {
fprintf(stderr, "%s: could not make type\n", __func__);
- pyrna= (BPy_StructRNA *) PyObject_GC_New(BPy_StructRNA, &pyrna_struct_Type);
+ pyrna = (BPy_StructRNA *) PyObject_GC_New(BPy_StructRNA, &pyrna_struct_Type);
#ifdef USE_WEAKREFS
- pyrna->in_weakreflist= NULL;
+ pyrna->in_weakreflist = NULL;
#endif
}
}
@@ -6058,13 +6062,13 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
return NULL;
}
- pyrna->ptr= *ptr;
+ pyrna->ptr = *ptr;
#ifdef PYRNA_FREE_SUPPORT
- pyrna->freeptr= FALSE;
+ pyrna->freeptr = FALSE;
#endif
#ifdef USE_PYRNA_STRUCT_REFERENCE
- pyrna->reference= NULL;
+ pyrna->reference = NULL;
#endif
// PyC_ObSpit("NewStructRNA: ", (PyObject *)pyrna);
@@ -6085,28 +6089,28 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
PyTypeObject *type;
if (RNA_property_type(prop) != PROP_COLLECTION) {
- type= &pyrna_prop_Type;
+ type = &pyrna_prop_Type;
}
else {
if ((RNA_property_flag(prop) & PROP_IDPROPERTY) == 0) {
- type= &pyrna_prop_collection_Type;
+ type = &pyrna_prop_collection_Type;
}
else {
- type= &pyrna_prop_collection_idprop_Type;
+ type = &pyrna_prop_collection_idprop_Type;
}
}
- pyrna= (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyRNA, type);
+ pyrna = (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyRNA, type);
#ifdef USE_WEAKREFS
- pyrna->in_weakreflist= NULL;
+ pyrna->in_weakreflist = NULL;
#endif
}
else {
- pyrna= (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyArrayRNA, &pyrna_prop_array_Type);
- ((BPy_PropertyArrayRNA *)pyrna)->arraydim= 0;
- ((BPy_PropertyArrayRNA *)pyrna)->arrayoffset= 0;
+ pyrna = (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyArrayRNA, &pyrna_prop_array_Type);
+ ((BPy_PropertyArrayRNA *)pyrna)->arraydim = 0;
+ ((BPy_PropertyArrayRNA *)pyrna)->arrayoffset = 0;
#ifdef USE_WEAKREFS
- ((BPy_PropertyArrayRNA *)pyrna)->in_weakreflist= NULL;
+ ((BPy_PropertyArrayRNA *)pyrna)->in_weakreflist = NULL;
#endif
}
@@ -6115,8 +6119,8 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
return NULL;
}
- pyrna->ptr= *ptr;
- pyrna->prop= prop;
+ pyrna->ptr = *ptr;
+ pyrna->prop = prop;
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
if (ptr->id.data) {
@@ -6130,16 +6134,16 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
void BPY_rna_init(void)
{
#ifdef USE_MATHUTILS // register mathutils callbacks, ok to run more then once.
- mathutils_rna_array_cb_index= Mathutils_RegisterCallback(&mathutils_rna_array_cb);
- mathutils_rna_matrix_cb_index= Mathutils_RegisterCallback(&mathutils_rna_matrix_cb);
+ mathutils_rna_array_cb_index = Mathutils_RegisterCallback(&mathutils_rna_array_cb);
+ mathutils_rna_matrix_cb_index = Mathutils_RegisterCallback(&mathutils_rna_matrix_cb);
#endif
/* for some reason MSVC complains of these */
#if defined(_MSC_VER) || defined(FREE_WINDOWS)
- pyrna_struct_meta_idprop_Type.tp_base= &PyType_Type;
+ pyrna_struct_meta_idprop_Type.tp_base = &PyType_Type;
- pyrna_prop_collection_iter_Type.tp_iter= PyObject_SelfIter;
- pyrna_prop_collection_iter_Type.tp_getattro= PyObject_GenericGetAttr;
+ pyrna_prop_collection_iter_Type.tp_iter = PyObject_SelfIter;
+ pyrna_prop_collection_iter_Type.tp_getattro = PyObject_GenericGetAttr;
#endif
/* metaclass */
@@ -6171,7 +6175,7 @@ void BPY_rna_init(void)
}
/* bpy.data from python */
-static PointerRNA *rna_module_ptr= NULL;
+static PointerRNA *rna_module_ptr = NULL;
PyObject *BPY_rna_module(void)
{
BPy_StructRNA *pyrna;
@@ -6179,9 +6183,9 @@ PyObject *BPY_rna_module(void)
/* for now, return the base RNA type rather than a real module */
RNA_main_pointer_create(G.main, &ptr);
- pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
+ pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
- rna_module_ptr= &pyrna->ptr;
+ rna_module_ptr = &pyrna->ptr;
return (PyObject *)pyrna;
}
@@ -6190,7 +6194,7 @@ void BPY_update_rna_module(void)
#if 0
RNA_main_pointer_create(G.main, rna_module_ptr);
#else
- rna_module_ptr->data= G.main; /* just set data is enough */
+ rna_module_ptr->data = G.main; /* just set data is enough */
#endif
}
@@ -6216,15 +6220,15 @@ static PyObject *pyrna_basetype_getattro(BPy_BaseTypeRNA *self, PyObject *pyname
{
PointerRNA newptr;
PyObject *ret;
- const char *name= _PyUnicode_AsString(pyname);
+ const char *name = _PyUnicode_AsString(pyname);
if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy.types: __getattr__ must be a string");
- ret= NULL;
+ ret = NULL;
}
else if (RNA_property_collection_lookup_string(&self->ptr, self->prop, name, &newptr)) {
- ret= pyrna_struct_Subtype(&newptr);
- if (ret==NULL) {
+ ret = pyrna_struct_Subtype(&newptr);
+ if (ret == NULL) {
PyErr_Format(PyExc_RuntimeError,
"bpy.types.%.200s subtype could not be generated, this is a bug!",
_PyUnicode_AsString(pyname));
@@ -6238,7 +6242,7 @@ static PyObject *pyrna_basetype_getattro(BPy_BaseTypeRNA *self, PyObject *pyname
return NULL;
#endif
/* The error raised here will be displayed */
- ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
+ ret = PyObject_GenericGetAttr((PyObject *)self, pyname);
}
return ret;
@@ -6248,7 +6252,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self);
static PyObject *pyrna_register_class(PyObject *self, PyObject *py_class);
static PyObject *pyrna_unregister_class(PyObject *self, PyObject *py_class);
-static struct PyMethodDef pyrna_basetype_methods[]= {
+static struct PyMethodDef pyrna_basetype_methods[] = {
{"__dir__", (PyCFunction)pyrna_basetype_dir, METH_NOARGS, ""},
{NULL, NULL, 0, NULL}
};
@@ -6261,11 +6265,11 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
PyMethodDef *meth;
#endif
- list= pyrna_prop_collection_keys(self); /* like calling structs.keys(), avoids looping here */
+ list = pyrna_prop_collection_keys(self); /* like calling structs.keys(), avoids looping here */
#if 0 /* for now only contains __dir__ */
- for (meth=pyrna_basetype_methods; meth->ml_name; meth++) {
- name= PyUnicode_FromString(meth->ml_name);
+ for (meth = pyrna_basetype_methods; meth->ml_name; meth++) {
+ name = PyUnicode_FromString(meth->ml_name);
PyList_Append(list, name);
Py_DECREF(name);
}
@@ -6273,53 +6277,53 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
return list;
}
-static PyTypeObject pyrna_basetype_Type= BLANK_PYTHON_TYPE;
+static PyTypeObject pyrna_basetype_Type = BLANK_PYTHON_TYPE;
PyObject *BPY_rna_types(void)
{
BPy_BaseTypeRNA *self;
- if ((pyrna_basetype_Type.tp_flags & Py_TPFLAGS_READY)==0) {
- pyrna_basetype_Type.tp_name= "RNA_Types";
- pyrna_basetype_Type.tp_basicsize= sizeof(BPy_BaseTypeRNA);
- pyrna_basetype_Type.tp_getattro= (getattrofunc) pyrna_basetype_getattro;
- pyrna_basetype_Type.tp_flags= Py_TPFLAGS_DEFAULT;
- pyrna_basetype_Type.tp_methods= pyrna_basetype_methods;
+ if ((pyrna_basetype_Type.tp_flags & Py_TPFLAGS_READY) == 0) {
+ pyrna_basetype_Type.tp_name = "RNA_Types";
+ pyrna_basetype_Type.tp_basicsize = sizeof(BPy_BaseTypeRNA);
+ pyrna_basetype_Type.tp_getattro = (getattrofunc) pyrna_basetype_getattro;
+ pyrna_basetype_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+ pyrna_basetype_Type.tp_methods = pyrna_basetype_methods;
if (PyType_Ready(&pyrna_basetype_Type) < 0)
return NULL;
}
- self= (BPy_BaseTypeRNA *)PyObject_NEW(BPy_BaseTypeRNA, &pyrna_basetype_Type);
+ self = (BPy_BaseTypeRNA *)PyObject_NEW(BPy_BaseTypeRNA, &pyrna_basetype_Type);
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&self->ptr);
- self->prop= RNA_struct_find_property(&self->ptr, "structs");
+ self->prop = RNA_struct_find_property(&self->ptr, "structs");
#ifdef USE_WEAKREFS
- self->in_weakreflist= NULL;
+ self->in_weakreflist = NULL;
#endif
return (PyObject *)self;
}
StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_prefix)
{
- BPy_StructRNA *py_srna= NULL;
+ BPy_StructRNA *py_srna = NULL;
StructRNA *srna;
/* ack, PyObject_GetAttrString wont look up this types tp_dict first :/ */
if (PyType_Check(self)) {
- py_srna= (BPy_StructRNA *)PyDict_GetItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna);
+ py_srna = (BPy_StructRNA *)PyDict_GetItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna);
Py_XINCREF(py_srna);
}
if (parent) {
/* be very careful with this since it will return a parent classes srna.
* modifying this will do confusing stuff! */
- if (py_srna==NULL)
- py_srna= (BPy_StructRNA*)PyObject_GetAttr(self, bpy_intern_str_bl_rna);
+ if (py_srna == NULL)
+ py_srna = (BPy_StructRNA *)PyObject_GetAttr(self, bpy_intern_str_bl_rna);
}
- if (py_srna==NULL) {
+ if (py_srna == NULL) {
PyErr_Format(PyExc_RuntimeError,
"%.200s, missing bl_rna attribute from '%.200s' instance (may not be registered)",
error_prefix, Py_TYPE(self)->tp_name);
@@ -6343,7 +6347,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr
return NULL;
}
- srna= py_srna->ptr.data;
+ srna = py_srna->ptr.data;
Py_DECREF(py_srna);
return srna;
@@ -6356,13 +6360,13 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr
StructRNA *srna_from_self(PyObject *self, const char *error_prefix)
{
- if (self==NULL) {
+ if (self == NULL) {
return NULL;
}
else if (PyCapsule_CheckExact(self)) {
return PyCapsule_GetPointer(self, NULL);
}
- else if (PyType_Check(self)==0) {
+ else if (PyType_Check(self) == 0) {
return NULL;
}
else {
@@ -6375,7 +6379,7 @@ StructRNA *srna_from_self(PyObject *self, const char *error_prefix)
PyErr_Fetch(&error_type, &error_value, &error_traceback);
PyErr_Clear();
- srna= pyrna_struct_as_srna(self, 0, error_prefix);
+ srna = pyrna_struct_as_srna(self, 0, error_prefix);
if (!PyErr_Occurred()) {
PyErr_Restore(error_type, error_value, error_traceback);
@@ -6396,22 +6400,22 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
if (PyArg_ParseTuple(item, "OO!", &py_func, &PyDict_Type, &py_kw)) {
PyObject *args_fake;
- if (*_PyUnicode_AsString(key)=='_') {
+ if (*_PyUnicode_AsString(key) == '_') {
PyErr_Format(PyExc_ValueError,
"bpy_struct \"%.200s\" registration error: "
"%.200s could not register because the property starts with an '_'\n",
RNA_struct_identifier(srna), _PyUnicode_AsString(key));
return -1;
}
- py_srna_cobject= PyCapsule_New(srna, NULL, NULL);
+ py_srna_cobject = PyCapsule_New(srna, NULL, NULL);
/* not 100% nice :/, modifies the dict passed, should be ok */
PyDict_SetItem(py_kw, bpy_intern_str_attr, key);
- args_fake= PyTuple_New(1);
+ args_fake = PyTuple_New(1);
PyTuple_SET_ITEM(args_fake, 0, py_srna_cobject);
- py_ret= PyObject_Call(py_func, args_fake, py_kw);
+ py_ret = PyObject_Call(py_func, args_fake, py_kw);
Py_DECREF(args_fake); /* free's py_srna_cobject too */
@@ -6447,19 +6451,19 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
{
PyObject *item, *key;
PyObject *order;
- Py_ssize_t pos= 0;
- int ret= 0;
+ Py_ssize_t pos = 0;
+ int ret = 0;
/* in both cases PyDict_CheckExact(class_dict) will be true even
* though Operators have a metaclass dict namespace */
- if ((order= PyDict_GetItem(class_dict, bpy_intern_str_order)) && PyList_CheckExact(order)) {
- for (pos= 0; pos<PyList_GET_SIZE(order); pos++) {
- key= PyList_GET_ITEM(order, pos);
+ if ((order = PyDict_GetItem(class_dict, bpy_intern_str_order)) && PyList_CheckExact(order)) {
+ for (pos = 0; pos < PyList_GET_SIZE(order); pos++) {
+ key = PyList_GET_ITEM(order, pos);
/* however unlikely its possible
* fails in py 3.3 beta with __qualname__ */
- if ((item= PyDict_GetItem(class_dict, key))) {
- ret= deferred_register_prop(srna, key, item);
+ if ((item = PyDict_GetItem(class_dict, key))) {
+ ret = deferred_register_prop(srna, key, item);
if (ret != 0) {
break;
}
@@ -6468,7 +6472,7 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
}
else {
while (PyDict_Next(class_dict, &pos, &key, &item)) {
- ret= deferred_register_prop(srna, key, item);
+ ret = deferred_register_prop(srna, key, item);
if (ret != 0)
break;
@@ -6480,12 +6484,12 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject *py_class)
{
- const int len= PyTuple_GET_SIZE(py_class->tp_bases);
+ const int len = PyTuple_GET_SIZE(py_class->tp_bases);
int i, ret;
/* first scan base classes for registerable properties */
- for (i=0; i<len; i++) {
- PyTypeObject *py_superclass= (PyTypeObject *)PyTuple_GET_ITEM(py_class->tp_bases, i);
+ for (i = 0; i < len; i++) {
+ PyTypeObject *py_superclass = (PyTypeObject *)PyTuple_GET_ITEM(py_class->tp_bases, i);
/* the rules for using these base classes are not clear,
* 'object' is of course not worth looking into and
@@ -6499,7 +6503,7 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
if (py_superclass != &PyBaseObject_Type &&
!PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type)
) {
- ret= pyrna_deferred_register_class_recursive(srna, py_superclass);
+ ret = pyrna_deferred_register_class_recursive(srna, py_superclass);
if (ret != 0) {
return ret;
@@ -6525,13 +6529,13 @@ int pyrna_deferred_register_class(StructRNA *srna, PyObject *py_class)
static int rna_function_arg_count(FunctionRNA *func)
{
- const ListBase *lb= RNA_function_defined_parameters(func);
+ const ListBase *lb = RNA_function_defined_parameters(func);
PropertyRNA *parm;
Link *link;
- int count= (RNA_function_flag(func) & FUNC_NO_SELF) ? 0 : 1;
+ int count = (RNA_function_flag(func) & FUNC_NO_SELF) ? 0 : 1;
- for (link=lb->first; link; link=link->next) {
- parm= (PropertyRNA*)link;
+ for (link = lb->first; link; link = link->next) {
+ parm = (PropertyRNA *)link;
if (!(RNA_property_flag(parm) & PROP_OUTPUT))
count++;
}
@@ -6545,13 +6549,13 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
Link *link;
FunctionRNA *func;
PropertyRNA *prop;
- StructRNA *srna= dummyptr->type;
- const char *class_type= RNA_struct_identifier(srna);
- PyObject *py_class= (PyObject*)py_data;
- PyObject *base_class= RNA_struct_py_type_get(srna);
+ StructRNA *srna = dummyptr->type;
+ const char *class_type = RNA_struct_identifier(srna);
+ PyObject *py_class = (PyObject *)py_data;
+ PyObject *base_class = RNA_struct_py_type_get(srna);
PyObject *item;
int i, flag, arg_count, func_arg_count;
- const char *py_class_name= ((PyTypeObject *)py_class)->tp_name; // __name__
+ const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; // __name__
if (base_class) {
@@ -6564,22 +6568,22 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
}
/* verify callback functions */
- lb= RNA_struct_type_functions(srna);
- i= 0;
- for (link=lb->first; link; link=link->next) {
- func= (FunctionRNA*)link;
- flag= RNA_function_flag(func);
+ lb = RNA_struct_type_functions(srna);
+ i = 0;
+ for (link = lb->first; link; link = link->next) {
+ func = (FunctionRNA *)link;
+ flag = RNA_function_flag(func);
if (!(flag & FUNC_REGISTER))
continue;
- item= PyObject_GetAttrString(py_class, RNA_function_identifier(func));
+ item = PyObject_GetAttrString(py_class, RNA_function_identifier(func));
- have_function[i]= (item != NULL);
+ have_function[i] = (item != NULL);
i++;
- if (item==NULL) {
- if ((flag & FUNC_REGISTER_OPTIONAL)==0) {
+ if (item == NULL) {
+ if ((flag & FUNC_REGISTER_OPTIONAL) == 0) {
PyErr_Format(PyExc_AttributeError,
"expected %.200s, %.200s class to have an \"%.200s\" attribute",
class_type, py_class_name,
@@ -6592,16 +6596,16 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
else {
Py_DECREF(item); /* no need to keep a ref, the class owns it (technically we should keep a ref but...) */
if (flag & FUNC_NO_SELF) {
- if (PyMethod_Check(item)==0) {
+ if (PyMethod_Check(item) == 0) {
PyErr_Format(PyExc_TypeError,
"expected %.200s, %.200s class \"%.200s\" attribute to be a method, not a %.200s",
class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
return -1;
}
- item= ((PyMethodObject *)item)->im_func;
+ item = ((PyMethodObject *)item)->im_func;
}
else {
- if (PyFunction_Check(item)==0) {
+ if (PyFunction_Check(item) == 0) {
PyErr_Format(PyExc_TypeError,
"expected %.200s, %.200s class \"%.200s\" attribute to be a function, not a %.200s",
class_type, py_class_name, RNA_function_identifier(func), Py_TYPE(item)->tp_name);
@@ -6609,10 +6613,10 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
}
}
- func_arg_count= rna_function_arg_count(func);
+ func_arg_count = rna_function_arg_count(func);
if (func_arg_count >= 0) { /* -1 if we dont care*/
- arg_count= ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
+ arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
/* note, the number of args we check for and the number of args we give to
* @classmethods are different (quirk of python),
@@ -6632,24 +6636,24 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
}
/* verify properties */
- lb= RNA_struct_type_properties(srna);
- for (link=lb->first; link; link=link->next) {
+ lb = RNA_struct_type_properties(srna);
+ for (link = lb->first; link; link = link->next) {
const char *identifier;
- prop= (PropertyRNA*)link;
- flag= RNA_property_flag(prop);
+ prop = (PropertyRNA *)link;
+ flag = RNA_property_flag(prop);
if (!(flag & PROP_REGISTER))
continue;
- identifier= RNA_property_identifier(prop);
- item= PyObject_GetAttrString(py_class, identifier);
+ identifier = RNA_property_identifier(prop);
+ item = PyObject_GetAttrString(py_class, identifier);
- if (item==NULL) {
+ if (item == NULL) {
/* Sneaky workaround to use the class name as the bl_idname */
#define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
if (strcmp(identifier, rna_attr) == 0) { \
- item= PyObject_GetAttrString(py_class, py_attr); \
+ item = PyObject_GetAttrString(py_class, py_attr); \
if (item && item != Py_None) { \
if (pyrna_py_to_prop(dummyptr, prop, NULL, \
item, "validating class:") != 0) \
@@ -6691,36 +6695,36 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
{
PyObject *args;
- PyObject *ret= NULL, *py_srna= NULL, *py_class_instance= NULL, *parmitem;
+ PyObject *ret = NULL, *py_srna = NULL, *py_class_instance = NULL, *parmitem;
PyTypeObject *py_class;
- void **py_class_instance_store= NULL;
+ void **py_class_instance_store = NULL;
PropertyRNA *parm;
ParameterIterator iter;
PointerRNA funcptr;
- int err= 0, i, flag, ret_len=0;
- const char is_static= (RNA_function_flag(func) & FUNC_NO_SELF) != 0;
+ int err = 0, i, flag, ret_len = 0;
+ const char is_static = (RNA_function_flag(func) & FUNC_NO_SELF) != 0;
/* annoying!, need to check if the screen gets set to NULL which is a
* hint that the file was actually re-loaded. */
char is_valid_wm;
- PropertyRNA *pret_single= NULL;
- void *retdata_single= NULL;
+ PropertyRNA *pret_single = NULL;
+ void *retdata_single = NULL;
PyGILState_STATE gilstate;
#ifdef USE_PEDANTIC_WRITE
- const int is_operator= RNA_struct_is_a(ptr->type, &RNA_Operator);
- const char *func_id= RNA_function_identifier(func);
+ const int is_operator = RNA_struct_is_a(ptr->type, &RNA_Operator);
+ const char *func_id = RNA_function_identifier(func);
/* testing, for correctness, not operator and not draw function */
- const short is_readonly= ((strncmp("draw", func_id, 4) ==0) || /* draw or draw_header */
+ const short is_readonly = ((strncmp("draw", func_id, 4) == 0) || /* draw or draw_header */
/*strstr("render", func_id) ||*/
!is_operator);
#endif
- py_class= RNA_struct_py_type_get(ptr->type);
+ py_class = RNA_struct_py_type_get(ptr->type);
/* rare case. can happen when registering subclasses */
- if (py_class==NULL) {
+ if (py_class == NULL) {
fprintf(stderr, "%s: unable to get python class for rna struct '%.200s'\n",
__func__, RNA_struct_identifier(ptr->type));
return -1;
@@ -6728,10 +6732,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
/* XXX, this is needed because render engine calls without a context
* this should be supported at some point but at the moment its not! */
- if (C==NULL)
- C= BPy_GetContext();
+ if (C == NULL)
+ C = BPy_GetContext();
- is_valid_wm= (CTX_wm_manager(C) != NULL);
+ is_valid_wm = (CTX_wm_manager(C) != NULL);
bpy_context_set(C, &gilstate);
@@ -6742,29 +6746,29 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (instance) {
if (*instance) {
- py_class_instance= *instance;
+ py_class_instance = *instance;
Py_INCREF(py_class_instance);
}
else {
/* store the instance here once its created */
- py_class_instance_store= instance;
+ py_class_instance_store = instance;
}
}
}
/* end exception */
- if (py_class_instance==NULL)
- py_srna= pyrna_struct_CreatePyObject(ptr);
+ if (py_class_instance == NULL)
+ py_srna = pyrna_struct_CreatePyObject(ptr);
if (py_class_instance) {
/* special case, instance is cached */
}
else if (py_srna == NULL) {
- py_class_instance= NULL;
+ py_class_instance = NULL;
}
else if (py_srna == Py_None) { /* probably wont ever happen but possible */
Py_DECREF(py_srna);
- py_class_instance= NULL;
+ py_class_instance = NULL;
}
else {
#if 1
@@ -6774,106 +6778,106 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
*/
if (py_class->tp_init) {
#ifdef USE_PEDANTIC_WRITE
- const int prev_write= rna_disallow_writes;
- rna_disallow_writes= is_operator ? FALSE : TRUE; /* only operators can write on __init__ */
+ const int prev_write = rna_disallow_writes;
+ rna_disallow_writes = is_operator ? FALSE : TRUE; /* only operators can write on __init__ */
#endif
/* true in most cases even when the class its self doesn't define an __init__ function. */
- args= PyTuple_New(0);
+ args = PyTuple_New(0);
if (py_class->tp_init(py_srna, args, NULL) < 0) {
Py_DECREF(py_srna);
- py_srna= NULL;
+ py_srna = NULL;
/* err set below */
}
Py_DECREF(args);
#ifdef USE_PEDANTIC_WRITE
- rna_disallow_writes= prev_write;
+ rna_disallow_writes = prev_write;
#endif
}
- py_class_instance= py_srna;
+ py_class_instance = py_srna;
#else
- const int prev_write= rna_disallow_writes;
- rna_disallow_writes= TRUE;
+ const int prev_write = rna_disallow_writes;
+ rna_disallow_writes = TRUE;
/* 'almost' all the time calling the class isn't needed.
* We could just do...
- py_class_instance= py_srna;
+ py_class_instance = py_srna;
Py_INCREF(py_class_instance);
* This would work fine but means __init__ functions wouldnt run.
* none of blenders default scripts use __init__ but its nice to call it
* for general correctness. just to note why this is here when it could be safely removed.
*/
- args= PyTuple_New(1);
+ args = PyTuple_New(1);
PyTuple_SET_ITEM(args, 0, py_srna);
- py_class_instance= PyObject_Call(py_class, args, NULL);
+ py_class_instance = PyObject_Call(py_class, args, NULL);
Py_DECREF(args);
- rna_disallow_writes= prev_write;
+ rna_disallow_writes = prev_write;
#endif
if (py_class_instance == NULL) {
- err= -1; /* so the error is not overridden below */
+ err = -1; /* so the error is not overridden below */
}
else if (py_class_instance_store) {
- *py_class_instance_store= py_class_instance;
+ *py_class_instance_store = py_class_instance;
Py_INCREF(py_class_instance);
}
}
}
if (err != -1 && (is_static || py_class_instance)) { /* Initializing the class worked, now run its invoke function */
- PyObject *item= PyObject_GetAttrString((PyObject *)py_class, RNA_function_identifier(func));
-// flag= RNA_function_flag(func);
+ PyObject *item = PyObject_GetAttrString((PyObject *)py_class, RNA_function_identifier(func));
+// flag = RNA_function_flag(func);
if (item) {
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
- args= PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */
+ args = PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */
if (is_static) {
- i= 0;
+ i = 0;
}
else {
PyTuple_SET_ITEM(args, 0, py_class_instance);
- i= 1;
+ i = 1;
}
RNA_parameter_list_begin(parms, &iter);
/* parse function parameters */
for (; iter.valid; RNA_parameter_list_next(&iter)) {
- parm= iter.parm;
- flag= RNA_property_flag(parm);
+ parm = iter.parm;
+ flag = RNA_property_flag(parm);
/* only useful for single argument returns, we'll need another list loop for multiple */
if (flag & PROP_OUTPUT) {
ret_len++;
- if (pret_single==NULL) {
- pret_single= parm;
- retdata_single= iter.data;
+ if (pret_single == NULL) {
+ pret_single = parm;
+ retdata_single = iter.data;
}
continue;
}
- parmitem= pyrna_param_to_py(&funcptr, parm, iter.data);
+ parmitem = pyrna_param_to_py(&funcptr, parm, iter.data);
PyTuple_SET_ITEM(args, i, parmitem);
i++;
}
#ifdef USE_PEDANTIC_WRITE
- rna_disallow_writes= is_readonly ? TRUE:FALSE;
+ rna_disallow_writes = is_readonly ? TRUE:FALSE;
#endif
/* *** Main Caller *** */
- ret= PyObject_Call(item, args, NULL);
+ ret = PyObject_Call(item, args, NULL);
/* *** Done Calling *** */
#ifdef USE_PEDANTIC_WRITE
- rna_disallow_writes= FALSE;
+ rna_disallow_writes = FALSE;
#endif
RNA_parameter_list_end(&iter);
@@ -6886,7 +6890,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
PyErr_Format(PyExc_TypeError,
"could not find function %.200s in %.200s to execute callback",
RNA_function_identifier(func), RNA_struct_identifier(ptr->type));
- err= -1;
+ err = -1;
}
}
else {
@@ -6895,23 +6899,23 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
PyErr_Format(PyExc_RuntimeError,
"could not create instance of %.200s to call callback function %.200s",
RNA_struct_identifier(ptr->type), RNA_function_identifier(func));
- err= -1;
+ err = -1;
}
}
if (ret == NULL) { /* covers py_class_instance failing too */
- err= -1;
+ err = -1;
}
else {
- if (ret_len==0 && ret != Py_None) {
+ if (ret_len == 0 && ret != Py_None) {
PyErr_Format(PyExc_RuntimeError,
"expected class %.200s, function %.200s to return None, not %.200s",
RNA_struct_identifier(ptr->type), RNA_function_identifier(func),
Py_TYPE(ret)->tp_name);
- err= -1;
+ err = -1;
}
- else if (ret_len==1) {
- err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "");
+ else if (ret_len == 1) {
+ err = pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "");
/* when calling operator funcs only gives Function.result with
* no line number since the func has finished calling on error,
@@ -6926,32 +6930,32 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
}
else if (ret_len > 1) {
- if (PyTuple_Check(ret)==0) {
+ if (PyTuple_Check(ret) == 0) {
PyErr_Format(PyExc_RuntimeError,
"expected class %.200s, function %.200s to return a tuple of size %d, not %.200s",
RNA_struct_identifier(ptr->type), RNA_function_identifier(func),
ret_len, Py_TYPE(ret)->tp_name);
- err= -1;
+ err = -1;
}
else if (PyTuple_GET_SIZE(ret) != ret_len) {
PyErr_Format(PyExc_RuntimeError,
"class %.200s, function %.200s to returned %d items, expected %d",
RNA_struct_identifier(ptr->type), RNA_function_identifier(func),
PyTuple_GET_SIZE(ret), ret_len);
- err= -1;
+ err = -1;
}
else {
RNA_parameter_list_begin(parms, &iter);
/* parse function parameters */
- for (i= 0; iter.valid; RNA_parameter_list_next(&iter)) {
- parm= iter.parm;
- flag= RNA_property_flag(parm);
+ for (i = 0; iter.valid; RNA_parameter_list_next(&iter)) {
+ parm = iter.parm;
+ flag = RNA_property_flag(parm);
/* only useful for single argument returns, we'll need another list loop for multiple */
if (flag & PROP_OUTPUT) {
- err= pyrna_py_to_prop(&funcptr, parm, iter.data,
+ err = pyrna_py_to_prop(&funcptr, parm, iter.data,
PyTuple_GET_ITEM(ret, i++),
"calling class function:");
if (err) {
@@ -6969,17 +6973,17 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (err != 0) {
ReportList *reports;
/* alert the user, else they wont know unless they see the console. */
- if ( (!is_static) &&
- (ptr->data) &&
- (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
- (is_valid_wm == (CTX_wm_manager(C) != NULL)))
+ if ( (!is_static) &&
+ (ptr->data) &&
+ (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
+ (is_valid_wm == (CTX_wm_manager(C) != NULL)))
{
- wmOperator *op= ptr->data;
- reports= op->reports;
+ wmOperator *op = ptr->data;
+ reports = op->reports;
}
else {
/* wont alert users but they can view in 'info' space */
- reports= CTX_wm_reports(C);
+ reports = CTX_wm_reports(C);
}
BPy_errors_to_report(reports);
@@ -6996,13 +7000,13 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
static void bpy_class_free(void *pyob_ptr)
{
- PyObject *self= (PyObject *)pyob_ptr;
+ PyObject *self = (PyObject *)pyob_ptr;
PyGILState_STATE gilstate;
- gilstate= PyGILState_Ensure();
+ gilstate = PyGILState_Ensure();
// breaks re-registering classes
- // PyDict_Clear(((PyTypeObject*)self)->tp_dict);
+ // PyDict_Clear(((PyTypeObject *)self)->tp_dict);
//
// remove the rna attribute instead.
PyDict_DelItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna);
@@ -7028,14 +7032,14 @@ void pyrna_alloc_types(void)
PointerRNA ptr;
PropertyRNA *prop;
- gilstate= PyGILState_Ensure();
+ gilstate = PyGILState_Ensure();
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&ptr);
- prop= RNA_struct_find_property(&ptr, "structs");
+ prop = RNA_struct_find_property(&ptr, "structs");
RNA_PROP_BEGIN(&ptr, itemptr, prop) {
- PyObject *item= pyrna_struct_Subtype(&itemptr);
+ PyObject *item = pyrna_struct_Subtype(&itemptr);
if (item == NULL) {
if (PyErr_Occurred()) {
PyErr_Print();
@@ -7059,12 +7063,12 @@ void pyrna_free_types(void)
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&ptr);
- prop= RNA_struct_find_property(&ptr, "structs");
+ prop = RNA_struct_find_property(&ptr, "structs");
RNA_PROP_BEGIN(&ptr, itemptr, prop) {
- StructRNA *srna= srna_from_ptr(&itemptr);
- void *py_ptr= RNA_struct_py_type_get(srna);
+ StructRNA *srna = srna_from_ptr(&itemptr);
+ void *py_ptr = RNA_struct_py_type_get(srna);
if (py_ptr) {
#if 0 // XXX - should be able to do this but makes python crash on exit
@@ -7102,10 +7106,10 @@ PyDoc_STRVAR(pyrna_register_class_doc,
" subclass of a registerable blender class.\n"
"\n"
);
-PyMethodDef meth_bpy_register_class= {"register_class", pyrna_register_class, METH_O, pyrna_register_class_doc};
+PyMethodDef meth_bpy_register_class = {"register_class", pyrna_register_class, METH_O, pyrna_register_class_doc};
static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class)
{
- bContext *C= NULL;
+ bContext *C = NULL;
ReportList reports;
StructRegisterFunc reg;
StructRNA *srna;
@@ -7113,14 +7117,14 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
const char *identifier;
PyObject *py_cls_meth;
- if (PyDict_GetItem(((PyTypeObject*)py_class)->tp_dict, bpy_intern_str_bl_rna)) {
+ if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna)) {
PyErr_SetString(PyExc_AttributeError, "register_class(...): already registered as a subclass");
return NULL;
}
/* warning: gets parent classes srna, only for the register function */
- srna= pyrna_struct_as_srna(py_class, 1, "register_class(...):");
- if (srna==NULL)
+ srna = pyrna_struct_as_srna(py_class, 1, "register_class(...):");
+ if (srna == NULL)
return NULL;
/* fails in cases, cant use this check but would like to :| */
@@ -7128,13 +7132,13 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
if (RNA_struct_py_type_get(srna)) {
PyErr_Format(PyExc_ValueError,
"register_class(...): %.200s's parent class %.200s is already registered, this is not allowed",
- ((PyTypeObject*)py_class)->tp_name, RNA_struct_identifier(srna));
+ ((PyTypeObject *)py_class)->tp_name, RNA_struct_identifier(srna));
return NULL;
}
*/
/* check that we have a register callback for this type */
- reg= RNA_struct_register(srna);
+ reg = RNA_struct_register(srna);
if (!reg) {
PyErr_Format(PyExc_ValueError,
@@ -7145,15 +7149,15 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
}
/* get the context, so register callback can do necessary refreshes */
- C= BPy_GetContext();
+ C = BPy_GetContext();
/* call the register callback with reports & identifier */
BKE_reports_init(&reports, RPT_STORE);
- identifier= ((PyTypeObject*)py_class)->tp_name;
+ identifier = ((PyTypeObject *)py_class)->tp_name;
- srna_new= reg(CTX_data_main(C), &reports, py_class, identifier,
- bpy_class_validate, bpy_class_call, bpy_class_free);
+ srna_new = reg(CTX_data_main(C), &reports, py_class, identifier,
+ bpy_class_validate, bpy_class_call, bpy_class_free);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
@@ -7173,18 +7177,18 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
/* Can't use this because it returns a dict proxy
*
- * item= PyObject_GetAttrString(py_class, "__dict__");
+ * item = PyObject_GetAttrString(py_class, "__dict__");
*/
- if (pyrna_deferred_register_class(srna_new, py_class)!=0)
+ if (pyrna_deferred_register_class(srna_new, py_class) != 0)
return NULL;
/* call classed register method () */
- py_cls_meth= PyObject_GetAttr(py_class, bpy_intern_str_register);
+ py_cls_meth = PyObject_GetAttr(py_class, bpy_intern_str_register);
if (py_cls_meth == NULL) {
PyErr_Clear();
}
else {
- PyObject *ret= PyObject_CallObject(py_cls_meth, NULL);
+ PyObject *ret = PyObject_CallObject(py_cls_meth, NULL);
if (ret) {
Py_DECREF(ret);
}
@@ -7203,16 +7207,16 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN
LinkData *link;
/* verify properties */
- const ListBase *lb= RNA_struct_type_properties(srna);
+ const ListBase *lb = RNA_struct_type_properties(srna);
- for (link=lb->first; link; link=link->next) {
- prop= (PropertyRNA*)link;
+ for (link = lb->first; link; link = link->next) {
+ prop = (PropertyRNA *)link;
if (RNA_property_type(prop) == PROP_POINTER && !(RNA_property_flag(prop) & PROP_BUILTIN)) {
PointerRNA tptr;
RNA_pointer_create(NULL, &RNA_Struct, srna_props, &tptr);
if (RNA_property_pointer_type(&tptr, prop) == srna) {
- *prop_identifier= RNA_property_identifier(prop);
+ *prop_identifier = RNA_property_identifier(prop);
return 1;
}
}
@@ -7229,26 +7233,28 @@ PyDoc_STRVAR(pyrna_unregister_class_doc,
" If the class has an *unregister* class method it will be called\n"
" before unregistering.\n"
);
-PyMethodDef meth_bpy_unregister_class= {"unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc};
+PyMethodDef meth_bpy_unregister_class = {
+ "unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc
+};
static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_class)
{
- bContext *C= NULL;
+ bContext *C = NULL;
StructUnregisterFunc unreg;
StructRNA *srna;
PyObject *py_cls_meth;
- /*if (PyDict_GetItem(((PyTypeObject*)py_class)->tp_dict, bpy_intern_str_bl_rna)==NULL) {
+ /*if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna) == NULL) {
PWM_cursor_wait(0);
PyErr_SetString(PyExc_ValueError, "unregister_class(): not a registered as a subclass");
return NULL;
}*/
- srna= pyrna_struct_as_srna(py_class, 0, "unregister_class(...):");
- if (srna==NULL)
+ srna = pyrna_struct_as_srna(py_class, 0, "unregister_class(...):");
+ if (srna == NULL)
return NULL;
/* check that we have a unregister callback for this type */
- unreg= RNA_struct_unregister(srna);
+ unreg = RNA_struct_unregister(srna);
if (!unreg) {
PyErr_SetString(PyExc_ValueError,
@@ -7258,12 +7264,12 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
}
/* call classed unregister method */
- py_cls_meth= PyObject_GetAttr(py_class, bpy_intern_str_unregister);
+ py_cls_meth = PyObject_GetAttr(py_class, bpy_intern_str_unregister);
if (py_cls_meth == NULL) {
PyErr_Clear();
}
else {
- PyObject *ret= PyObject_CallObject(py_cls_meth, NULL);
+ PyObject *ret = PyObject_CallObject(py_cls_meth, NULL);
if (ret) {
Py_DECREF(ret);
}
@@ -7278,16 +7284,16 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
StructRNA *srna_iter;
PointerRNA ptr_rna;
PropertyRNA *prop_rna;
- const char *prop_identifier= NULL;
+ const char *prop_identifier = NULL;
RNA_blender_rna_pointer_create(&ptr_rna);
- prop_rna= RNA_struct_find_property(&ptr_rna, "structs");
+ prop_rna = RNA_struct_find_property(&ptr_rna, "structs");
/* loop over all structs */
RNA_PROP_BEGIN(&ptr_rna, itemptr, prop_rna) {
- srna_iter= itemptr.data;
+ srna_iter = itemptr.data;
if (pyrna_srna_contains_pointer_prop_srna(srna_iter, srna, &prop_identifier)) {
break;
}
@@ -7303,7 +7309,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
}
/* get the context, so register callback can do necessary refreshes */
- C= BPy_GetContext();
+ C = BPy_GetContext();
/* call unregister */
unreg(CTX_data_main(C), srna); /* calls bpy_class_free, this decref's py_class */
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 8f88814b3e4..2371ca7dc50 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -59,11 +59,11 @@ static int pyrna_struct_anim_args_parse(
PointerRNA *ptr, const char *error_prefix, const char *path,
const char **path_full, int *index)
{
- const int is_idbase= RNA_struct_is_ID(ptr->type);
+ const int is_idbase = RNA_struct_is_ID(ptr->type);
PropertyRNA *prop;
PointerRNA r_ptr;
- if (ptr->data==NULL) {
+ if (ptr->data == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s this struct has no data, can't be animated",
error_prefix);
@@ -72,9 +72,9 @@ static int pyrna_struct_anim_args_parse(
/* full paths can only be given from ID base */
if (is_idbase) {
- int r_index= -1;
- if (RNA_path_resolve_full(ptr, path, &r_ptr, &prop, &r_index)==0) {
- prop= NULL;
+ int r_index = -1;
+ if (RNA_path_resolve_full(ptr, path, &r_ptr, &prop, &r_index) == 0) {
+ prop = NULL;
}
else if (r_index != -1) {
PyErr_Format(PyExc_ValueError,
@@ -90,11 +90,11 @@ static int pyrna_struct_anim_args_parse(
}
}
else {
- prop= RNA_struct_find_property(ptr, path);
- r_ptr= *ptr;
+ prop = RNA_struct_find_property(ptr, path);
+ r_ptr = *ptr;
}
- if (prop==NULL) {
+ if (prop == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s property \"%s\" not found",
error_prefix, path);
@@ -110,7 +110,7 @@ static int pyrna_struct_anim_args_parse(
if (RNA_property_array_check(prop) == 0) {
if ((*index) == -1) {
- *index= 0;
+ *index = 0;
}
else {
PyErr_Format(PyExc_TypeError,
@@ -120,7 +120,7 @@ static int pyrna_struct_anim_args_parse(
}
}
else {
- int array_len= RNA_property_array_length(&r_ptr, prop);
+ int array_len = RNA_property_array_length(&r_ptr, prop);
if ((*index) < -1 || (*index) >= array_len) {
PyErr_Format(PyExc_TypeError,
"%.200s index out of range \"%s\", given %d, array length is %d",
@@ -130,12 +130,12 @@ static int pyrna_struct_anim_args_parse(
}
if (is_idbase) {
- *path_full= BLI_strdup(path);
+ *path_full = BLI_strdup(path);
}
else {
- *path_full= RNA_path_from_ID_to_property(&r_ptr, prop);
+ *path_full = RNA_path_from_ID_to_property(&r_ptr, prop);
- if (*path_full==NULL) {
+ if (*path_full == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s could not make path to \"%s\"",
error_prefix, path);
@@ -148,10 +148,10 @@ static int pyrna_struct_anim_args_parse(
/* internal use for insert and delete */
static int pyrna_struct_keyframe_parse(
- PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
- const char **path_full, int *index, float *cfra, const char **group_name) /* return values */
+ PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
+ const char **path_full, int *index, float *cfra, const char **group_name) /* return values */
{
- static const char *kwlist[]= {"data_path", "index", "frame", "group", NULL};
+ static const char *kwlist[] = {"data_path", "index", "frame", "group", NULL};
const char *path;
/* note, parse_str MUST start with 's|ifs' */
@@ -161,8 +161,8 @@ static int pyrna_struct_keyframe_parse(
if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
return -1;
- if (*cfra==FLT_MAX)
- *cfra= CTX_data_scene(BPy_GetContext())->r.cfra;
+ if (*cfra == FLT_MAX)
+ *cfra = CTX_data_scene(BPy_GetContext())->r.cfra;
return 0; /* success */
}
@@ -186,10 +186,10 @@ char pyrna_struct_keyframe_insert_doc[] =
PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
/* args, pyrna_struct_keyframe_parse handles these */
- const char *path_full= NULL;
- int index= -1;
- float cfra= FLT_MAX;
- const char *group_name= NULL;
+ const char *path_full = NULL;
+ int index = -1;
+ float cfra = FLT_MAX;
+ const char *group_name = NULL;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -205,7 +205,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reports_init(&reports, RPT_STORE);
- result= insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
+ result = insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
@@ -234,10 +234,10 @@ char pyrna_struct_keyframe_delete_doc[] =
PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
/* args, pyrna_struct_keyframe_parse handles these */
- const char *path_full= NULL;
- int index= -1;
- float cfra= FLT_MAX;
- const char *group_name= NULL;
+ const char *path_full = NULL;
+ int index = -1;
+ float cfra = FLT_MAX;
+ const char *group_name = NULL;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -254,7 +254,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reports_init(&reports, RPT_STORE);
- result= delete_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
+ result = delete_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, 0);
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
@@ -280,7 +280,7 @@ char pyrna_struct_driver_add_doc[] =
PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
{
const char *path, *path_full;
- int index= -1;
+ int index = -1;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -291,39 +291,39 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
return NULL;
}
else {
- PyObject *ret= NULL;
+ PyObject *ret = NULL;
ReportList reports;
int result;
BKE_reports_init(&reports, RPT_STORE);
- result= ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0, DRIVER_TYPE_PYTHON);
+ result = ANIM_add_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0, DRIVER_TYPE_PYTHON);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
if (result) {
- ID *id= self->ptr.id.data;
- AnimData *adt= BKE_animdata_from_id(id);
+ ID *id = self->ptr.id.data;
+ AnimData *adt = BKE_animdata_from_id(id);
FCurve *fcu;
PointerRNA tptr;
PyObject *item;
if (index == -1) { /* all, use a list */
- int i= 0;
- ret= PyList_New(0);
- while ((fcu= list_find_fcurve(&adt->drivers, path_full, i++))) {
+ int i = 0;
+ ret = PyList_New(0);
+ while ((fcu = list_find_fcurve(&adt->drivers, path_full, i++))) {
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
- item= pyrna_struct_CreatePyObject(&tptr);
+ item = pyrna_struct_CreatePyObject(&tptr);
PyList_Append(ret, item);
Py_DECREF(item);
}
}
else {
- fcu= list_find_fcurve(&adt->drivers, path_full, index);
+ fcu = list_find_fcurve(&adt->drivers, path_full, index);
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
- ret= pyrna_struct_CreatePyObject(&tptr);
+ ret = pyrna_struct_CreatePyObject(&tptr);
}
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION|ND_FCURVES_ORDER, NULL);
@@ -356,7 +356,7 @@ char pyrna_struct_driver_remove_doc[] =
PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
{
const char *path, *path_full;
- int index= -1;
+ int index = -1;
PYRNA_STRUCT_CHECK_OBJ(self);
@@ -372,7 +372,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
BKE_reports_init(&reports, RPT_STORE);
- result= ANIM_remove_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0);
+ result = ANIM_remove_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0);
MEM_freeN((void *)path_full);
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 1d1cab1c66d..a74d0417ca2 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 *);
@@ -49,14 +55,14 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *)
*/
/*
- arr[2]= x
+ arr[2] = x
py_to_array_index(arraydim=0, arrayoffset=0, index=2)
validate_array(lvalue_dim=0)
... make real index ...
*/
-/* arr[3]=x, self->arraydim is 0, lvalue_dim is 1 */
+/* arr[3] = x, self->arraydim is 0, lvalue_dim is 1 */
/* Ensures that a python sequence has expected number of items/sub-items and items are of desired type. */
static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[],
ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix)
@@ -66,59 +72,62 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
/* not the last dimension */
if (dim + 1 < totdim) {
/* check that a sequence contains dimsize[dim] items */
- const Py_ssize_t seq_size= PySequence_Size(seq);
+ const Py_ssize_t seq_size = PySequence_Size(seq);
if (seq_size == -1) {
PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'",
error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
return -1;
}
- for (i= 0; i < seq_size; i++) {
+ for (i = 0; i < seq_size; i++) {
PyObject *item;
- int ok= 1;
- item= PySequence_GetItem(seq, i);
+ int ok = 1;
+ item = PySequence_GetItem(seq, i);
if (item == NULL) {
PyErr_Format(PyExc_TypeError, "%s sequence type '%s' failed to retrieve index %d",
error_prefix, Py_TYPE(seq)->tp_name, i);
- ok= 0;
+ ok = 0;
}
else if (!PySequence_Check(item)) {
/* BLI_snprintf(error_str, error_str_size, "expected a sequence of %s", item_type_str); */
PyErr_Format(PyExc_TypeError, "%s expected a sequence of %s, not %s",
error_prefix, item_type_str, Py_TYPE(item)->tp_name);
- ok= 0;
+ ok = 0;
}
/* arr[3][4][5]
- dimsize[1]=4
- dimsize[2]=5
-
- dim=0 */
+ * dimsize[1] = 4
+ * dimsize[2] = 5
+ *
+ * dim = 0 */
else if (PySequence_Size(item) != dimsize[dim + 1]) {
- /* BLI_snprintf(error_str, error_str_size, "sequences of dimension %d should contain %d items", (int)dim + 1, (int)dimsize[dim + 1]); */
+ /* BLI_snprintf(error_str, error_str_size,
+ "sequences of dimension %d should contain %d items",
+ (int)dim + 1, (int)dimsize[dim + 1]); */
PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items",
error_prefix, (int)dim + 1, (int)dimsize[dim + 1]);
- ok= 0;
+ ok = 0;
}
else if (validate_array_type(item, dim + 1, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1) {
- ok= 0;
+ ok = 0;
}
Py_XDECREF(item);
- if (!ok)
+ if (!ok) {
return -1;
+ }
}
}
else {
/* check that items are of correct type */
- const int seq_size= PySequence_Size(seq);
+ const int seq_size = PySequence_Size(seq);
if (seq_size == -1) {
PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'",
error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
return -1;
}
- for (i= 0; i < seq_size; i++) {
- PyObject *item= PySequence_GetItem(seq, i);
+ for (i = 0; i < seq_size; i++) {
+ PyObject *item = PySequence_GetItem(seq, i);
if (item == NULL) {
PyErr_Format(PyExc_TypeError, "%s sequence type '%s' failed to retrieve index %d",
@@ -144,32 +153,32 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
/* Returns the number of items in a single- or multi-dimensional sequence. */
static int count_items(PyObject *seq, int dim)
{
- int totitem= 0;
+ int totitem = 0;
if (dim > 1) {
- const Py_ssize_t seq_size= PySequence_Size(seq);
+ const Py_ssize_t seq_size = PySequence_Size(seq);
Py_ssize_t i;
- for (i= 0; i < seq_size; i++) {
- PyObject *item= PySequence_GetItem(seq, i);
+ for (i = 0; i < seq_size; i++) {
+ PyObject *item = PySequence_GetItem(seq, i);
if (item) {
- const int tot= count_items(item, dim - 1);
+ const int tot = count_items(item, dim - 1);
Py_DECREF(item);
if (tot != -1) {
totitem += tot;
}
else {
- totitem= -1;
+ totitem = -1;
break;
}
}
else {
- totitem= -1;
+ totitem = -1;
break;
}
}
}
else {
- totitem= PySequence_Size(seq);
+ totitem = PySequence_Size(seq);
}
return totitem;
@@ -182,8 +191,8 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
int dimsize[MAX_ARRAY_DIMENSION];
int tot, totdim, len;
- totdim= RNA_property_array_dimension(ptr, prop, dimsize);
- tot= count_items(rvalue, totdim - lvalue_dim);
+ totdim = RNA_property_array_dimension(ptr, prop, dimsize);
+ tot = count_items(rvalue, totdim - lvalue_dim);
if (tot == -1) {
PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, error validating the sequence length",
@@ -195,45 +204,47 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
#if 0
/* length is flexible */
if (!RNA_property_dynamic_array_set_length(ptr, prop, tot)) {
- /* BLI_snprintf(error_str, error_str_size, "%s.%s: array length cannot be changed to %d", RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
+ /* BLI_snprintf(error_str, error_str_size,
+ "%s.%s: array length cannot be changed to %d",
+ RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d",
error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
return -1;
}
#else
- *totitem= tot;
+ *totitem = tot;
return 0;
#endif
}
- len= tot;
+ len = tot;
}
else {
/* length is a constraint */
if (!lvalue_dim) {
- len= RNA_property_array_length(ptr, prop);
+ len = RNA_property_array_length(ptr, prop);
}
/* array item assignment */
else {
int i;
- len= 1;
+ len = 1;
/* arr[3][4][5]
- arr[2]= x
- dimsize={4, 5}
- dimsize[1]= 4
- dimsize[2]= 5
- lvalue_dim=0, totdim=3
+ arr[2] = x
+ dimsize = {4, 5}
+ dimsize[1] = 4
+ dimsize[2] = 5
+ lvalue_dim = 0, totdim = 3
- arr[2][3]= x
- lvalue_dim=1
+ arr[2][3] = x
+ lvalue_dim = 1
- arr[2][3][4]= x
- lvalue_dim=2 */
- for (i= lvalue_dim; i < totdim; i++)
+ arr[2][3][4] = x
+ lvalue_dim = 2 */
+ for (i = lvalue_dim; i < totdim; i++)
len *= dimsize[i];
}
@@ -245,7 +256,7 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
}
}
- *totitem= len;
+ *totitem = len;
return 0;
}
@@ -255,14 +266,51 @@ static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop,
const char *error_prefix)
{
int dimsize[MAX_ARRAY_DIMENSION];
- int totdim= RNA_property_array_dimension(ptr, prop, dimsize);
+ int totdim = RNA_property_array_dimension(ptr, prop, dimsize);
/* 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,
@@ -274,7 +322,7 @@ static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *pro
convert_item(item, value);
rna_set_index(ptr, prop, *index, value);
- *index= *index + 1;
+ *index = *index + 1;
}
else {
convert_item(item, data);
@@ -288,8 +336,8 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
int dim, char *data, unsigned int item_size, int *index,
ItemConvertFunc convert_item, RNA_SetIndexFunc rna_set_index)
{
- int totdim= RNA_property_array_dimension(ptr, prop, NULL);
- const Py_ssize_t seq_size= PySequence_Size(seq);
+ int totdim = RNA_property_array_dimension(ptr, prop, NULL);
+ const Py_ssize_t seq_size = PySequence_Size(seq);
Py_ssize_t i;
/* Regarding PySequence_GetItem() failing.
@@ -305,14 +353,34 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
return NULL;
}
- for (i= 0; i < seq_size; i++) {
- PyObject *item= PySequence_GetItem(seq, i);
+
+#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) {
if (dim + 1 < totdim) {
- data= copy_values(item, ptr, prop, dim + 1, data, item_size, index, convert_item, rna_set_index);
+ data = copy_values(item, ptr, prop, dim + 1, data, item_size, index, convert_item, rna_set_index);
}
else {
- data= copy_value_single(item, ptr, prop, data, item_size, index, convert_item, rna_set_index);
+ data = copy_value_single(item, ptr, prop, data, item_size, index, convert_item, rna_set_index);
}
Py_DECREF(item);
@@ -333,9 +401,9 @@ static int py_to_array(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
{
/*int totdim, dim_size[MAX_ARRAY_DIMENSION];*/
int totitem;
- char *data= NULL;
+ char *data = NULL;
- /*totdim= RNA_property_array_dimension(ptr, prop, dim_size);*/ /*UNUSED*/
+ /*totdim = RNA_property_array_dimension(ptr, prop, dim_size);*/ /*UNUSED*/
if (validate_array(seq, ptr, prop, 0, check_item_type, item_type_str, &totitem, error_prefix) == -1) {
return -1;
@@ -345,30 +413,30 @@ static int py_to_array(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
/* note: this code is confusing */
if (param_data && RNA_property_flag(prop) & PROP_DYNAMIC) {
/* not freeing allocated mem, RNA_parameter_list_free() will do this */
- ParameterDynAlloc *param_alloc= (ParameterDynAlloc *)param_data;
- param_alloc->array_tot= (int)totitem;
- param_alloc->array= MEM_callocN(item_size * totitem, "py_to_array dyn"); /* freeing param list will free */
+ ParameterDynAlloc *param_alloc = (ParameterDynAlloc *)param_data;
+ param_alloc->array_tot = (int)totitem;
+ param_alloc->array = MEM_callocN(item_size * totitem, "py_to_array dyn"); /* freeing param list will free */
- data= param_alloc->array;
+ data = param_alloc->array;
}
else if (param_data) {
- data= param_data;
+ data = param_data;
}
else {
- data= PyMem_MALLOC(item_size * totitem);
+ data = PyMem_MALLOC(item_size * totitem);
}
/* will only fail in very rare cases since we already validated the
* python data, the check here is mainly for completeness. */
if (copy_values(seq, ptr, prop, 0, data, item_size, NULL, convert_item, NULL) != NULL) {
- if (param_data==NULL) {
+ if (param_data == NULL) {
/* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */
rna_set_array(ptr, prop, data);
PyMem_FREE(data);
}
}
else {
- if (param_data==NULL) {
+ if (param_data == NULL) {
PyMem_FREE(data);
}
@@ -389,21 +457,21 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop,
int totdim, dimsize[MAX_ARRAY_DIMENSION];
int totitem, i;
- totdim= RNA_property_array_dimension(ptr, prop, dimsize);
+ totdim = RNA_property_array_dimension(ptr, prop, dimsize);
/* convert index */
/* arr[3][4][5]
- arr[2]= x
- lvalue_dim=0, index= 0 + 2 * 4 * 5
+ arr[2] = x
+ lvalue_dim = 0, index = 0 + 2 * 4 * 5
- arr[2][3]= x
- lvalue_dim=1, index= 40 + 3 * 5 */
+ arr[2][3] = x
+ lvalue_dim = 1, index = 40 + 3 * 5 */
lvalue_dim++;
- for (i= lvalue_dim; i < totdim; i++)
+ for (i = lvalue_dim; i < totdim; i++)
index *= dimsize[i];
index += arrayoffset;
@@ -432,17 +500,17 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop,
static void py_to_float(PyObject *py, char *data)
{
- *(float*)data= (float)PyFloat_AsDouble(py);
+ *(float *)data = (float)PyFloat_AsDouble(py);
}
static void py_to_int(PyObject *py, char *data)
{
- *(int*)data= (int)PyLong_AsSsize_t(py);
+ *(int *)data = (int)PyLong_AsSsize_t(py);
}
static void py_to_bool(PyObject *py, char *data)
{
- *(int*)data= (int)PyObject_IsTrue(py);
+ *(int *)data = (int)PyObject_IsTrue(py);
}
static int py_float_check(PyObject *py)
@@ -464,17 +532,17 @@ static int py_bool_check(PyObject *py)
static void float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value)
{
- RNA_property_float_set_index(ptr, prop, index, *(float*)value);
+ RNA_property_float_set_index(ptr, prop, index, *(float *)value);
}
static void int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value)
{
- RNA_property_int_set_index(ptr, prop, index, *(int*)value);
+ RNA_property_int_set_index(ptr, prop, index, *(int *)value);
}
static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value)
{
- RNA_property_boolean_set_index(ptr, prop, index, *(int*)value);
+ RNA_property_boolean_set_index(ptr, prop, index, *(int *)value);
}
int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data,
@@ -483,20 +551,20 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data,
int ret;
switch (RNA_property_type(prop)) {
case PROP_FLOAT:
- ret= py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
+ ret = py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
break;
case PROP_INT:
- ret= py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
+ ret = py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
break;
case PROP_BOOLEAN:
- ret= py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
+ ret = py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
break;
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
- ret= -1;
+ ret = -1;
}
return ret;
@@ -508,20 +576,20 @@ int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, in
int ret;
switch (RNA_property_type(prop)) {
case PROP_FLOAT:
- ret= py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
py_float_check, "float", py_to_float, float_set_index, error_prefix);
break;
case PROP_INT:
- ret= py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
py_int_check, "int", py_to_int, int_set_index, error_prefix);
break;
case PROP_BOOLEAN:
- ret= py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+ ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix);
break;
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
- ret= -1;
+ ret = -1;
}
return ret;
@@ -533,17 +601,17 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
switch (RNA_property_type(prop)) {
case PROP_FLOAT:
- item= PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
+ item = PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
break;
case PROP_BOOLEAN:
- item= PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
+ item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
break;
case PROP_INT:
- item= PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
+ item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
break;
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
- item= NULL;
+ item = NULL;
}
return item;
@@ -556,20 +624,20 @@ static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, PropertyRNA *prop
{
PyObject *tuple;
int i, len;
- int totdim= RNA_property_array_dimension(ptr, prop, NULL);
+ int totdim = RNA_property_array_dimension(ptr, prop, NULL);
- len= RNA_property_multi_array_length(ptr, prop, dim);
+ len = RNA_property_multi_array_length(ptr, prop, dim);
- tuple= PyTuple_New(len);
+ tuple = PyTuple_New(len);
- for (i= 0; i < len; i++) {
+ for (i = 0; i < len; i++) {
PyObject *item;
if (dim + 1 < totdim)
- item= pyrna_py_from_array_internal(ptr, prop, dim + 1, index);
+ item = pyrna_py_from_array_internal(ptr, prop, dim + 1, index);
else {
- item= pyrna_array_index(ptr, prop, *index);
- *index= *index + 1;
+ item = pyrna_array_index(ptr, prop, *index);
+ *index = *index + 1;
}
if (!item) {
@@ -587,13 +655,13 @@ static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, PropertyRNA *prop
PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
{
int totdim, arraydim, arrayoffset, dimsize[MAX_ARRAY_DIMENSION], i, len;
- BPy_PropertyArrayRNA *ret= NULL;
+ BPy_PropertyArrayRNA *ret = NULL;
- arraydim= self ? self->arraydim : 0;
- arrayoffset= self ? self->arrayoffset : 0;
+ arraydim = self ? self->arraydim : 0;
+ arrayoffset = self ? self->arrayoffset : 0;
/* just in case check */
- len= RNA_property_multi_array_length(ptr, prop, arraydim);
+ len = RNA_property_multi_array_length(ptr, prop, arraydim);
if (index >= len || index < 0) {
/* this shouldn't happen because higher level funcs must check for invalid index */
if (G.f & G_DEBUG) printf("pyrna_py_from_array_index: invalid index %d for array with length=%d\n", index, len);
@@ -602,38 +670,38 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
return NULL;
}
- totdim= RNA_property_array_dimension(ptr, prop, dimsize);
+ totdim = RNA_property_array_dimension(ptr, prop, dimsize);
if (arraydim + 1 < totdim) {
- ret= (BPy_PropertyArrayRNA*)pyrna_prop_CreatePyObject(ptr, prop);
- ret->arraydim= arraydim + 1;
+ ret = (BPy_PropertyArrayRNA *)pyrna_prop_CreatePyObject(ptr, prop);
+ ret->arraydim = arraydim + 1;
/* arr[3][4][5]
- x= arr[2]
- index= 0 + 2 * 4 * 5
+ x = arr[2]
+ index = 0 + 2 * 4 * 5
- x= arr[2][3]
- index= offset + 3 * 5 */
+ x = arr[2][3]
+ index = offset + 3 * 5 */
- for (i= arraydim + 1; i < totdim; i++)
+ for (i = arraydim + 1; i < totdim; i++)
index *= dimsize[i];
- ret->arrayoffset= arrayoffset + index;
+ ret->arrayoffset = arrayoffset + index;
}
else {
- index= arrayoffset + index;
- ret= (BPy_PropertyArrayRNA *)pyrna_array_index(ptr, prop, index);
+ index = arrayoffset + index;
+ ret = (BPy_PropertyArrayRNA *)pyrna_array_index(ptr, prop, index);
}
- return (PyObject*)ret;
+ return (PyObject *)ret;
}
PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop)
{
PyObject *ret;
- ret= pyrna_math_object_from_array(ptr, prop);
+ ret = pyrna_math_object_from_array(ptr, prop);
/* is this a maths object? */
if (ret) return ret;
@@ -644,11 +712,11 @@ PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop)
/* TODO, multi-dimensional arrays */
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
{
- int len= RNA_property_array_length(ptr, prop);
+ int len = RNA_property_array_length(ptr, prop);
int type;
int i;
- if (len==0) /* possible with dynamic arrays */
+ if (len == 0) /* possible with dynamic arrays */
return 0;
if (RNA_property_array_dimension(ptr, prop, NULL) > 1) {
@@ -656,13 +724,13 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
return -1;
}
- type= RNA_property_type(prop);
+ type = RNA_property_type(prop);
switch (type) {
case PROP_FLOAT:
{
- float value_f= PyFloat_AsDouble(value);
- if (value_f==-1 && PyErr_Occurred()) {
+ float value_f = PyFloat_AsDouble(value);
+ if (value_f == -1 && PyErr_Occurred()) {
PyErr_Clear();
return 0;
}
@@ -671,15 +739,15 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
float *tmp_arr;
if (len * sizeof(float) > sizeof(tmp)) {
- tmp_arr= PyMem_MALLOC(len * sizeof(float));
+ tmp_arr = PyMem_MALLOC(len * sizeof(float));
}
else {
- tmp_arr= tmp;
+ tmp_arr = tmp;
}
RNA_property_float_get_array(ptr, prop, tmp_arr);
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
if (tmp_arr[i] == value_f) {
break;
}
@@ -688,15 +756,15 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
if (tmp_arr != tmp)
PyMem_FREE(tmp_arr);
- return i<len ? 1 : 0;
+ return i < len ? 1 : 0;
}
break;
}
case PROP_BOOLEAN:
case PROP_INT:
{
- int value_i= PyLong_AsSsize_t(value);
- if (value_i==-1 && PyErr_Occurred()) {
+ int value_i = PyLong_AsSsize_t(value);
+ if (value_i == -1 && PyErr_Occurred()) {
PyErr_Clear();
return 0;
}
@@ -705,18 +773,18 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
int *tmp_arr;
if (len * sizeof(int) > sizeof(tmp)) {
- tmp_arr= PyMem_MALLOC(len * sizeof(int));
+ tmp_arr = PyMem_MALLOC(len * sizeof(int));
}
else {
- tmp_arr= tmp;
+ tmp_arr = tmp;
}
- if (type==PROP_BOOLEAN)
+ if (type == PROP_BOOLEAN)
RNA_property_boolean_get_array(ptr, prop, tmp_arr);
else
RNA_property_int_get_array(ptr, prop, tmp_arr);
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
if (tmp_arr[i] == value_i) {
break;
}
@@ -725,7 +793,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
if (tmp_arr != tmp)
PyMem_FREE(tmp_arr);
- return i<len ? 1 : 0;
+ return i < len ? 1 : 0;
}
break;
}
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 85f950947a7..7704ab2a417 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -56,11 +56,11 @@ static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customd
bpy_context_set((bContext *)C, &gilstate);
- cb_func= PyTuple_GET_ITEM((PyObject *)customdata, 0);
- cb_args= PyTuple_GET_ITEM((PyObject *)customdata, 1);
- result= PyObject_CallObject(cb_func, cb_args);
+ cb_func = PyTuple_GET_ITEM((PyObject *)customdata, 0);
+ cb_args = PyTuple_GET_ITEM((PyObject *)customdata, 1);
+ result = PyObject_CallObject(cb_func, cb_args);
- if(result) {
+ if (result) {
Py_DECREF(result);
}
else {
@@ -76,33 +76,34 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
void *handle;
PyObject *cb_func, *cb_args;
- char *cb_event_str= NULL;
+ char *cb_event_str = NULL;
int cb_event;
if (!PyArg_ParseTuple(args, "OO!|s:bpy_struct.callback_add", &cb_func, &PyTuple_Type, &cb_args, &cb_event_str))
return NULL;
- if(!PyCallable_Check(cb_func)) {
+ if (!PyCallable_Check(cb_func)) {
PyErr_SetString(PyExc_TypeError, "callback_add(): first argument isn't callable");
return NULL;
}
- if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
- if(cb_event_str) {
- static EnumPropertyItem region_draw_mode_items[]= {
+ if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
+ if (cb_event_str) {
+ static EnumPropertyItem region_draw_mode_items[] = {
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
{REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""},
{REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""},
{0, NULL, 0, NULL, NULL}};
- if(pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0)
+ if (pyrna_enum_value_from_id(region_draw_mode_items, cb_event_str, &cb_event, "bpy_struct.callback_add()") < 0) {
return NULL;
+ }
}
else {
- cb_event= REGION_DRAW_POST_PIXEL;
+ cb_event = REGION_DRAW_POST_PIXEL;
}
- handle= ED_region_draw_cb_activate(((ARegion *)self->ptr.data)->type, cb_region_draw, (void *)args, cb_event);
+ handle = ED_region_draw_cb_activate(((ARegion *)self->ptr.data)->type, cb_region_draw, (void *)args, cb_event);
Py_INCREF(args);
}
else {
@@ -122,15 +123,15 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!:callback_remove", &PyCapsule_Type, &py_handle))
return NULL;
- handle= PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
+ handle = PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
- if(handle==NULL) {
+ if (handle == NULL) {
PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed");
return NULL;
}
- if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
- customdata= ED_region_draw_cb_customdata(handle);
+ if (RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
+ customdata = ED_region_draw_cb_customdata(handle);
Py_DECREF((PyObject *)customdata);
ED_region_draw_cb_exit(((ARegion *)self->ptr.data)->type, handle);
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index 599c4312985..e3272c9da1a 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -33,7 +33,7 @@
static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce)
{
- return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(tb->tb_frame->f_code->co_filename)));
+ return PyBytes_AS_STRING((*coerce = PyUnicode_EncodeFSDefault(tb->tb_frame->f_code->co_filename)));
}
/* copied from pythonrun.c, 3.2.0 */
@@ -110,8 +110,8 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
PyObject *exception, *value;
PyTracebackObject *tb;
- *lineno= -1;
- *offset= 0;
+ *lineno = -1;
+ *offset = 0;
PyErr_Fetch(&exception, &value, (PyObject **)&tb);
@@ -133,11 +133,11 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
/* good */
}
else {
- *lineno= -1;
+ *lineno = -1;
}
}
else {
- *lineno= -1;
+ *lineno = -1;
}
}
}
@@ -146,17 +146,17 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
PyErr_Restore(exception, value, (PyObject *)tb); /* takes away reference! */
PyErr_Print();
- for (tb= (PyTracebackObject *)PySys_GetObject("last_traceback");
+ for (tb = (PyTracebackObject *)PySys_GetObject("last_traceback");
tb && (PyObject *)tb != Py_None;
- tb= tb->tb_next)
+ tb = tb->tb_next)
{
PyObject *coerce;
- const char *tb_filepath= traceback_filepath(tb, &coerce);
- const int match= strcmp(tb_filepath, filepath) != 0;
+ const char *tb_filepath = traceback_filepath(tb, &coerce);
+ const int match = strcmp(tb_filepath, filepath) != 0;
Py_DECREF(coerce);
if (match) {
- *lineno= tb->tb_lineno;
+ *lineno = tb->tb_lineno;
break;
}
}
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index fb42f7d59e0..ec7eff1756a 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -37,22 +37,22 @@
#include "../generic/py_capi_utils.h"
-static bContext* __py_context= NULL;
+static bContext* __py_context = NULL;
bContext* BPy_GetContext(void) { return __py_context; }
-void BPy_SetContext(bContext *C) { __py_context= C; }
+void BPy_SetContext(bContext *C) { __py_context = C; }
char *BPy_enum_as_string(EnumPropertyItem *item)
{
- DynStr *dynstr= BLI_dynstr_new();
+ DynStr *dynstr = BLI_dynstr_new();
EnumPropertyItem *e;
char *cstring;
- for (e= item; item->identifier; item++) {
+ for (e = item; item->identifier; item++) {
if (item->identifier[0])
- BLI_dynstr_appendf(dynstr, (e==item)?"'%s'":", '%s'", item->identifier);
+ BLI_dynstr_appendf(dynstr, (e == item)?"'%s'":", '%s'", item->identifier);
}
- cstring= BLI_dynstr_get_cstring(dynstr);
+ cstring = BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
return cstring;
}
@@ -61,7 +61,7 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short
{
char *report_str;
- report_str= BKE_reports_string(reports, RPT_ERROR);
+ report_str = BKE_reports_string(reports, RPT_ERROR);
if (clear) {
BKE_reports_clear(reports);
@@ -79,7 +79,7 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short
short BPy_errors_to_report(ReportList *reports)
{
PyObject *pystring;
- PyObject *pystring_format= NULL; // workaround, see below
+ PyObject *pystring_format = NULL; // workaround, see below
char *cstring;
const char *filename;
@@ -89,30 +89,30 @@ short BPy_errors_to_report(ReportList *reports)
return 1;
/* less hassle if we allow NULL */
- if (reports==NULL) {
+ if (reports == NULL) {
PyErr_Print();
PyErr_Clear();
return 1;
}
- pystring= PyC_ExceptionBuffer();
+ pystring = PyC_ExceptionBuffer();
- if (pystring==NULL) {
+ if (pystring == NULL) {
BKE_report(reports, RPT_ERROR, "unknown py-exception, couldn't convert");
return 0;
}
PyC_FileAndNum(&filename, &lineno);
- if (filename==NULL)
- filename= "<unknown location>";
+ if (filename == NULL)
+ filename = "<unknown location>";
- cstring= _PyUnicode_AsString(pystring);
+ cstring = _PyUnicode_AsString(pystring);
#if 0 // ARG!. workaround for a bug in blenders use of vsnprintf
BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno);
#else
- pystring_format= PyUnicode_FromFormat("%s\nlocation:%s:%d\n", cstring, filename, lineno);
- cstring= _PyUnicode_AsString(pystring_format);
+ pystring_format = PyUnicode_FromFormat("%s\nlocation:%s:%d\n", cstring, filename, lineno);
+ cstring = _PyUnicode_AsString(pystring_format);
BKE_report(reports, RPT_ERROR, cstring);
#endif
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 0da63297077..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;
@@ -184,7 +192,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
return NULL;
}
- } else {
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "gpu.export_shader() first argument should be of Scene type");
return NULL;
}
@@ -204,7 +213,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
return NULL;
}
- } else {
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "gpu.export_shader() second argument should be of Material type");
return NULL;
}
@@ -260,7 +270,8 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
if (attribute->name) {
if (attribute->name[0] != 0) {
PY_DICT_ADD_STRING(dict,attribute,name);
- } else {
+ }
+ else {
val = PyLong_FromLong(0);
PyDict_SetItemString(dict, "name", val);
Py_DECREF(val);
@@ -276,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 121c5e26e73..c9afb7edf4b 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -35,46 +35,24 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_dynstr.h"
PyDoc_STRVAR(M_Mathutils_doc,
"This module provides access to matrices, eulers, quaternions and vectors."
);
static int mathutils_array_parse_fast(float *array,
- int array_min, int array_max,
- PyObject *value, const char *error_prefix)
+ int size,
+ PyObject *value_fast,
+ const char *error_prefix)
{
- PyObject *value_fast= NULL;
PyObject *item;
- int i, size;
-
- /* non list/tuple cases */
- if (!(value_fast=PySequence_Fast(value, error_prefix))) {
- /* PySequence_Fast sets the error */
- return -1;
- }
-
- size= PySequence_Fast_GET_SIZE(value_fast);
-
- if (size > array_max || size < array_min) {
- if (array_max == array_min) {
- PyErr_Format(PyExc_ValueError,
- "%.200s: sequence size is %d, expected %d",
- error_prefix, size, array_max);
- }
- else {
- PyErr_Format(PyExc_ValueError,
- "%.200s: sequence size is %d, expected [%d - %d]",
- error_prefix, size, array_min, array_max);
- }
- Py_DECREF(value_fast);
- return -1;
- }
+ int i;
- i= size;
+ i = size;
do {
i--;
- if ( ((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
+ if ( ((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
@@ -93,13 +71,14 @@ static int mathutils_array_parse_fast(float *array,
/* helper functionm returns length of the 'value', -1 on error */
int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
{
-#if 1 /* approx 6x speedup for mathutils types */
int size;
- if ( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
- (size= EulerObject_Check(value) ? 3 : 0) ||
- (size= QuaternionObject_Check(value) ? 4 : 0) ||
- (size= ColorObject_Check(value) ? 3 : 0))
+#if 1 /* approx 6x speedup for mathutils types */
+
+ if ( (size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
+ (size = EulerObject_Check(value) ? 3 : 0) ||
+ (size = QuaternionObject_Check(value) ? 4 : 0) ||
+ (size = ColorObject_Check(value) ? 3 : 0))
{
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
@@ -125,7 +104,85 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
else
#endif
{
- return mathutils_array_parse_fast(array, array_min, array_max, value, error_prefix);
+ PyObject *value_fast = NULL;
+
+ /* non list/tuple cases */
+ if (!(value_fast = PySequence_Fast(value, error_prefix))) {
+ /* PySequence_Fast sets the error */
+ return -1;
+ }
+
+ size = PySequence_Fast_GET_SIZE(value_fast);
+
+ if (size > array_max || size < array_min) {
+ if (array_max == array_min) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected %d",
+ error_prefix, size, array_max);
+ }
+ else {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected [%d - %d]",
+ error_prefix, size, array_min, array_max);
+ }
+ Py_DECREF(value_fast);
+ return -1;
+ }
+
+ return mathutils_array_parse_fast(array, size, value_fast, error_prefix);
+ }
+}
+
+int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, const char *error_prefix)
+{
+ int size;
+
+#if 1 /* approx 6x speedup for mathutils types */
+
+ if ( (size = VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
+ (size = EulerObject_Check(value) ? 3 : 0) ||
+ (size = QuaternionObject_Check(value) ? 4 : 0) ||
+ (size = ColorObject_Check(value) ? 3 : 0))
+ {
+ if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
+ return -1;
+ }
+
+ if (size < array_min) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected > %d",
+ error_prefix, size, array_min);
+ return -1;
+ }
+
+ *array = PyMem_Malloc(size * sizeof(float));
+ memcpy(*array, ((BaseMathObject *)value)->data, size * sizeof(float));
+ return size;
+ }
+ else
+#endif
+ {
+ PyObject *value_fast = NULL;
+ //*array = NULL;
+
+ /* non list/tuple cases */
+ if (!(value_fast = PySequence_Fast(value, error_prefix))) {
+ /* PySequence_Fast sets the error */
+ return -1;
+ }
+
+ size = PySequence_Fast_GET_SIZE(value_fast);
+
+ if (size < array_min) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected > %d",
+ error_prefix, size, array_min);
+ return -1;
+ }
+
+ *array = PyMem_Malloc(size * sizeof(float));
+
+ return mathutils_array_parse_fast(*array, size, value_fast, error_prefix);
}
}
@@ -155,7 +212,7 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
}
- else if (((MatrixObject *)value)->col_size < 3 || ((MatrixObject *)value)->row_size < 3) {
+ else if (((MatrixObject *)value)->num_row < 3 || ((MatrixObject *)value)->num_col < 3) {
PyErr_Format(PyExc_ValueError,
"%.200s: matrix must have minimum 3x3 dimensions",
error_prefix);
@@ -204,26 +261,38 @@ int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps)
{
int x;
- for (x=0; x< size; x++) {
+ for (x = 0; x < size; x++) {
if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0)
return 0;
}
return 1;
}
+/* dynstr as python string utility funcions, frees 'ds'! */
+PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
+{
+ const int ds_len = BLI_dynstr_get_len(ds); /* space for \0 */
+ char *ds_buf = PyMem_Malloc(ds_len + 1);
+ PyObject *ret;
+ BLI_dynstr_get_cstring_ex(ds, ds_buf);
+ BLI_dynstr_free(ds);
+ ret = PyUnicode_FromStringAndSize(ds_buf, ds_len);
+ PyMem_Free(ds_buf);
+ return ret;
+}
/* Mathutils Callbacks */
/* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
-static Mathutils_Callback *mathutils_callbacks[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+static Mathutils_Callback *mathutils_callbacks[8] = {NULL};
int Mathutils_RegisterCallback(Mathutils_Callback *cb)
{
int i;
/* find the first free slot */
- for (i= 0; mathutils_callbacks[i]; i++) {
- if (mathutils_callbacks[i]==cb) /* already registered? */
+ for (i = 0; mathutils_callbacks[i]; i++) {
+ if (mathutils_callbacks[i] == cb) /* already registered? */
return i;
}
@@ -234,7 +303,7 @@ int Mathutils_RegisterCallback(Mathutils_Callback *cb)
/* use macros to check for NULL */
int _BaseMathObject_ReadCallback(BaseMathObject *self)
{
- Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
if (cb->get(self, self->cb_subtype) != -1)
return 0;
@@ -248,7 +317,7 @@ int _BaseMathObject_ReadCallback(BaseMathObject *self)
int _BaseMathObject_WriteCallback(BaseMathObject *self)
{
- Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
if (cb->set(self, self->cb_subtype) != -1)
return 0;
@@ -262,7 +331,7 @@ int _BaseMathObject_WriteCallback(BaseMathObject *self)
int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
{
- Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
if (cb->get_index(self, self->cb_subtype, index) != -1)
return 0;
@@ -276,7 +345,7 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
{
- Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
if (cb->set_index(self, self->cb_subtype, index) != -1)
return 0;
@@ -289,16 +358,16 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
}
/* BaseMathObject generic functions for all mathutils types */
-char BaseMathObject_Owner_doc[] = "The item this is wrapping or None (readonly).";
-PyObject *BaseMathObject_getOwner(BaseMathObject *self, void *UNUSED(closure))
+char BaseMathObject_owner_doc[] = "The item this is wrapping or None (readonly).";
+PyObject *BaseMathObject_owner_get(BaseMathObject *self, void *UNUSED(closure))
{
- PyObject *ret= self->cb_user ? self->cb_user : Py_None;
+ PyObject *ret = self->cb_user ? self->cb_user : Py_None;
Py_INCREF(ret);
return ret;
}
-char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean";
-PyObject *BaseMathObject_getWrapped(BaseMathObject *self, void *UNUSED(closure))
+char BaseMathObject_is_wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean";
+PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *UNUSED(closure))
{
return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0);
}
@@ -351,12 +420,14 @@ PyMODINIT_FUNC PyInit_mathutils(void)
{
PyObject *submodule;
PyObject *item;
- PyObject *sys_modules= PyThreadState_GET()->interp->modules;
+ PyObject *sys_modules = PyThreadState_GET()->interp->modules;
if (PyType_Ready(&vector_Type) < 0)
return NULL;
if (PyType_Ready(&matrix_Type) < 0)
- return NULL;
+ return NULL;
+ if (PyType_Ready(&matrix_access_Type) < 0)
+ return NULL;
if (PyType_Ready(&euler_Type) < 0)
return NULL;
if (PyType_Ready(&quaternion_Type) < 0)
@@ -374,7 +445,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
PyModule_AddObject(submodule, "Color", (PyObject *)&color_Type);
/* submodule */
- PyModule_AddObject(submodule, "geometry", (item=PyInit_mathutils_geometry()));
+ PyModule_AddObject(submodule, "geometry", (item = PyInit_mathutils_geometry()));
/* XXX, python doesnt do imports with this usefully yet
* 'from mathutils.geometry import PolyFill'
* ...fails without this. */
@@ -382,11 +453,13 @@ PyMODINIT_FUNC PyInit_mathutils(void)
Py_INCREF(item);
/* Noise submodule */
- PyModule_AddObject(submodule, "noise", (item=PyInit_mathutils_noise()));
+ PyModule_AddObject(submodule, "noise", (item = PyInit_mathutils_noise()));
PyDict_SetItemString(sys_modules, "mathutils.noise", item);
Py_INCREF(item);
- mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
+ mathutils_matrix_row_cb_index = Mathutils_RegisterCallback(&mathutils_matrix_row_cb);
+ mathutils_matrix_col_cb_index = Mathutils_RegisterCallback(&mathutils_matrix_col_cb);
+ mathutils_matrix_translation_cb_index = Mathutils_RegisterCallback(&mathutils_matrix_translation_cb);
return submodule;
}
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index a8170b8145c..220ae61f47d 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -37,8 +37,10 @@
/* Can cast different mathutils types to this, use for generic funcs */
-extern char BaseMathObject_Wrapped_doc[];
-extern char BaseMathObject_Owner_doc[];
+struct DynStr;
+
+extern char BaseMathObject_is_wrapped_doc[];
+extern char BaseMathObject_owner_doc[];
#define BASE_MATH_MEMBERS(_data) \
PyObject_VAR_HEAD \
@@ -65,8 +67,8 @@ typedef struct {
#include "mathutils_geometry.h"
#include "mathutils_noise.h"
-PyObject *BaseMathObject_getOwner( BaseMathObject * self, void * );
-PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void * );
+PyObject *BaseMathObject_owner_get( BaseMathObject * self, void * );
+PyObject *BaseMathObject_is_wrapped_get( BaseMathObject *self, void * );
int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg);
int BaseMathObject_clear(BaseMathObject *self);
@@ -115,8 +117,12 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index);
/* utility func */
int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix);
+int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, const char *error_prefix);
int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix);
int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject *mat);
+/* dynstr as python string utility funcions */
+PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
+
#endif /* MATHUTILS_H */
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 8409344a9fe..7f3f811c41a 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -32,6 +32,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_dynstr.h"
#define COLOR_SIZE 3
@@ -39,7 +40,7 @@
//makes a new color for you to play with
static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- float col[3]= {0.0f, 0.0f, 0.0f};
+ float col[3] = {0.0f, 0.0f, 0.0f};
if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
@@ -48,7 +49,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
}
- switch(PyTuple_GET_SIZE(args)) {
+ switch (PyTuple_GET_SIZE(args)) {
case 0:
break;
case 1:
@@ -72,15 +73,15 @@ static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits)
PyObject *ret;
int i;
- ret= PyTuple_New(COLOR_SIZE);
+ ret = PyTuple_New(COLOR_SIZE);
if (ndigits >= 0) {
- for (i= 0; i < COLOR_SIZE; i++) {
+ for (i = 0; i < COLOR_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->col[i], ndigits)));
}
}
else {
- for (i= 0; i < COLOR_SIZE; i++) {
+ for (i = 0; i < COLOR_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->col[i]));
}
}
@@ -110,36 +111,51 @@ static PyObject *Color_copy(ColorObject *self)
//----------------------------print object (internal)--------------
//print the object to screen
-static PyObject *Color_repr(ColorObject * self)
+static PyObject *Color_repr(ColorObject *self)
{
PyObject *ret, *tuple;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- tuple= Color_ToTupleExt(self, -1);
+ tuple = Color_ToTupleExt(self, -1);
- ret= PyUnicode_FromFormat("Color(%R)", tuple);
+ ret = PyUnicode_FromFormat("Color(%R)", tuple);
Py_DECREF(tuple);
return ret;
}
+static PyObject *Color_str(ColorObject *self)
+{
+ DynStr *ds;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ ds = BLI_dynstr_new();
+
+ BLI_dynstr_appendf(ds, "<Color (r=%.4f, g=%.4f, b=%.4f)>",
+ self->col[0], self->col[1], self->col[2]);
+
+ return mathutils_dynstr_to_py(ds); /* frees ds */
+}
+
//------------------------tp_richcmpr
//returns -1 execption, 0 false, 1 true
-static PyObject* Color_richcmpr(PyObject *a, PyObject *b, int op)
+static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
{
PyObject *res;
- int ok= -1; /* zero is true */
+ int ok = -1; /* zero is true */
if (ColorObject_Check(a) && ColorObject_Check(b)) {
- ColorObject *colA= (ColorObject*)a;
- ColorObject *colB= (ColorObject*)b;
+ ColorObject *colA = (ColorObject *)a;
+ ColorObject *colB = (ColorObject *)b;
if (BaseMath_ReadCallback(colA) == -1 || BaseMath_ReadCallback(colB) == -1)
return NULL;
- ok= EXPP_VectorsAreEqual(colA->col, colB->col, COLOR_SIZE, 1) ? 0 : -1;
+ ok = EXPP_VectorsAreEqual(colA->col, colB->col, COLOR_SIZE, 1) ? 0 : -1;
}
switch (op) {
@@ -172,9 +188,9 @@ static int Color_len(ColorObject *UNUSED(self))
}
//----------------------------object[]---------------------------
//sequence accessor (get)
-static PyObject *Color_item(ColorObject * self, int i)
+static PyObject *Color_item(ColorObject *self, int i)
{
- if (i<0) i= COLOR_SIZE-i;
+ if (i < 0) i = COLOR_SIZE - i;
if (i < 0 || i >= COLOR_SIZE) {
PyErr_SetString(PyExc_IndexError,
@@ -191,7 +207,7 @@ static PyObject *Color_item(ColorObject * self, int i)
}
//----------------------------object[]-------------------------
//sequence accessor (set)
-static int Color_ass_item(ColorObject * self, int i, PyObject *value)
+static int Color_ass_item(ColorObject *self, int i, PyObject *value)
{
float f = PyFloat_AsDouble(value);
@@ -202,7 +218,7 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value)
return -1;
}
- if (i<0) i= COLOR_SIZE-i;
+ if (i < 0) i= COLOR_SIZE - i;
if (i < 0 || i >= COLOR_SIZE) {
PyErr_SetString(PyExc_IndexError, "color[attribute] = x: "
@@ -219,7 +235,7 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value)
}
//----------------------------object[z:y]------------------------
//sequence slice (get)
-static PyObject *Color_slice(ColorObject * self, int begin, int end)
+static PyObject *Color_slice(ColorObject *self, int begin, int end)
{
PyObject *tuple;
int count;
@@ -228,12 +244,12 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end)
return NULL;
CLAMP(begin, 0, COLOR_SIZE);
- if (end<0) end= (COLOR_SIZE + 1) + end;
+ if (end < 0) end = (COLOR_SIZE + 1) + end;
CLAMP(end, 0, COLOR_SIZE);
- begin= MIN2(begin, end);
+ begin = MIN2(begin, end);
- tuple= PyTuple_New(end - begin);
- for (count= begin; count < end; count++) {
+ tuple = PyTuple_New(end - begin);
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->col[count]));
}
@@ -250,11 +266,11 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
return -1;
CLAMP(begin, 0, COLOR_SIZE);
- if (end<0) end= (COLOR_SIZE + 1) + end;
+ if (end < 0) end = (COLOR_SIZE + 1) + end;
CLAMP(end, 0, COLOR_SIZE);
begin = MIN2(begin, end);
- if ((size=mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1)
+ if ((size = mathutils_array_parse(col, 0, COLOR_SIZE, seq, "mathutils.Color[begin:end] = []")) == -1)
return -1;
if (size != (end - begin)) {
@@ -264,7 +280,7 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
return -1;
}
- for (i= 0; i < COLOR_SIZE; i++)
+ for (i = 0; i < COLOR_SIZE; i++)
self->col[begin + i] = col[i];
(void)BaseMath_WriteCallback(self);
@@ -376,8 +392,8 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2)
Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
- color1 = (ColorObject*)v1;
- color2 = (ColorObject*)v2;
+ color1 = (ColorObject *)v1;
+ color2 = (ColorObject *)v2;
if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
@@ -399,8 +415,8 @@ static PyObject *Color_iadd(PyObject *v1, PyObject *v2)
Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
- color1 = (ColorObject*)v1;
- color2 = (ColorObject*)v2;
+ color1 = (ColorObject *)v1;
+ color2 = (ColorObject *)v2;
if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
@@ -425,8 +441,8 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2)
Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
- color1 = (ColorObject*)v1;
- color2 = (ColorObject*)v2;
+ color1 = (ColorObject *)v1;
+ color2 = (ColorObject *)v2;
if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
@@ -439,7 +455,7 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2)
/* subtraction in-place: obj -= obj */
static PyObject *Color_isub(PyObject *v1, PyObject *v2)
{
- ColorObject *color1= NULL, *color2= NULL;
+ ColorObject *color1 = NULL, *color2 = NULL;
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
PyErr_Format(PyExc_TypeError,
@@ -448,8 +464,8 @@ static PyObject *Color_isub(PyObject *v1, PyObject *v2)
Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
- color1 = (ColorObject*)v1;
- color2 = (ColorObject*)v2;
+ color1 = (ColorObject *)v1;
+ color2 = (ColorObject *)v2;
if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
@@ -475,12 +491,12 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
float scalar;
if ColorObject_Check(v1) {
- color1= (ColorObject *)v1;
+ color1 = (ColorObject *)v1;
if (BaseMath_ReadCallback(color1) == -1)
return NULL;
}
if ColorObject_Check(v2) {
- color2= (ColorObject *)v2;
+ color2 = (ColorObject *)v2;
if (BaseMath_ReadCallback(color2) == -1)
return NULL;
}
@@ -491,12 +507,12 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
/* col * col, dont support yet! */
}
else if (color1) {
- if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR * FLOAT */
+ if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR * FLOAT */
return color_mul_float(color1, scalar);
}
}
else if (color2) {
- if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* FLOAT * COLOR */
+ if (((scalar = PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred()) == 0) { /* FLOAT * COLOR */
return color_mul_float(color2, scalar);
}
}
@@ -517,7 +533,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2)
float scalar;
if ColorObject_Check(v1) {
- color1= (ColorObject *)v1;
+ color1 = (ColorObject *)v1;
if (BaseMath_ReadCallback(color1) == -1)
return NULL;
}
@@ -528,8 +544,8 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2)
}
/* make sure v1 is always the vector */
- if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR * FLOAT */
- if (scalar==0.0f) {
+ if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR * FLOAT */
+ if (scalar == 0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError,
"Color division: divide by zero error");
return NULL;
@@ -554,7 +570,7 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2)
return NULL;
/* only support color *= float */
- if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR *= FLOAT */
+ if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR *= FLOAT */
mul_vn_fl(color->col, COLOR_SIZE, scalar);
}
else {
@@ -580,8 +596,8 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
return NULL;
/* only support color /= float */
- if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR /= FLOAT */
- if (scalar==0.0f) {
+ if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR /= FLOAT */
+ if (scalar == 0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError,
"Color division: divide by zero error");
return NULL;
@@ -603,7 +619,7 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
}
/* -obj
- returns the negative of this object*/
+ returns the negative of this object */
static PyObject *Color_neg(ColorObject *self)
{
float tcol[COLOR_SIZE];
@@ -654,21 +670,29 @@ static PyNumberMethods Color_NumMethods = {
};
/* color channel, vector.r/g/b */
-static PyObject *Color_getChannel(ColorObject * self, void *type)
+PyDoc_STRVAR(Color_channel_r_doc, "Red color channel.\n\n:type: float");
+PyDoc_STRVAR(Color_channel_g_doc, "Green color channel.\n\n:type: float");
+PyDoc_STRVAR(Color_channel_b_doc, "Blue color channel.\n\n:type: float");
+
+static PyObject *Color_channel_get(ColorObject *self, void *type)
{
return Color_item(self, GET_INT_FROM_POINTER(type));
}
-static int Color_setChannel(ColorObject * self, PyObject *value, void * type)
+static int Color_channel_set(ColorObject *self, PyObject *value, void * type)
{
return Color_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
/* color channel (HSV), color.h/s/v */
-static PyObject *Color_getChannelHSV(ColorObject * self, void *type)
+PyDoc_STRVAR(Color_channel_hsv_h_doc, "HSV Hue component in [0, 1].\n\n:type: float");
+PyDoc_STRVAR(Color_channel_hsv_s_doc, "HSV Saturation component in [0, 1].\n\n:type: float");
+PyDoc_STRVAR(Color_channel_hsv_v_doc, "HSV Value component in [0, 1].\n\n:type: float");
+
+static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
{
float hsv[3];
- int i= GET_INT_FROM_POINTER(type);
+ int i = GET_INT_FROM_POINTER(type);
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -678,10 +702,10 @@ static PyObject *Color_getChannelHSV(ColorObject * self, void *type)
return PyFloat_FromDouble(hsv[i]);
}
-static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type)
+static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void * type)
{
float hsv[3];
- int i= GET_INT_FROM_POINTER(type);
+ int i = GET_INT_FROM_POINTER(type);
float f = PyFloat_AsDouble(value);
if (f == -1 && PyErr_Occurred()) {
@@ -706,7 +730,8 @@ static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type)
}
/* color channel (HSV), color.h/s/v */
-static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure))
+PyDoc_STRVAR(Color_hsv_doc, "HSV Values in [0, 1].\n\n:type: float triplet");
+static PyObject *Color_hsv_get(ColorObject *self, void *UNUSED(closure))
{
float hsv[3];
PyObject *ret;
@@ -716,14 +741,14 @@ static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure))
rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2]));
- ret= PyTuple_New(3);
+ ret = PyTuple_New(3);
PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(hsv[0]));
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(hsv[1]));
PyTuple_SET_ITEM(ret, 2, PyFloat_FromDouble(hsv[2]));
return ret;
}
-static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closure))
+static int Color_hsv_set(ColorObject *self, PyObject *value, void *UNUSED(closure))
{
float hsv[3];
@@ -746,18 +771,18 @@ static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closur
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef Color_getseters[] = {
- {(char *)"r", (getter)Color_getChannel, (setter)Color_setChannel, (char *)"Red color channel.\n\n:type: float", (void *)0},
- {(char *)"g", (getter)Color_getChannel, (setter)Color_setChannel, (char *)"Green color channel.\n\n:type: float", (void *)1},
- {(char *)"b", (getter)Color_getChannel, (setter)Color_setChannel, (char *)"Blue color channel.\n\n:type: float", (void *)2},
+ {(char *)"r", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_r_doc, (void *)0},
+ {(char *)"g", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_g_doc, (void *)1},
+ {(char *)"b", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_b_doc, (void *)2},
- {(char *)"h", (getter)Color_getChannelHSV, (setter)Color_setChannelHSV, (char *)"HSV Hue component in [0, 1].\n\n:type: float", (void *)0},
- {(char *)"s", (getter)Color_getChannelHSV, (setter)Color_setChannelHSV, (char *)"HSV Saturation component in [0, 1].\n\n:type: float", (void *)1},
- {(char *)"v", (getter)Color_getChannelHSV, (setter)Color_setChannelHSV, (char *)"HSV Value component in [0, 1].\n\n:type: float", (void *)2},
+ {(char *)"h", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_h_doc, (void *)0},
+ {(char *)"s", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_s_doc, (void *)1},
+ {(char *)"v", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_v_doc, (void *)2},
- {(char *)"hsv", (getter)Color_getHSV, (setter)Color_setHSV, (char *)"HSV Values in [0, 1].\n\n:type: float triplet", (void *)0},
+ {(char *)"hsv", (getter)Color_hsv_get, (setter)Color_hsv_set, (char *)Color_hsv_doc, (void *)0},
- {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
- {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
+ {(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
+ {(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -789,7 +814,7 @@ PyTypeObject color_Type = {
&Color_AsMapping, //tp_as_mapping
NULL, //tp_hash
NULL, //tp_call
- NULL, //tp_str
+ (reprfunc) Color_str, //tp_str
NULL, //tp_getattro
NULL, //tp_setattro
NULL, //tp_as_buffer
@@ -831,13 +856,13 @@ PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
{
ColorObject *self;
- self= base_type ? (ColorObject *)base_type->tp_alloc(base_type, 0) :
+ self = base_type ? (ColorObject *)base_type->tp_alloc(base_type, 0) :
(ColorObject *)PyObject_GC_New(ColorObject, &color_Type);
if (self) {
/* init callbacks as NULL */
- self->cb_user= NULL;
- self->cb_type= self->cb_subtype= 0;
+ self->cb_user = NULL;
+ self->cb_type = self->cb_subtype = 0;
if (type == Py_WRAP) {
self->col = col;
@@ -862,12 +887,12 @@ PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
{
- ColorObject *self= (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL);
+ ColorObject *self = (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user= cb_user;
- self->cb_type= (unsigned char)cb_type;
- self->cb_subtype= (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = (unsigned char)cb_type;
+ self->cb_subtype = (unsigned char)cb_subtype;
PyObject_GC_Track(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 7e769da14cb..66caed50aa9 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -36,6 +36,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_dynstr.h"
#define EULER_SIZE 3
@@ -43,11 +44,11 @@
//makes a new euler for you to play with
static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- PyObject *seq= NULL;
- const char *order_str= NULL;
+ PyObject *seq = NULL;
+ const char *order_str = NULL;
- float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f};
- short order= EULER_ORDER_XYZ;
+ float eul[EULER_SIZE] = {0.0f, 0.0f, 0.0f};
+ short order = EULER_ORDER_XYZ;
if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
@@ -59,11 +60,11 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str))
return NULL;
- switch(PyTuple_GET_SIZE(args)) {
+ switch (PyTuple_GET_SIZE(args)) {
case 0:
break;
case 2:
- if ((order=euler_order_from_string(order_str, "mathutils.Euler()")) == -1)
+ if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1)
return NULL;
/* intentionally pass through */
case 1:
@@ -78,13 +79,13 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static const char *euler_order_str(EulerObject *self)
{
static const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"};
- return order[self->order-EULER_ORDER_XYZ];
+ return order[self->order - EULER_ORDER_XYZ];
}
short euler_order_from_string(const char *str, const char *error_prefix)
{
- if ((str[0] && str[1] && str[2] && str[3]=='\0')) {
- switch(*((PY_INT32_T *)str)) {
+ if ((str[0] && str[1] && str[2] && str[3] == '\0')) {
+ switch (*((PY_INT32_T *)str)) {
case 'X'|'Y'<<8|'Z'<<16: return EULER_ORDER_XYZ;
case 'X'|'Z'<<8|'Y'<<16: return EULER_ORDER_XZY;
case 'Y'|'X'<<8|'Z'<<16: return EULER_ORDER_YXZ;
@@ -106,15 +107,15 @@ static PyObject *Euler_ToTupleExt(EulerObject *self, int ndigits)
PyObject *ret;
int i;
- ret= PyTuple_New(EULER_SIZE);
+ ret = PyTuple_New(EULER_SIZE);
if (ndigits >= 0) {
- for (i= 0; i < EULER_SIZE; i++) {
+ for (i = 0; i < EULER_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->eul[i], ndigits)));
}
}
else {
- for (i= 0; i < EULER_SIZE; i++) {
+ for (i = 0; i < EULER_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->eul[i]));
}
}
@@ -133,7 +134,7 @@ PyDoc_STRVAR(Euler_to_quaternion_doc,
" :return: Quaternion representation of the euler.\n"
" :rtype: :class:`Quaternion`\n"
);
-static PyObject *Euler_to_quaternion(EulerObject * self)
+static PyObject *Euler_to_quaternion(EulerObject *self)
{
float quat[4];
@@ -154,7 +155,7 @@ PyDoc_STRVAR(Euler_to_matrix_doc,
" :return: A 3x3 roation matrix representation of the euler.\n"
" :rtype: :class:`Matrix`\n"
);
-static PyObject *Euler_to_matrix(EulerObject * self)
+static PyObject *Euler_to_matrix(EulerObject *self)
{
float mat[9];
@@ -171,7 +172,7 @@ PyDoc_STRVAR(Euler_zero_doc,
"\n"
" Set all values to zero.\n"
);
-static PyObject *Euler_zero(EulerObject * self)
+static PyObject *Euler_zero(EulerObject *self)
{
zero_v3(self->eul);
@@ -192,12 +193,12 @@ PyDoc_STRVAR(Euler_rotate_axis_doc,
" :arg angle: angle in radians.\n"
" :type angle: float\n"
);
-static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
+static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args)
{
float angle = 0.0f;
int axis; /* actually a character */
- if (!PyArg_ParseTuple(args, "Cf:rotate", &axis, &angle)) {
+ if (!PyArg_ParseTuple(args, "Cf:rotate_axis", &axis, &angle)) {
PyErr_SetString(PyExc_TypeError,
"Euler.rotate_axis(): "
"expected an axis 'X', 'Y', 'Z' and an angle (float)");
@@ -230,7 +231,7 @@ PyDoc_STRVAR(Euler_rotate_doc,
" :arg other: rotation component of mathutils value\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
);
-static PyObject *Euler_rotate(EulerObject * self, PyObject *value)
+static PyObject *Euler_rotate(EulerObject *self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
@@ -257,7 +258,7 @@ PyDoc_STRVAR(Euler_make_compatible_doc,
"\n"
" .. note:: the rotation order is not taken into account for this function.\n"
);
-static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
+static PyObject *Euler_make_compatible(EulerObject *self, PyObject *value)
{
float teul[EULER_SIZE];
@@ -302,34 +303,49 @@ static PyObject *Euler_copy(EulerObject *self)
//----------------------------print object (internal)--------------
//print the object to screen
-static PyObject *Euler_repr(EulerObject * self)
+static PyObject *Euler_repr(EulerObject *self)
{
PyObject *ret, *tuple;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- tuple= Euler_ToTupleExt(self, -1);
+ tuple = Euler_ToTupleExt(self, -1);
- ret= PyUnicode_FromFormat("Euler(%R, '%s')", tuple, euler_order_str(self));
+ ret = PyUnicode_FromFormat("Euler(%R, '%s')", tuple, euler_order_str(self));
Py_DECREF(tuple);
return ret;
}
-static PyObject* Euler_richcmpr(PyObject *a, PyObject *b, int op)
+static PyObject *Euler_str(EulerObject *self)
+{
+ DynStr *ds;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ ds = BLI_dynstr_new();
+
+ BLI_dynstr_appendf(ds, "<Euler (x=%.4f, y=%.4f, z=%.4f), order='%s'>",
+ self->eul[0], self->eul[1], self->eul[2], euler_order_str(self));
+
+ return mathutils_dynstr_to_py(ds); /* frees ds */
+}
+
+static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
{
PyObject *res;
- int ok= -1; /* zero is true */
+ int ok = -1; /* zero is true */
if (EulerObject_Check(a) && EulerObject_Check(b)) {
- EulerObject *eulA= (EulerObject*)a;
- EulerObject *eulB= (EulerObject*)b;
+ EulerObject *eulA = (EulerObject *)a;
+ EulerObject *eulB = (EulerObject *)b;
if (BaseMath_ReadCallback(eulA) == -1 || BaseMath_ReadCallback(eulB) == -1)
return NULL;
- ok= ((eulA->order == eulB->order) && EXPP_VectorsAreEqual(eulA->eul, eulB->eul, EULER_SIZE, 1)) ? 0 : -1;
+ ok = ((eulA->order == eulB->order) && EXPP_VectorsAreEqual(eulA->eul, eulB->eul, EULER_SIZE, 1)) ? 0 : -1;
}
switch (op) {
@@ -362,9 +378,9 @@ static int Euler_len(EulerObject *UNUSED(self))
}
//----------------------------object[]---------------------------
//sequence accessor (get)
-static PyObject *Euler_item(EulerObject * self, int i)
+static PyObject *Euler_item(EulerObject *self, int i)
{
- if (i<0) i= EULER_SIZE-i;
+ if (i < 0) i = EULER_SIZE - i;
if (i < 0 || i >= EULER_SIZE) {
PyErr_SetString(PyExc_IndexError,
@@ -381,7 +397,7 @@ static PyObject *Euler_item(EulerObject * self, int i)
}
//----------------------------object[]-------------------------
//sequence accessor (set)
-static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
+static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
{
float f = PyFloat_AsDouble(value);
@@ -392,7 +408,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
return -1;
}
- if (i<0) i= EULER_SIZE-i;
+ if (i < 0) i = EULER_SIZE - i;
if (i < 0 || i >= EULER_SIZE) {
PyErr_SetString(PyExc_IndexError,
@@ -410,7 +426,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
}
//----------------------------object[z:y]------------------------
//sequence slice (get)
-static PyObject *Euler_slice(EulerObject * self, int begin, int end)
+static PyObject *Euler_slice(EulerObject *self, int begin, int end)
{
PyObject *tuple;
int count;
@@ -419,11 +435,11 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end)
return NULL;
CLAMP(begin, 0, EULER_SIZE);
- if (end<0) end= (EULER_SIZE + 1) + end;
+ if (end < 0) end = (EULER_SIZE + 1) + end;
CLAMP(end, 0, EULER_SIZE);
- begin= MIN2(begin, end);
+ begin = MIN2(begin, end);
- tuple= PyTuple_New(end - begin);
+ tuple = PyTuple_New(end - begin);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->eul[count]));
}
@@ -441,11 +457,11 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
return -1;
CLAMP(begin, 0, EULER_SIZE);
- if (end<0) end= (EULER_SIZE + 1) + end;
+ if (end < 0) end = (EULER_SIZE + 1) + end;
CLAMP(end, 0, EULER_SIZE);
begin = MIN2(begin, end);
- if ((size=mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1)
+ if ((size = mathutils_array_parse(eul, 0, EULER_SIZE, seq, "mathutils.Euler[begin:end] = []")) == -1)
return -1;
if (size != (end - begin)) {
@@ -455,7 +471,7 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
return -1;
}
- for (i= 0; i < EULER_SIZE; i++)
+ for (i = 0; i < EULER_SIZE; i++)
self->eul[begin + i] = eul[i];
(void)BaseMath_WriteCallback(self);
@@ -552,21 +568,27 @@ static PyMappingMethods Euler_AsMapping = {
(objobjargproc)Euler_ass_subscript
};
-/*
- * euler axis, euler.x/y/z
- */
-static PyObject *Euler_getAxis(EulerObject *self, void *type)
+/* euler axis, euler.x/y/z */
+
+PyDoc_STRVAR(Euler_axis_doc,
+"Euler axis angle in radians.\n\n:type: float"
+);
+static PyObject *Euler_axis_get(EulerObject *self, void *type)
{
return Euler_item(self, GET_INT_FROM_POINTER(type));
}
-static int Euler_setAxis(EulerObject *self, PyObject *value, void *type)
+static int Euler_axis_set(EulerObject *self, PyObject *value, void *type)
{
return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
/* rotation order */
-static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure))
+
+PyDoc_STRVAR(Euler_order_doc,
+"Euler rotation order.\n\n:type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']"
+);
+static PyObject *Euler_order_get(EulerObject *self, void *UNUSED(closure))
{
if (BaseMath_ReadCallback(self) == -1) /* can read order too */
return NULL;
@@ -574,15 +596,15 @@ static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure))
return PyUnicode_FromString(euler_order_str(self));
}
-static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closure))
+static int Euler_order_set(EulerObject *self, PyObject *value, void *UNUSED(closure))
{
- const char *order_str= _PyUnicode_AsString(value);
- short order= euler_order_from_string(order_str, "euler.order");
+ const char *order_str = _PyUnicode_AsString(value);
+ short order = euler_order_from_string(order_str, "euler.order");
if (order == -1)
return -1;
- self->order= order;
+ self->order = order;
(void)BaseMath_WriteCallback(self); /* order can be written back */
return 0;
}
@@ -591,13 +613,13 @@ static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closu
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef Euler_getseters[] = {
- {(char *)"x", (getter)Euler_getAxis, (setter)Euler_setAxis, (char *)"Euler X axis in radians.\n\n:type: float", (void *)0},
- {(char *)"y", (getter)Euler_getAxis, (setter)Euler_setAxis, (char *)"Euler Y axis in radians.\n\n:type: float", (void *)1},
- {(char *)"z", (getter)Euler_getAxis, (setter)Euler_setAxis, (char *)"Euler Z axis in radians.\n\n:type: float", (void *)2},
- {(char *)"order", (getter)Euler_getOrder, (setter)Euler_setOrder, (char *)"Euler rotation order.\n\n:type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']", (void *)NULL},
+ {(char *)"x", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)0},
+ {(char *)"y", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)1},
+ {(char *)"z", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)2},
+ {(char *)"order", (getter)Euler_order_get, (setter)Euler_order_set, Euler_order_doc, (void *)NULL},
- {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
- {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
+ {(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
+ {(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -635,7 +657,7 @@ PyTypeObject euler_Type = {
&Euler_AsMapping, //tp_as_mapping
NULL, //tp_hash
NULL, //tp_call
- NULL, //tp_str
+ (reprfunc) Euler_str, //tp_str
NULL, //tp_getattro
NULL, //tp_setattro
NULL, //tp_as_buffer
@@ -677,13 +699,13 @@ PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *
{
EulerObject *self;
- self= base_type ? (EulerObject *)base_type->tp_alloc(base_type, 0) :
+ self = base_type ? (EulerObject *)base_type->tp_alloc(base_type, 0) :
(EulerObject *)PyObject_GC_New(EulerObject, &euler_Type);
if (self) {
/* init callbacks as NULL */
- self->cb_user= NULL;
- self->cb_type= self->cb_subtype= 0;
+ self->cb_user = NULL;
+ self->cb_type = self->cb_subtype = 0;
if (type == Py_WRAP) {
self->eul = eul;
@@ -704,7 +726,7 @@ PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *
Py_FatalError("Euler(): invalid type!");
}
- self->order= order;
+ self->order = order;
}
return (PyObject *)self;
@@ -712,12 +734,12 @@ PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *
PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype)
{
- EulerObject *self= (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);
+ EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user= cb_user;
- self->cb_type= (unsigned char)cb_type;
- self->cb_subtype= (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = (unsigned char)cb_type;
+ self->cb_subtype = (unsigned char)cb_subtype;
PyObject_GC_Track(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index 130384a1792..c42b0daffbc 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -47,7 +47,7 @@ typedef struct {
/*struct data contains a pointer to the actual data that the
object uses. It can use either PyMem allocated data (which will
be stored in py_data) or be a wrapper for data allocated through
-blender (stored in blend_data). This is an either/or struct not both*/
+blender (stored in blend_data). This is an either/or struct not both */
//prototypes
PyObject *Euler_CreatePyObject( float *eul, short order, int type, PyTypeObject *base_type);
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index ea636ef52fb..c44443f0ed5 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -35,81 +35,299 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_string.h"
+#include "BLI_dynstr.h"
+
+typedef enum eMatrixAccess_t {
+ MAT_ACCESS_ROW,
+ MAT_ACCESS_COL
+} eMatrixAccess_t;
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);
+static PyObject *MatrixAccess_CreatePyObject(MatrixObject *matrix, const eMatrixAccess_t type);
+
+static int matrix_row_vector_check(MatrixObject *mat, VectorObject *vec, int row)
+{
+ if ((vec->size != mat->num_col) || (row >= mat->num_row)) {
+ PyErr_SetString(PyExc_AttributeError,
+ "Matrix(): "
+ "owner matrix has been resized since this row vector was created");
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
+static int matrix_col_vector_check(MatrixObject *mat, VectorObject *vec, int col)
+{
+ if ((vec->size != mat->num_row) || (col >= mat->num_col)) {
+ PyErr_SetString(PyExc_AttributeError,
+ "Matrix(): "
+ "owner matrix has been resized since this column vector was created");
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
+/* ----------------------------------------------------------------------------
+ * matrix row callbacks
+ * this is so you can do matrix[i][j] = val OR matrix.row[i][j] = val */
+
+int mathutils_matrix_row_cb_index = -1;
+
+static int mathutils_matrix_row_check(BaseMathObject *bmo)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ return BaseMath_ReadCallback(self);
+}
+
+static int mathutils_matrix_row_get(BaseMathObject *bmo, int row)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ int col;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+ return -1;
+
+ for (col = 0; col < self->num_col; col++) {
+ bmo->data[col] = MATRIX_ITEM(self, row, col);
+ }
+
+ return 0;
+}
+
+static int mathutils_matrix_row_set(BaseMathObject *bmo, int row)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ int col;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+ return -1;
+
+ 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_row_get_index(BaseMathObject *bmo, int row, int col)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+ return -1;
+
+ bmo->data[col] = MATRIX_ITEM(self, row, col);
+ return 0;
+}
+
+static int mathutils_matrix_row_set_index(BaseMathObject *bmo, int row, int col)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_row_vector_check(self, (VectorObject *)bmo, row))
+ return -1;
+
+ MATRIX_ITEM(self, row, col) = bmo->data[col];
+
+ (void)BaseMath_WriteCallback(self);
+ return 0;
+}
+
+Mathutils_Callback mathutils_matrix_row_cb = {
+ mathutils_matrix_row_check,
+ mathutils_matrix_row_get,
+ mathutils_matrix_row_set,
+ mathutils_matrix_row_get_index,
+ mathutils_matrix_row_set_index
+};
+
+
+/* ----------------------------------------------------------------------------
+ * matrix row callbacks
+ * this is so you can do matrix.col[i][j] = val */
+
+int mathutils_matrix_col_cb_index = -1;
+
+static int mathutils_matrix_col_check(BaseMathObject *bmo)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ return BaseMath_ReadCallback(self);
+}
+
+static int mathutils_matrix_col_get(BaseMathObject *bmo, int col)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ int num_row;
+ int row;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+ 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_col_set(BaseMathObject *bmo, int col)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ int num_row;
+ int row;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+ return -1;
+
+ /* for 'translation' size will always be '3' even on 4x4 vec */
+ num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
-/* matrix vector callbacks */
-int mathutils_matrix_vector_cb_index= -1;
+ 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_vector_check(BaseMathObject *bmo)
+static int mathutils_matrix_col_get_index(BaseMathObject *bmo, int col, int row)
{
- MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+ return -1;
+
+ bmo->data[row] = MATRIX_ITEM(self, row, col);
+ return 0;
+}
+
+static int mathutils_matrix_col_set_index(BaseMathObject *bmo, int col, int row)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+ if (!matrix_col_vector_check(self, (VectorObject *)bmo, col))
+ return -1;
+
+ MATRIX_ITEM(self, row, col) = bmo->data[row];
+
+ (void)BaseMath_WriteCallback(self);
+ return 0;
+}
+
+Mathutils_Callback mathutils_matrix_col_cb = {
+ mathutils_matrix_col_check,
+ mathutils_matrix_col_get,
+ mathutils_matrix_col_set,
+ mathutils_matrix_col_get_index,
+ mathutils_matrix_col_set_index
+};
+
+
+/* ----------------------------------------------------------------------------
+ * matrix row callbacks
+ * this is so you can do matrix.translation = val
+ * note, this is _exactly like matrix.col except the 4th component is always omitted */
+
+int mathutils_matrix_translation_cb_index = -1;
+
+static int mathutils_matrix_translation_check(BaseMathObject *bmo)
+{
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
return BaseMath_ReadCallback(self);
}
-static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype)
+static int mathutils_matrix_translation_get(BaseMathObject *bmo, int col)
{
- MatrixObject *self= (MatrixObject *)bmo->cb_user;
- int i;
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ int row;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- for (i=0; i < self->col_size; i++)
- bmo->data[i]= self->matrix[subtype][i];
+ for (row = 0; row < 3; row++) {
+ bmo->data[row] = MATRIX_ITEM(self, row, col);
+ }
return 0;
}
-static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype)
+static int mathutils_matrix_translation_set(BaseMathObject *bmo, int col)
{
- MatrixObject *self= (MatrixObject *)bmo->cb_user;
- int i;
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
+ int row;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- for (i=0; i < self->col_size; i++)
- self->matrix[subtype][i]= bmo->data[i];
+ for (row = 0; row < 3; row++) {
+ MATRIX_ITEM(self, row, col) = bmo->data[row];
+ }
(void)BaseMath_WriteCallback(self);
return 0;
}
-static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int subtype, int index)
+static int mathutils_matrix_translation_get_index(BaseMathObject *bmo, int col, int row)
{
- MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- bmo->data[index]= self->matrix[subtype][index];
+ bmo->data[row] = MATRIX_ITEM(self, row, col);
return 0;
}
-static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, int index)
+static int mathutils_matrix_translation_set_index(BaseMathObject *bmo, int col, int row)
{
- MatrixObject *self= (MatrixObject *)bmo->cb_user;
+ MatrixObject *self = (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- self->matrix[subtype][index]= bmo->data[index];
+ MATRIX_ITEM(self, row, col) = bmo->data[row];
(void)BaseMath_WriteCallback(self);
return 0;
}
-Mathutils_Callback mathutils_matrix_vector_cb = {
- mathutils_matrix_vector_check,
- mathutils_matrix_vector_get,
- mathutils_matrix_vector_set,
- mathutils_matrix_vector_get_index,
- mathutils_matrix_vector_set_index
+Mathutils_Callback mathutils_matrix_translation_cb = {
+ mathutils_matrix_translation_check,
+ mathutils_matrix_translation_get,
+ mathutils_matrix_translation_set,
+ mathutils_matrix_translation_get_index,
+ mathutils_matrix_translation_set_index
};
-/* matrix vector callbacks, this is so you can do matrix[i][j] = val */
+
+
+/* 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.
@@ -123,24 +341,28 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
}
- switch(PyTuple_GET_SIZE(args)) {
+ switch (PyTuple_GET_SIZE(args)) {
case 0:
return Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type);
case 1:
{
- PyObject *arg= PyTuple_GET_ITEM(args, 0);
+ 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 row_size= PySequence_Size(arg);
+ const unsigned short num_row = PySequence_Size(arg);
- if (row_size >= 2 && row_size <= 4) {
- PyObject *item= PySequence_GetItem(arg, 0);
- const unsigned short col_size= PySequence_Size(item);
+ if (num_row >= 2 && num_row <= 4) {
+ PyObject *item = PySequence_GetItem(arg, 0);
+ /* 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 (col_size >= 2 && col_size <= 4) {
+ if (num_col >= 2 && num_col <= 4) {
/* sane row & col size, new matrix and assign as slice */
- PyObject *matrix= Matrix_CreatePyObject(NULL, row_size, col_size, Py_NEW, type);
+ PyObject *matrix = Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, type);
if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
return matrix;
}
@@ -161,8 +383,8 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self)
{
- PyObject *ret= Matrix_copy(self);
- PyObject *ret_dummy= matrix_func(ret);
+ PyObject *ret = Matrix_copy(self);
+ PyObject *ret_dummy = matrix_func(ret);
if (ret_dummy) {
Py_DECREF(ret_dummy);
return (PyObject *)ret;
@@ -206,23 +428,22 @@ PyDoc_STRVAR(C_Matrix_Rotation_doc,
);
static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
{
- PyObject *vec= NULL;
- const char *axis= NULL;
+ PyObject *vec = NULL;
+ const char *axis = NULL;
int matSize;
double angle; /* use double because of precision problems at high values */
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f};
- if (!PyArg_ParseTuple(args, "di|O", &angle, &matSize, &vec)) {
- PyErr_SetString(PyExc_TypeError,
- "Matrix.Rotation(angle, size, axis): "
- "expected float int and a string or vector");
+ if (!PyArg_ParseTuple(args, "di|O:Matrix.Rotation", &angle, &matSize, &vec)) {
return NULL;
}
if (vec && PyUnicode_Check(vec)) {
- axis= _PyUnicode_AsString((PyObject *)vec);
- if (axis==NULL || axis[0]=='\0' || axis[1]!='\0' || axis[0] < 'X' || axis[0] > 'Z') {
+ axis = _PyUnicode_AsString((PyObject *)vec);
+ if (axis == NULL || axis[0] == '\0' || axis[1] != '\0' || axis[0] < 'X' || axis[0] > 'Z') {
PyErr_SetString(PyExc_ValueError,
"Matrix.Rotation(): "
"3rd argument axis value must be a 3D vector "
@@ -231,11 +452,11 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
}
else {
/* use the string */
- vec= NULL;
+ vec = NULL;
}
}
- angle= angle_wrap_rad(angle);
+ angle = angle_wrap_rad(angle);
if (matSize != 2 && matSize != 3 && matSize != 4) {
PyErr_SetString(PyExc_ValueError,
@@ -266,8 +487,8 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
axis_angle_to_mat3((float (*)[3])mat, tvec, angle);
}
else if (matSize == 2) {
- const float angle_cos= cosf(angle);
- const float angle_sin= sinf(angle);
+ const float angle_cos = cosf(angle);
+ const float angle_sin = sinf(angle);
//2D rotation matrix
mat[0] = angle_cos;
@@ -300,15 +521,12 @@ PyDoc_STRVAR(C_Matrix_Translation_doc,
);
static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
{
- float mat[16], tvec[3];
+ float mat[4][4]= MAT4_UNITY;
- if (mathutils_array_parse(tvec, 3, 4, value, "mathutils.Matrix.Translation(vector), invalid vector arg") == -1)
+ if (mathutils_array_parse(mat[3], 3, 4, value, "mathutils.Matrix.Translation(vector), invalid vector arg") == -1)
return NULL;
- /* create a identity matrix and add translation */
- unit_m4((float(*)[4]) mat);
- copy_v3_v3(mat + 12, tvec); /* 12, 13, 14 */
- return Matrix_CreatePyObject(mat, 4, 4, Py_NEW, (PyTypeObject *)cls);
+ return Matrix_CreatePyObject(&mat[0][0], 4, 4, Py_NEW, (PyTypeObject *)cls);
}
//----------------------------------mathutils.Matrix.Scale() -------------
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
@@ -328,13 +546,15 @@ PyDoc_STRVAR(C_Matrix_Scale_doc,
);
static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
{
- PyObject *vec= NULL;
+ PyObject *vec = NULL;
int vec_size;
float tvec[3];
float factor;
int matSize;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f};
if (!PyArg_ParseTuple(args, "fi|O:Matrix.Scale", &factor, &matSize, &vec)) {
return NULL;
@@ -346,8 +566,10 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
return NULL;
}
if (vec) {
- vec_size= (matSize == 2 ? 2 : 3);
- if (mathutils_array_parse(tvec, vec_size, vec_size, vec, "Matrix.Scale(factor, size, axis), invalid 'axis' arg") == -1) {
+ vec_size = (matSize == 2 ? 2 : 3);
+ if (mathutils_array_parse(tvec, vec_size, vec_size, vec,
+ "Matrix.Scale(factor, size, axis), invalid 'axis' arg") == -1)
+ {
return NULL;
}
}
@@ -419,8 +641,10 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
int matSize, x;
float norm = 0.0f;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f};
if (!PyArg_ParseTuple(args, "Oi:Matrix.OrthoProjection", &axis, &matSize)) {
return NULL;
@@ -434,13 +658,13 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
if (PyUnicode_Check(axis)) { //ortho projection onto cardinal plane
Py_ssize_t plane_len;
- const char *plane= _PyUnicode_AsStringAndSize(axis, &plane_len);
+ const char *plane = _PyUnicode_AsStringAndSize(axis, &plane_len);
if (matSize == 2) {
- if (plane_len == 1 && plane[0]=='X') {
- mat[0]= 1.0f;
+ if (plane_len == 1 && plane[0] == 'X') {
+ mat[0] = 1.0f;
}
- else if (plane_len == 1 && plane[0]=='Y') {
- mat[3]= 1.0f;
+ else if (plane_len == 1 && plane[0] == 'Y') {
+ mat[3] = 1.0f;
}
else {
PyErr_Format(PyExc_ValueError,
@@ -451,17 +675,17 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
}
}
else {
- if (plane_len == 2 && plane[0]=='X' && plane[1]=='Y') {
- mat[0]= 1.0f;
- mat[4]= 1.0f;
+ if (plane_len == 2 && plane[0] == 'X' && plane[1] == 'Y') {
+ mat[0] = 1.0f;
+ mat[4] = 1.0f;
}
- else if (plane_len == 2 && plane[0]=='X' && plane[1]=='Z') {
- mat[0]= 1.0f;
- mat[8]= 1.0f;
+ else if (plane_len == 2 && plane[0] == 'X' && plane[1] == 'Z') {
+ mat[0] = 1.0f;
+ mat[8] = 1.0f;
}
- else if (plane_len == 2 && plane[0]=='Y' && plane[1]=='Z') {
- mat[4]= 1.0f;
- mat[8]= 1.0f;
+ else if (plane_len == 2 && plane[0] == 'Y' && plane[1] == 'Z') {
+ mat[4] = 1.0f;
+ mat[8] = 1.0f;
}
else {
PyErr_Format(PyExc_ValueError,
@@ -475,7 +699,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
else {
//arbitrary plane
- int vec_size= (matSize == 2 ? 2 : 3);
+ int vec_size = (matSize == 2 ? 2 : 3);
float tvec[4];
if (mathutils_array_parse(tvec, vec_size, vec_size, axis,
@@ -494,19 +718,19 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
}
if (matSize == 2) {
mat[0] = 1 - (tvec[0] * tvec[0]);
- mat[1] = -(tvec[0] * tvec[1]);
- mat[2] = -(tvec[0] * tvec[1]);
+ mat[1] = - (tvec[0] * tvec[1]);
+ mat[2] = - (tvec[0] * tvec[1]);
mat[3] = 1 - (tvec[1] * tvec[1]);
}
else if (matSize > 2) {
mat[0] = 1 - (tvec[0] * tvec[0]);
- mat[1] = -(tvec[0] * tvec[1]);
- mat[2] = -(tvec[0] * tvec[2]);
- mat[3] = -(tvec[0] * tvec[1]);
+ mat[1] = - (tvec[0] * tvec[1]);
+ mat[2] = - (tvec[0] * tvec[2]);
+ mat[3] = - (tvec[0] * tvec[1]);
mat[4] = 1 - (tvec[1] * tvec[1]);
- mat[5] = -(tvec[1] * tvec[2]);
- mat[6] = -(tvec[0] * tvec[2]);
- mat[7] = -(tvec[1] * tvec[2]);
+ mat[5] = - (tvec[1] * tvec[2]);
+ mat[6] = - (tvec[0] * tvec[2]);
+ mat[7] = - (tvec[1] * tvec[2]);
mat[8] = 1 - (tvec[2] * tvec[2]);
}
}
@@ -538,8 +762,10 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
int matSize;
const char *plane;
PyObject *fac;
- float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f};
if (!PyArg_ParseTuple(args, "siO:Matrix.Shear", &plane, &matSize, &fac)) {
return NULL;
@@ -552,9 +778,9 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
}
if (matSize == 2) {
- float const factor= PyFloat_AsDouble(fac);
+ float const factor = PyFloat_AsDouble(fac);
- if (factor==-1.0f && PyErr_Occurred()) {
+ if (factor == -1.0f && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"Matrix.Shear(): "
"the factor to be a float");
@@ -620,27 +846,25 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
void matrix_as_3x3(float mat[3][3], MatrixObject *self)
{
- copy_v3_v3(mat[0], self->matrix[0]);
- copy_v3_v3(mat[1], self->matrix[1]);
- copy_v3_v3(mat[2], self->matrix[2]);
+ copy_v3_v3(mat[0], MATRIX_COL_PTR(self, 0));
+ copy_v3_v3(mat[1], MATRIX_COL_PTR(self, 1));
+ copy_v3_v3(mat[2], MATRIX_COL_PTR(self, 2));
}
/* assumes rowsize == colsize is checked and the read callback has run */
static float matrix_determinant_internal(MatrixObject *self)
{
- if (self->row_size == 2) {
- return determinant_m2(self->matrix[0][0], self->matrix[0][1],
- self->matrix[1][0], self->matrix[1][1]);
+ if (self->num_col == 2) {
+ return determinant_m2(MATRIX_ITEM(self, 0, 0), MATRIX_ITEM(self, 0, 1),
+ MATRIX_ITEM(self, 1, 0), MATRIX_ITEM(self, 1, 1));
}
- else if (self->row_size == 3) {
- return determinant_m3(self->matrix[0][0], self->matrix[0][1],
- self->matrix[0][2], self->matrix[1][0],
- self->matrix[1][1], self->matrix[1][2],
- self->matrix[2][0], self->matrix[2][1],
- self->matrix[2][2]);
+ else if (self->num_col == 3) {
+ return determinant_m3(MATRIX_ITEM(self, 0, 0), MATRIX_ITEM(self, 0, 1), MATRIX_ITEM(self, 0, 2),
+ MATRIX_ITEM(self, 1, 0), MATRIX_ITEM(self, 1, 1), MATRIX_ITEM(self, 1, 2),
+ MATRIX_ITEM(self, 2, 0), MATRIX_ITEM(self, 2, 1), MATRIX_ITEM(self, 2, 2));
}
else {
- return determinant_m4((float (*)[4])self->contigPtr);
+ return determinant_m4((float (*)[4])self->matrix);
}
}
@@ -661,18 +885,18 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- /*must be 3-4 cols, 3-4 rows, square matrix*/
- if ((self->col_size < 3) || (self->row_size < 3) || (self->col_size != self->row_size)) {
+ /* must be 3-4 cols, 3-4 rows, square matrix */
+ if ((self->num_row < 3) || (self->num_col < 3) || (self->num_row != self->num_col)) {
PyErr_SetString(PyExc_ValueError,
"Matrix.to_quat(): "
"inappropriate matrix size - expects 3x3 or 4x4 matrix");
return NULL;
}
- if (self->col_size == 3) {
- mat3_to_quat(quat, (float (*)[3])self->contigPtr);
+ if (self->num_row == 3) {
+ mat3_to_quat(quat, (float (*)[3])self->matrix);
}
else {
- mat4_to_quat(quat, (float (*)[4])self->contigPtr);
+ mat4_to_quat(quat, (float (*)[4])self->matrix);
}
return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
@@ -697,8 +921,8 @@ PyDoc_STRVAR(Matrix_to_euler_doc,
);
static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
{
- const char *order_str= NULL;
- short order= EULER_ORDER_XYZ;
+ const char *order_str = NULL;
+ short order = EULER_ORDER_XYZ;
float eul[3], eul_compatf[3];
EulerObject *eul_compat = NULL;
@@ -718,13 +942,13 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
copy_v3_v3(eul_compatf, eul_compat->eul);
}
- /*must be 3-4 cols, 3-4 rows, square matrix*/
- if (self->col_size ==3 && self->row_size ==3) {
- mat= (float (*)[3])self->contigPtr;
+ /*must be 3-4 cols, 3-4 rows, square matrix */
+ if (self->num_row ==3 && self->num_col ==3) {
+ mat = (float (*)[3])self->matrix;
}
- else if (self->col_size ==4 && self->row_size ==4) {
- copy_m3_m4(tmat, (float (*)[4])self->contigPtr);
- mat= tmat;
+ else if (self->num_row ==4 && self->num_col ==4) {
+ copy_m3_m4(tmat, (float (*)[4])self->matrix);
+ mat = tmat;
}
else {
PyErr_SetString(PyExc_ValueError,
@@ -734,7 +958,7 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
}
if (order_str) {
- order= euler_order_from_string(order_str, "Matrix.to_euler()");
+ order = euler_order_from_string(order_str, "Matrix.to_euler()");
if (order == -1)
return NULL;
@@ -759,9 +983,10 @@ 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[4][4] = MAT4_UNITY;
+ int col;
- if (self->wrapped==Py_WRAP) {
+ if (self->wrapped == Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
"Matrix.resize_4x4(): "
"cannot resize wrapped data - make a copy and resize that");
@@ -774,43 +999,22 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
return NULL;
}
- self->contigPtr = PyMem_Realloc(self->contigPtr, (sizeof(float) * 16));
- if (self->contigPtr == NULL) {
+ self->matrix = PyMem_Realloc(self->matrix, (sizeof(float) * 16));
+ if (self->matrix == NULL) {
PyErr_SetString(PyExc_MemoryError,
"Matrix.resize_4x4(): "
"problem allocating pointer space");
return NULL;
}
- /*set row pointers*/
- for (x = 0; x < 4; x++) {
- self->matrix[x] = self->contigPtr + (x * 4);
- }
- /*move data to new spot in array + clean*/
- for (blank_rows = (4 - self->row_size); blank_rows > 0; blank_rows--) {
- for (x = 0; x < 4; x++) {
- index = (4 * (self->row_size + (blank_rows - 1))) + x;
- if (index == 10 || index == 15) {
- self->contigPtr[index] = 1.0f;
- }
- else {
- self->contigPtr[index] = 0.0f;
- }
- }
- }
- for (x = 1; x <= self->row_size; x++) {
- first_row_elem = (self->col_size * (self->row_size - x));
- curr_pos = (first_row_elem + (self->col_size -1));
- new_pos = (4 * (self->row_size - x)) + (curr_pos - first_row_elem);
- for (blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--) {
- self->contigPtr[new_pos + blank_columns] = 0.0f;
- }
- for ( ; curr_pos >= first_row_elem; curr_pos--) {
- self->contigPtr[new_pos] = self->contigPtr[curr_pos];
- new_pos--;
- }
+
+ for (col = 0; col < self->num_col; col++) {
+ memcpy(mat[col], MATRIX_COL_PTR(self, col), self->num_row * sizeof(float));
}
- self->row_size = 4;
- self->col_size = 4;
+
+ copy_m4_m4((float (*)[4])self->matrix, (float (*)[4])mat);
+
+ self->num_col = 4;
+ self->num_row = 4;
Py_RETURN_NONE;
}
@@ -828,12 +1032,12 @@ static PyObject *Matrix_to_4x4(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (self->col_size==4 && self->row_size==4) {
- return Matrix_CreatePyObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
+ if (self->num_row == 4 && self->num_col == 4) {
+ return Matrix_CreatePyObject(self->matrix, 4, 4, Py_NEW, Py_TYPE(self));
}
- else if (self->col_size==3 && self->row_size==3) {
+ else if (self->num_row == 3 && self->num_col == 3) {
float mat[4][4];
- copy_m4_m3(mat, (float (*)[3])self->contigPtr);
+ copy_m4_m3(mat, (float (*)[3])self->matrix);
return Matrix_CreatePyObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
}
/* TODO, 2x2 matrix */
@@ -859,7 +1063,7 @@ static PyObject *Matrix_to_3x3(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if ((self->col_size < 3) || (self->row_size < 3)) {
+ if ((self->num_row < 3) || (self->num_col < 3)) {
PyErr_SetString(PyExc_TypeError,
"Matrix.to_3x3(): inappropriate matrix size");
return NULL;
@@ -883,14 +1087,14 @@ static PyObject *Matrix_to_translation(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if ((self->col_size < 3) || self->row_size < 4) {
+ if ((self->num_row < 3) || self->num_col < 4) {
PyErr_SetString(PyExc_TypeError,
"Matrix.to_translation(): "
"inappropriate matrix size");
return NULL;
}
- return Vector_CreatePyObject(self->matrix[3], 3, Py_NEW, NULL);
+ return Vector_CreatePyObject(MATRIX_COL_PTR(self, 3), 3, Py_NEW, NULL);
}
PyDoc_STRVAR(Matrix_to_scale_doc,
@@ -912,8 +1116,8 @@ static PyObject *Matrix_to_scale(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- /*must be 3-4 cols, 3-4 rows, square matrix*/
- if ((self->col_size < 3) || (self->row_size < 3)) {
+ /*must be 3-4 cols, 3-4 rows, square matrix */
+ if ((self->num_row < 3) || (self->num_col < 3)) {
PyErr_SetString(PyExc_TypeError,
"Matrix.to_scale(): "
"inappropriate matrix size, 3x3 minimum size");
@@ -951,38 +1155,38 @@ static PyObject *Matrix_invert(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (self->row_size != self->col_size) {
+ if (self->num_col != self->num_row) {
PyErr_SetString(PyExc_TypeError,
"Matrix.invert(ed): "
"only square matrices are supported");
return NULL;
}
- /*calculate the determinant*/
+ /* calculate the determinant */
det = matrix_determinant_internal(self);
if (det != 0) {
- /*calculate the classical adjoint*/
- if (self->row_size == 2) {
- mat[0] = self->matrix[1][1];
- mat[1] = -self->matrix[0][1];
- mat[2] = -self->matrix[1][0];
- mat[3] = self->matrix[0][0];
+ /* calculate the classical adjoint */
+ if (self->num_col == 2) {
+ mat[0] = MATRIX_ITEM(self, 1, 1);
+ mat[1] = -MATRIX_ITEM(self, 0, 1);
+ mat[2] = -MATRIX_ITEM(self, 1, 0);
+ mat[3] = MATRIX_ITEM(self, 0, 0);
}
- else if (self->row_size == 3) {
- adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->contigPtr);
+ else if (self->num_col == 3) {
+ adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->matrix);
}
- else if (self->row_size == 4) {
- adjoint_m4_m4((float (*)[4]) mat, (float (*)[4])self->contigPtr);
+ else if (self->num_col == 4) {
+ adjoint_m4_m4((float (*)[4]) mat, (float (*)[4])self->matrix);
}
- /*divide by determinate*/
- for (x = 0; x < (self->row_size * self->col_size); x++) {
+ /* divide by determinate */
+ for (x = 0; x < (self->num_col * self->num_row); x++) {
mat[x] /= det;
}
- /*set values*/
- for (x = 0; x < self->row_size; x++) {
- for (y = 0; y < self->col_size; y++) {
- self->matrix[x][y] = mat[z];
+ /* set values */
+ for (x = 0; x < self->num_col; x++) {
+ for (y = 0; y < self->num_row; y++) {
+ MATRIX_ITEM(self, y, x) = mat[z];
z++;
}
}
@@ -1035,7 +1239,7 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
if (mathutils_any_to_rotmat(other_rmat, value, "matrix.rotate(value)") == -1)
return NULL;
- if (self->col_size != 3 || self->row_size != 3) {
+ if (self->num_row != 3 || self->num_col != 3) {
PyErr_SetString(PyExc_TypeError,
"Matrix.rotate(): "
"must have 3x3 dimensions");
@@ -1045,7 +1249,7 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
matrix_as_3x3(self_rmat, self);
mul_m3_m3m3(rmat, other_rmat, self_rmat);
- copy_m3_m3((float (*)[3])(self->contigPtr), rmat);
+ copy_m3_m3((float (*)[3])(self->matrix), rmat);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
@@ -1068,7 +1272,7 @@ static PyObject *Matrix_decompose(MatrixObject *self)
float quat[4];
float size[3];
- if (self->col_size != 4 || self->row_size != 4) {
+ if (self->num_row != 4 || self->num_col != 4) {
PyErr_SetString(PyExc_TypeError,
"Matrix.decompose(): "
"inappropriate matrix size - expects 4x4 matrix");
@@ -1078,10 +1282,10 @@ static PyObject *Matrix_decompose(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- mat4_to_loc_rot_size(loc, rot, size, (float (*)[4])self->contigPtr);
+ mat4_to_loc_rot_size(loc, rot, size, (float (*)[4])self->matrix);
mat3_to_quat(quat, rot);
- ret= PyTuple_New(3);
+ ret = PyTuple_New(3);
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(loc, 3, Py_NEW, NULL));
PyTuple_SET_ITEM(ret, 1, Quaternion_CreatePyObject(quat, Py_NEW, NULL));
PyTuple_SET_ITEM(ret, 2, Vector_CreatePyObject(size, 3, Py_NEW, NULL));
@@ -1106,12 +1310,12 @@ PyDoc_STRVAR(Matrix_lerp_doc,
static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
{
MatrixObject *mat2 = NULL;
- float fac, mat[MATRIX_MAX_DIM*MATRIX_MAX_DIM];
+ float fac, mat[MATRIX_MAX_DIM * MATRIX_MAX_DIM];
if (!PyArg_ParseTuple(args, "O!f:lerp", &matrix_Type, &mat2, &fac))
return NULL;
- if (self->row_size != mat2->row_size || self->col_size != mat2->col_size) {
+ if (self->num_col != mat2->num_col || self->num_row != mat2->num_row) {
PyErr_SetString(PyExc_ValueError,
"Matrix.lerp(): "
"expects both matrix objects of the same dimensions");
@@ -1122,11 +1326,11 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
return NULL;
/* TODO, different sized matrix */
- if (self->row_size==4 && self->col_size==4) {
- blend_m4_m4m4((float (*)[4])mat, (float (*)[4])self->contigPtr, (float (*)[4])mat2->contigPtr, fac);
+ if (self->num_col == 4 && self->num_row == 4) {
+ blend_m4_m4m4((float (*)[4])mat, (float (*)[4])self->matrix, (float (*)[4])mat2->matrix, fac);
}
- else if (self->row_size==3 && self->col_size==3) {
- blend_m3_m3m3((float (*)[3])mat, (float (*)[3])self->contigPtr, (float (*)[3])mat2->contigPtr, fac);
+ else if (self->num_col == 3 && self->num_row == 3) {
+ blend_m3_m3m3((float (*)[3])mat, (float (*)[3])self->matrix, (float (*)[3])mat2->matrix, fac);
}
else {
PyErr_SetString(PyExc_ValueError,
@@ -1135,7 +1339,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
return NULL;
}
- return Matrix_CreatePyObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
+ return Matrix_CreatePyObject(mat, self->num_col, self->num_row, Py_NEW, Py_TYPE(self));
}
/*---------------------------matrix.determinant() ----------------*/
@@ -1154,7 +1358,7 @@ static PyObject *Matrix_determinant(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (self->row_size != self->col_size) {
+ if (self->num_col != self->num_row) {
PyErr_SetString(PyExc_TypeError,
"Matrix.determinant(): "
"only square matrices are supported");
@@ -1173,28 +1377,26 @@ PyDoc_STRVAR(Matrix_transpose_doc,
);
static PyObject *Matrix_transpose(MatrixObject *self)
{
- float t = 0.0f;
-
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (self->row_size != self->col_size) {
+ if (self->num_col != self->num_row) {
PyErr_SetString(PyExc_TypeError,
"Matrix.transpose(d): "
"only square matrices are supported");
return NULL;
}
- if (self->row_size == 2) {
- t = self->matrix[1][0];
- self->matrix[1][0] = self->matrix[0][1];
- self->matrix[0][1] = t;
+ if (self->num_col == 2) {
+ const float t = MATRIX_ITEM(self, 1, 0);
+ MATRIX_ITEM(self, 1, 0) = MATRIX_ITEM(self, 0, 1);
+ MATRIX_ITEM(self, 0, 1) = t;
}
- else if (self->row_size == 3) {
- transpose_m3((float (*)[3])self->contigPtr);
+ else if (self->num_col == 3) {
+ transpose_m3((float (*)[3])self->matrix);
}
else {
- transpose_m4((float (*)[4])self->contigPtr);
+ transpose_m4((float (*)[4])self->matrix);
}
(void)BaseMath_WriteCallback(self);
@@ -1225,7 +1427,7 @@ PyDoc_STRVAR(Matrix_zero_doc,
);
static PyObject *Matrix_zero(MatrixObject *self)
{
- fill_vn_fl(self->contigPtr, self->row_size * self->col_size, 0.0f);
+ fill_vn_fl(self->matrix, self->num_col * self->num_row, 0.0f);
if (BaseMath_WriteCallback(self) == -1)
return NULL;
@@ -1248,24 +1450,24 @@ static PyObject *Matrix_identity(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (self->row_size != self->col_size) {
+ if (self->num_col != self->num_row) {
PyErr_SetString(PyExc_TypeError,
"Matrix.identity(): "
"only square matrices are supported");
return NULL;
}
- if (self->row_size == 2) {
- self->matrix[0][0] = 1.0f;
- self->matrix[0][1] = 0.0f;
- self->matrix[1][0] = 0.0f;
- self->matrix[1][1] = 1.0f;
+ if (self->num_col == 2) {
+ MATRIX_ITEM(self, 0, 0) = 1.0f;
+ MATRIX_ITEM(self, 0, 1) = 0.0f;
+ MATRIX_ITEM(self, 1, 0) = 0.0f;
+ MATRIX_ITEM(self, 1, 1) = 1.0f;
}
- else if (self->row_size == 3) {
- unit_m3((float (*)[3])self->contigPtr);
+ else if (self->num_col == 3) {
+ unit_m3((float (*)[3])self->matrix);
}
else {
- unit_m4((float (*)[4])self->contigPtr);
+ unit_m4((float (*)[4])self->matrix);
}
if (BaseMath_WriteCallback(self) == -1)
@@ -1288,26 +1490,26 @@ static PyObject *Matrix_copy(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- return Matrix_CreatePyObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
+ return Matrix_CreatePyObject((float (*))self->matrix, self->num_col, self->num_row, Py_NEW, Py_TYPE(self));
}
/*----------------------------print object (internal)-------------*/
-/*print the object to screen*/
+/* print the object to screen */
static PyObject *Matrix_repr(MatrixObject *self)
{
- int x, y;
- PyObject *rows[MATRIX_MAX_DIM]= {NULL};
+ int col, row;
+ PyObject *rows[MATRIX_MAX_DIM] = {NULL};
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- for (x = 0; x < self->row_size; x++) {
- rows[x]= PyTuple_New(self->col_size);
- for (y = 0; y < self->col_size; y++) {
- PyTuple_SET_ITEM(rows[x], y, PyFloat_FromDouble(self->matrix[x][y]));
+ 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->row_size) {
+ switch (self->num_row) {
case 2: return PyUnicode_FromFormat("Matrix((%R,\n"
" %R))", rows[0], rows[1]);
@@ -1325,21 +1527,57 @@ static PyObject *Matrix_repr(MatrixObject *self)
return NULL;
}
-static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op)
+static PyObject *Matrix_str(MatrixObject *self)
+{
+ DynStr *ds;
+
+ int maxsize[MATRIX_MAX_DIM];
+ int row, col;
+
+ char dummy_buf[1];
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ ds = BLI_dynstr_new();
+
+ /* First determine the maximum width for each column */
+ for (col = 0; col < self->num_col; col++) {
+ maxsize[col] = 0;
+ for (row = 0; row < self->num_row; row++) {
+ int size = BLI_snprintf(dummy_buf, sizeof(dummy_buf), "%.4f", MATRIX_ITEM(self, row, col));
+ maxsize[col] = MAX2(maxsize[col], size);
+ }
+ }
+
+ /* Now write the unicode string to be printed */
+ BLI_dynstr_appendf(ds, "<Matrix %dx%d (", self->num_row, self->num_col);
+ for (row = 0; row < self->num_row; row++) {
+ for (col = 0; col < self->num_col; col++) {
+ BLI_dynstr_appendf(ds, col ? ", %*.4f" : "%*.4f", maxsize[col], MATRIX_ITEM(self, row, col));
+ }
+ BLI_dynstr_append(ds, row + 1 != self->num_row ? ")\n " : ")");
+ }
+ BLI_dynstr_append(ds, ">");
+
+ return mathutils_dynstr_to_py(ds); /* frees ds */
+}
+
+static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
{
PyObject *res;
- int ok= -1; /* zero is true */
+ int ok = -1; /* zero is true */
if (MatrixObject_Check(a) && MatrixObject_Check(b)) {
- MatrixObject *matA= (MatrixObject*)a;
- MatrixObject *matB= (MatrixObject*)b;
+ MatrixObject *matA = (MatrixObject *)a;
+ MatrixObject *matB = (MatrixObject *)b;
if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1)
return NULL;
- ok= ( (matA->col_size == matB->col_size) &&
- (matA->row_size == matB->row_size) &&
- EXPP_VectorsAreEqual(matA->contigPtr, matB->contigPtr, (matA->row_size * matA->col_size), 1)
+ ok = ( (matA->num_row == matB->num_row) &&
+ (matA->num_col == matB->num_col) &&
+ EXPP_VectorsAreEqual(matA->matrix, matB->matrix, (matA->num_col * matA->num_row), 1)
) ? 0 : -1;
}
@@ -1366,51 +1604,96 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op)
/*---------------------SEQUENCE PROTOCOLS------------------------
----------------------------len(object)------------------------
- sequence length*/
+ sequence length */
static int Matrix_len(MatrixObject *self)
{
- return (self->row_size);
+ 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)
+ the wrapped vector gives direct access to the matrix data */
+static PyObject *Matrix_item_row(MatrixObject *self, int row)
+{
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ 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_col, mathutils_matrix_row_cb_index, row);
+}
+/* same but column access */
+static PyObject *Matrix_item_col(MatrixObject *self, int col)
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (i < 0 || i >= self->row_size) {
+ if (col < 0 || col >= self->num_col) {
PyErr_SetString(PyExc_IndexError,
"matrix[attribute]: "
"array index out of range");
return NULL;
}
- return Vector_CreatePyObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, i);
+ return Vector_CreatePyObject_cb((PyObject *)self, self->num_row, mathutils_matrix_col_cb_index, col);
}
+
/*----------------------------object[]-------------------------
sequence accessor (set) */
-static int Matrix_ass_item(MatrixObject *self, int i, PyObject *value)
+static int Matrix_ass_item_row(MatrixObject *self, int row, PyObject *value)
{
+ int col;
float vec[4];
if (BaseMath_ReadCallback(self) == -1)
return -1;
- if (i >= self->row_size || 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->col_size, self->col_size, 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(self->matrix[i], vec, self->col_size *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;
}
+static int Matrix_ass_item_col(MatrixObject *self, int col, PyObject *value)
+{
+ int row;
+ float vec[4];
+ if (BaseMath_ReadCallback(self) == -1)
+ return -1;
+
+ if (col >= self->num_col || col < 0) {
+ PyErr_SetString(PyExc_IndexError,
+ "matrix[attribute] = x: bad col");
+ return -1;
+ }
+
+ if (mathutils_array_parse(vec, self->num_row, self->num_row, value, "matrix[i] = value assignment") < 0) {
+ return -1;
+ }
+
+ /* Since we are assigning a row we cannot memcpy */
+ for (row = 0; row < self->num_row; row++) {
+ MATRIX_ITEM(self, row, col) = vec[row];
+ }
+
+ (void)BaseMath_WriteCallback(self);
+ return 0;
+}
+
/*----------------------------object[z:y]------------------------
sequence slice (get)*/
@@ -1423,14 +1706,14 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- CLAMP(begin, 0, self->row_size);
- CLAMP(end, 0, self->row_size);
- begin= MIN2(begin, end);
+ 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++) {
+ tuple = PyTuple_New(end - begin);
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin,
- Vector_CreatePyObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count));
+ Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_row_cb_index, count));
}
@@ -1440,24 +1723,25 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
sequence slice (set)*/
static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value)
{
- PyObject *value_fast= NULL;
+ PyObject *value_fast = NULL;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- CLAMP(begin, 0, self->row_size);
- CLAMP(end, 0, self->row_size);
+ CLAMP(begin, 0, self->num_row);
+ CLAMP(end, 0, self->num_row);
begin = MIN2(begin, end);
/* non list/tuple cases */
- if (!(value_fast=PySequence_Fast(value, "matrix[begin:end] = value"))) {
+ if (!(value_fast = PySequence_Fast(value, "matrix[begin:end] = value"))) {
/* PySequence_Fast sets the error */
return -1;
}
else {
- const int size= end - begin;
- int i;
+ const int size = end - begin;
+ int row, col;
float mat[16];
+ float vec[4];
if (PySequence_Fast_GET_SIZE(value_fast) != size) {
Py_DECREF(value_fast);
@@ -1467,22 +1751,28 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
return -1;
}
- /*parse sub items*/
- for (i = 0; i < size; i++) {
- /*parse each sub sequence*/
- PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i);
+ memcpy(mat, self->matrix, self->num_col * self->num_row * sizeof(float));
+
+ /* parse sub items */
+ for (row = begin; row < end; row++) {
+ /* parse each sub sequence */
+ PyObject *item = PySequence_Fast_GET_ITEM(value_fast, row - begin);
- if (mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item,
+ 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->contigPtr + (begin * self->col_size), mat, sizeof(float) * (size * self->col_size));
+ memcpy(self->matrix, mat, self->num_col * self->num_row * sizeof(float));
(void)BaseMath_WriteCallback(self);
return 0;
@@ -1495,8 +1785,8 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
float mat[16];
MatrixObject *mat1 = NULL, *mat2 = NULL;
- mat1 = (MatrixObject*)m1;
- mat2 = (MatrixObject*)m2;
+ mat1 = (MatrixObject *)m1;
+ mat2 = (MatrixObject *)m2;
if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
PyErr_Format(PyExc_TypeError,
@@ -1509,16 +1799,16 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1)
return NULL;
- if (mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size) {
+ if (mat1->num_col != mat2->num_col || mat1->num_row != mat2->num_row) {
PyErr_SetString(PyExc_TypeError,
"Matrix addition: "
"matrices must have the same dimensions for this operation");
return NULL;
}
- add_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size);
+ add_vn_vnvn(mat, mat1->matrix, mat2->matrix, mat1->num_col * mat1->num_row);
- return Matrix_CreatePyObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
+ return Matrix_CreatePyObject(mat, mat1->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1));
}
/*------------------------obj - obj------------------------------
subtraction*/
@@ -1527,8 +1817,8 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
float mat[16];
MatrixObject *mat1 = NULL, *mat2 = NULL;
- mat1 = (MatrixObject*)m1;
- mat2 = (MatrixObject*)m2;
+ mat1 = (MatrixObject *)m1;
+ mat2 = (MatrixObject *)m2;
if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
PyErr_Format(PyExc_TypeError,
@@ -1542,74 +1832,82 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
if (BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1)
return NULL;
- if (mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size) {
+ if (mat1->num_col != mat2->num_col || mat1->num_row != mat2->num_row) {
PyErr_SetString(PyExc_TypeError,
"Matrix addition: "
"matrices must have the same dimensions for this operation");
return NULL;
}
- sub_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size);
+ sub_vn_vnvn(mat, mat1->matrix, mat2->matrix, mat1->num_col * mat1->num_row);
- return Matrix_CreatePyObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
+ return Matrix_CreatePyObject(mat, mat1->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1));
}
/*------------------------obj * obj------------------------------
mulplication*/
static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
{
float tmat[16];
- mul_vn_vn_fl(tmat, mat->contigPtr, mat->row_size * mat->col_size, scalar);
- return Matrix_CreatePyObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat));
+ mul_vn_vn_fl(tmat, mat->matrix, mat->num_col * mat->num_row, scalar);
+ return Matrix_CreatePyObject(tmat, mat->num_col, mat->num_row, Py_NEW, Py_TYPE(mat));
}
static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
{
float scalar;
+ int vec_size;
MatrixObject *mat1 = NULL, *mat2 = NULL;
if (MatrixObject_Check(m1)) {
- mat1 = (MatrixObject*)m1;
+ mat1 = (MatrixObject *)m1;
if (BaseMath_ReadCallback(mat1) == -1)
return NULL;
}
if (MatrixObject_Check(m2)) {
- mat2 = (MatrixObject*)m2;
+ mat2 = (MatrixObject *)m2;
if (BaseMath_ReadCallback(mat2) == -1)
return NULL;
}
if (mat1 && mat2) {
- /*MATRIX * MATRIX*/
- float mat[16]= {0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f};
- double dot = 0.0f;
- int x, y, z;
-
- for (x = 0; x < mat2->row_size; x++) {
- for (y = 0; y < mat1->col_size; y++) {
- for (z = 0; z < mat1->row_size; z++) {
- dot += (mat1->matrix[z][y] * mat2->matrix[x][z]);
+ /* MATRIX * MATRIX */
+ float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.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++) {
+ double dot = 0.0f;
+ for (item = 0; item < mat1->num_col; item++) {
+ dot += MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col);
}
- mat[((x * mat1->col_size) + y)] = (float)dot;
- dot = 0.0f;
+ mat[(col * mat1->num_row) + row] = (float)dot;
}
}
- return Matrix_CreatePyObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
+ return Matrix_CreatePyObject(mat, mat2->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1));
}
else if (mat2) {
/*FLOAT/INT * MATRIX */
- if (((scalar= PyFloat_AsDouble(m1)) == -1.0f && PyErr_Occurred())==0) {
+ if (((scalar = PyFloat_AsDouble(m1)) == -1.0f && PyErr_Occurred()) == 0) {
return matrix_mul_float(mat2, scalar);
}
}
else if (mat1) {
- /*VEC * MATRIX */
+ /* MATRIX * VECTOR */
if (VectorObject_Check(m2)) {
- VectorObject *vec2= (VectorObject *)m2;
+ VectorObject *vec2 = (VectorObject *)m2;
float tvec[4];
if (BaseMath_ReadCallback(vec2) == -1)
return NULL;
@@ -1617,10 +1915,17 @@ 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) {
+ else if (((scalar = PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred()) == 0) {
return matrix_mul_float(mat1, scalar);
}
}
@@ -1634,7 +1939,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name);
return NULL;
}
-static PyObject* Matrix_inv(MatrixObject *self)
+static PyObject *Matrix_inv(MatrixObject *self)
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -1647,9 +1952,9 @@ static PySequenceMethods Matrix_SeqMethods = {
(lenfunc) Matrix_len, /* sq_length */
(binaryfunc) NULL, /* sq_concat */
(ssizeargfunc) NULL, /* sq_repeat */
- (ssizeargfunc) Matrix_item, /* sq_item */
+ (ssizeargfunc) Matrix_item_row, /* sq_item */
(ssizessizeargfunc) NULL, /* sq_slice, deprecated */
- (ssizeobjargproc) Matrix_ass_item, /* sq_ass_item */
+ (ssizeobjargproc) Matrix_ass_item_row, /* sq_ass_item */
(ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
(objobjproc) NULL, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
@@ -1657,7 +1962,7 @@ static PySequenceMethods Matrix_SeqMethods = {
};
-static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item)
+static PyObject *Matrix_subscript(MatrixObject *self, PyObject *item)
{
if (PyIndex_Check(item)) {
Py_ssize_t i;
@@ -1665,13 +1970,13 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item)
if (i == -1 && PyErr_Occurred())
return NULL;
if (i < 0)
- i += self->row_size;
- return Matrix_item(self, i);
+ i += self->num_row;
+ return Matrix_item_row(self, i);
}
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->row_size, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -1694,20 +1999,20 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item)
}
}
-static int Matrix_ass_subscript(MatrixObject* self, PyObject* item, PyObject* value)
+static int Matrix_ass_subscript(MatrixObject *self, PyObject *item, PyObject *value)
{
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return -1;
if (i < 0)
- i += self->row_size;
- return Matrix_ass_item(self, i, value);
+ i += self->num_row;
+ return Matrix_ass_item_row(self, i, value);
}
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->row_size, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
@@ -1770,16 +2075,90 @@ static PyNumberMethods Matrix_NumMethods = {
NULL, /* nb_index */
};
-static PyObject *Matrix_getRowSize(MatrixObject *self, void *UNUSED(closure))
+PyDoc_STRVAR(Matrix_row_size_doc,
+"The row size of the matrix (readonly).\n\n:type: int"
+);
+static PyObject *Matrix_row_size_get(MatrixObject *self, void *UNUSED(closure))
+{
+ return PyLong_FromLong((long) self->num_col);
+}
+
+PyDoc_STRVAR(Matrix_col_size_doc,
+"The column size of the matrix (readonly).\n\n:type: int"
+);
+static PyObject *Matrix_col_size_get(MatrixObject *self, void *UNUSED(closure))
{
- return PyLong_FromLong((long) self->row_size);
+ return PyLong_FromLong((long) self->num_row);
}
-static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure))
+PyDoc_STRVAR(Matrix_translation_doc,
+"The translation component of the matrix.\n\n:type: Vector"
+);
+static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure))
{
- return PyLong_FromLong((long) self->col_size);
+ 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_translation_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;
+}
+
+PyDoc_STRVAR(Matrix_row_doc,
+"Access the matix by rows (default), (readonly).\n\n:type: Matrix Access"
+);
+static PyObject *Matrix_row_get(MatrixObject *self, void *UNUSED(closure))
+{
+ return MatrixAccess_CreatePyObject(self, MAT_ACCESS_ROW);
+}
+
+PyDoc_STRVAR(Matrix_col_doc,
+"Access the matix by colums, 3x3 and 4x4 only, (readonly).\n\n:type: Matrix Access"
+);
+static PyObject *Matrix_col_get(MatrixObject *self, void *UNUSED(closure))
+{
+ return MatrixAccess_CreatePyObject(self, MAT_ACCESS_COL);
+}
+
+PyDoc_STRVAR(Matrix_median_scale_doc,
+"The average scale applied to each axis (readonly).\n\n:type: float"
+);
static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure))
{
float mat[3][3];
@@ -1788,7 +2167,7 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur
return NULL;
/*must be 3-4 cols, 3-4 rows, square matrix*/
- if ((self->col_size < 3) || (self->row_size < 3)) {
+ if ((self->num_row < 3) || (self->num_col < 3)) {
PyErr_SetString(PyExc_AttributeError,
"Matrix.median_scale: "
"inappropriate matrix size, 3x3 minimum");
@@ -1800,16 +2179,19 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur
return PyFloat_FromDouble(mat3_to_scale(mat));
}
+PyDoc_STRVAR(Matrix_is_negative_doc,
+"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool"
+);
static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure))
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
/*must be 3-4 cols, 3-4 rows, square matrix*/
- if (self->col_size == 4 && self->row_size == 4)
- return PyBool_FromLong(is_negative_m4((float (*)[4])self->contigPtr));
- else if (self->col_size == 3 && self->row_size == 3)
- return PyBool_FromLong(is_negative_m3((float (*)[3])self->contigPtr));
+ if (self->num_row == 4 && self->num_col == 4)
+ return PyBool_FromLong(is_negative_m4((float (*)[4])self->matrix));
+ else if (self->num_row == 3 && self->num_col == 3)
+ return PyBool_FromLong(is_negative_m3((float (*)[3])self->matrix));
else {
PyErr_SetString(PyExc_AttributeError,
"Matrix.is_negative: "
@@ -1818,16 +2200,19 @@ static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure
}
}
+PyDoc_STRVAR(Matrix_is_orthogonal_doc,
+"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool"
+);
static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure))
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
/*must be 3-4 cols, 3-4 rows, square matrix*/
- if (self->col_size == 4 && self->row_size == 4)
- return PyBool_FromLong(is_orthogonal_m4((float (*)[4])self->contigPtr));
- else if (self->col_size == 3 && self->row_size == 3)
- return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->contigPtr));
+ if (self->num_row == 4 && self->num_col == 4)
+ return PyBool_FromLong(is_orthogonal_m4((float (*)[4])self->matrix));
+ else if (self->num_row == 3 && self->num_col == 3)
+ return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->matrix));
else {
PyErr_SetString(PyExc_AttributeError,
"Matrix.is_orthogonal: "
@@ -1840,13 +2225,16 @@ static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closu
/* Python attributes get/set structure: */
/*****************************************************************************/
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 *)"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},
- {(char *)"owner",(getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
+ {(char *)"row_size", (getter)Matrix_row_size_get, (setter)NULL, Matrix_row_size_doc, NULL},
+ {(char *)"col_size", (getter)Matrix_col_size_get, (setter)NULL, Matrix_col_size_doc, NULL},
+ {(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, Matrix_median_scale_doc, NULL},
+ {(char *)"translation", (getter)Matrix_translation_get, (setter)Matrix_translation_set, Matrix_translation_doc, NULL},
+ {(char *)"row", (getter)Matrix_row_get, (setter)NULL, Matrix_row_doc, NULL},
+ {(char *)"col", (getter)Matrix_col_get, (setter)NULL, Matrix_col_doc, NULL},
+ {(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, Matrix_is_negative_doc, NULL},
+ {(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, Matrix_is_orthogonal_doc, NULL},
+ {(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
+ {(char *)"owner",(getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -1911,7 +2299,7 @@ PyTypeObject matrix_Type = {
&Matrix_AsMapping, /*tp_as_mapping*/
NULL, /*tp_hash*/
NULL, /*tp_call*/
- NULL, /*tp_str*/
+ (reprfunc) Matrix_str, /*tp_str*/
NULL, /*tp_getattro*/
NULL, /*tp_setattro*/
NULL, /*tp_as_buffer*/
@@ -1944,80 +2332,60 @@ PyTypeObject matrix_Type = {
NULL /*tp_del*/
};
-/*------------------------Matrix_CreatePyObject (internal)-------------
-creates a new matrix object
-self->matrix self->contiguous_ptr (reference to data.xxx)
- [0]------------->[0]
- [1]
- [2]
- [1]------------->[3]
- [4]
- [5]
-
-self->matrix[1][1] = self->contigPtr[4] */
-
-/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
- (i.e. it was allocated elsewhere by MEM_mallocN())
- pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
- (i.e. it must be created here with PyMEM_malloc())*/
+/* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
+ * (i.e. it was allocated elsewhere by MEM_mallocN())
+ * pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
+ * (i.e. it must be created here with PyMEM_malloc()) */
PyObject *Matrix_CreatePyObject(float *mat,
- const unsigned short rowSize, const unsigned short colSize,
+ const unsigned short num_col, const unsigned short num_row,
int type, PyTypeObject *base_type)
{
MatrixObject *self;
- int x, row, col;
- /*matrix objects can be any 2-4row x 2-4col matrix*/
- if (rowSize < 2 || rowSize > 4 || colSize < 2 || colSize > 4) {
+ /* matrix objects can be any 2-4row x 2-4col matrix */
+ if (num_col < 2 || num_col > 4 || num_row < 2 || num_row > 4) {
PyErr_SetString(PyExc_RuntimeError,
"Matrix(): "
"row and column sizes must be between 2 and 4");
return NULL;
}
- self= base_type ? (MatrixObject *)base_type->tp_alloc(base_type, 0) :
- (MatrixObject *)PyObject_GC_New(MatrixObject, &matrix_Type);
+ self = base_type ? (MatrixObject *)base_type->tp_alloc(base_type, 0) :
+ (MatrixObject *)PyObject_GC_New(MatrixObject, &matrix_Type);
if (self) {
- self->row_size = rowSize;
- self->col_size = colSize;
+ self->num_col = num_col;
+ self->num_row = num_row;
/* init callbacks as NULL */
- self->cb_user= NULL;
- self->cb_type= self->cb_subtype= 0;
+ self->cb_user = NULL;
+ self->cb_type = self->cb_subtype = 0;
if (type == Py_WRAP) {
- self->contigPtr = mat;
- /*pointer array points to contigous memory*/
- for (x = 0; x < rowSize; x++) {
- self->matrix[x] = self->contigPtr + (x * colSize);
- }
+ self->matrix = mat;
self->wrapped = Py_WRAP;
}
else if (type == Py_NEW) {
- self->contigPtr = PyMem_Malloc(rowSize * colSize * sizeof(float));
- if (self->contigPtr == NULL) { /*allocation failure*/
+ self->matrix = PyMem_Malloc(num_col * num_row * sizeof(float));
+ if (self->matrix == NULL) { /*allocation failure*/
PyErr_SetString(PyExc_MemoryError,
"Matrix(): "
"problem allocating pointer space");
return NULL;
}
- /*pointer array points to contigous memory*/
- for (x = 0; x < rowSize; x++) {
- self->matrix[x] = self->contigPtr + (x * colSize);
- }
- /*parse*/
+
if (mat) { /*if a float array passed*/
- for (row = 0; row < rowSize; row++) {
- for (col = 0; col < colSize; col++) {
- self->matrix[row][col] = mat[(row * colSize) + col];
- }
- }
+ memcpy(self->matrix, mat, num_col * num_row * sizeof(float));
}
- else if (rowSize == colSize) { /*or if no arguments are passed return identity matrix for square matrices */
- PyObject *ret_dummy= Matrix_identity(self);
+ else if (num_col == num_row) {
+ /* or if no arguments are passed return identity matrix for square matrices */
+ PyObject *ret_dummy = Matrix_identity(self);
Py_DECREF(ret_dummy);
}
+ else {
+ /* otherwise zero everything */
+ memset(self->matrix, 0, num_col * num_row * sizeof(float));
+ }
self->wrapped = Py_NEW;
}
else {
@@ -2028,15 +2396,166 @@ PyObject *Matrix_CreatePyObject(float *mat,
return (PyObject *) self;
}
-PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype)
+PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user,
+ const unsigned short num_col, const unsigned short num_row,
+ int cb_type, int cb_subtype)
{
- MatrixObject *self= (MatrixObject *)Matrix_CreatePyObject(NULL, rowSize, colSize, Py_NEW, NULL);
+ MatrixObject *self = (MatrixObject *)Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user= cb_user;
- self->cb_type= (unsigned char)cb_type;
- self->cb_subtype= (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = (unsigned char)cb_type;
+ self->cb_subtype = (unsigned char)cb_subtype;
PyObject_GC_Track(self);
}
return (PyObject *) self;
}
+
+
+/* ----------------------------------------------------------------------------
+ * special type for alaternate access */
+
+typedef struct {
+ PyObject_HEAD /* required python macro */
+ MatrixObject *matrix_user;
+ eMatrixAccess_t type;
+} MatrixAccessObject;
+
+static int MatrixAccess_traverse(MatrixAccessObject *self, visitproc visit, void *arg)
+{
+ Py_VISIT(self->matrix_user);
+ return 0;
+}
+
+int MatrixAccess_clear(MatrixAccessObject *self)
+{
+ Py_CLEAR(self->matrix_user);
+ return 0;
+}
+
+void MatrixAccess_dealloc(MatrixAccessObject *self)
+{
+ if (self->matrix_user) {
+ PyObject_GC_UnTrack(self);
+ MatrixAccess_clear(self);
+ }
+
+ Py_TYPE(self)->tp_free(self);
+}
+
+/* sequence access */
+
+static int MatrixAccess_len(MatrixAccessObject *self)
+{
+ return (self->type == MAT_ACCESS_ROW) ?
+ self->matrix_user->num_row :
+ self->matrix_user->num_col;
+}
+
+static PyObject *MatrixAccess_subscript(MatrixAccessObject *self, PyObject *item)
+{
+ MatrixObject *matrix_user = self->matrix_user;
+
+ if (PyIndex_Check(item)) {
+ Py_ssize_t i;
+ i = PyNumber_AsSsize_t(item, PyExc_IndexError);
+ if (i == -1 && PyErr_Occurred())
+ return NULL;
+ if (self->type == MAT_ACCESS_ROW) {
+ if (i < 0)
+ i += matrix_user->num_row;
+ return Matrix_item_row(matrix_user, i);
+ }
+ else { /* MAT_ACCESS_ROW */
+ if (i < 0)
+ i += matrix_user->num_col;
+ return Matrix_item_col(matrix_user, i);
+ }
+ }
+ /* TODO, slice */
+ else {
+ PyErr_Format(PyExc_TypeError,
+ "matrix indices must be integers, not %.200s",
+ Py_TYPE(item)->tp_name);
+ return NULL;
+ }
+}
+
+static int MatrixAccess_ass_subscript(MatrixAccessObject *self, PyObject *item, PyObject *value)
+{
+ MatrixObject *matrix_user = self->matrix_user;
+
+ if (PyIndex_Check(item)) {
+ Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
+ if (i == -1 && PyErr_Occurred())
+ return -1;
+
+ if (self->type == MAT_ACCESS_ROW) {
+ if (i < 0)
+ i += matrix_user->num_row;
+ return Matrix_ass_item_row(matrix_user, i, value);
+ }
+ else { /* MAT_ACCESS_ROW */
+ if (i < 0)
+ i += matrix_user->num_col;
+ return Matrix_ass_item_col(matrix_user, i, value);
+ }
+
+ }
+ /* TODO, slice */
+ else {
+ PyErr_Format(PyExc_TypeError,
+ "matrix indices must be integers, not %.200s",
+ Py_TYPE(item)->tp_name);
+ return -1;
+ }
+}
+
+
+static PyMappingMethods MatrixAccess_AsMapping = {
+ (lenfunc)MatrixAccess_len,
+ (binaryfunc)MatrixAccess_subscript,
+ (objobjargproc) MatrixAccess_ass_subscript
+};
+
+PyTypeObject matrix_access_Type = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "MatrixAccess", /*tp_name*/
+ sizeof(MatrixAccessObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ (destructor)MatrixAccess_dealloc, /*tp_dealloc*/
+ NULL, /*tp_print*/
+ NULL, /*tp_getattr*/
+ NULL, /*tp_setattr*/
+ NULL, /*tp_compare*/
+ NULL, /*tp_repr*/
+ NULL, /*tp_as_number*/
+ NULL /*&MatrixAccess_SeqMethods*/ /* TODO */, /*tp_as_sequence*/
+ &MatrixAccess_AsMapping, /*tp_as_mapping*/
+ NULL, /*tp_hash*/
+ NULL, /*tp_call*/
+ NULL, /*tp_str*/
+ NULL, /*tp_getattro*/
+ NULL, /*tp_setattro*/
+ NULL, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ NULL, /*tp_doc*/
+ (traverseproc)MatrixAccess_traverse, //tp_traverse
+ (inquiry)MatrixAccess_clear, //tp_clear
+ NULL /* (richcmpfunc)MatrixAccess_richcmpr */ /* TODO*/, /*tp_richcompare*/
+};
+
+static PyObject *MatrixAccess_CreatePyObject(MatrixObject *matrix, const eMatrixAccess_t type)
+{
+ MatrixAccessObject *matrix_access = (MatrixAccessObject *)PyObject_GC_New(MatrixObject, &matrix_access_Type);
+
+ matrix_access->matrix_user = matrix;
+ Py_INCREF(matrix);
+
+ matrix_access->type = type;
+
+ return (PyObject *)matrix_access;
+}
+
+/* end special access
+ * -------------------------------------------------------------------------- */
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index 6dfcbb1faf9..2ecbc55da35 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -35,29 +35,51 @@
#define MATHUTILS_MATRIX_H
extern PyTypeObject matrix_Type;
+extern PyTypeObject matrix_access_Type;
#define MatrixObject_Check(_v) PyObject_TypeCheck((_v), &matrix_Type)
#define MATRIX_MAX_DIM 4
+/* matrix[row][col] == MATRIX_ITEM_INDEX(matrix, row, col) */
+
+#ifdef DEBUG
+# define MATRIX_ITEM_ASSERT(_mat, _row, _col) (BLI_assert(_row < (_mat)->num_row && _col < (_mat)->num_col))
+#else
+# define MATRIX_ITEM_ASSERT(_mat, _row, _col) (void)0
+#endif
+
+#define MATRIX_ITEM_INDEX(_mat, _row, _col) (MATRIX_ITEM_ASSERT(_mat, _row, _col),(((_mat)->num_row * (_col)) + (_row)))
+#define MATRIX_ITEM_PTR( _mat, _row, _col) ((_mat)->matrix + MATRIX_ITEM_INDEX(_mat, _row, _col))
+#define MATRIX_ITEM( _mat, _row, _col) ((_mat)->matrix [MATRIX_ITEM_INDEX(_mat, _row, _col)])
+
+#define MATRIX_COL_INDEX(_mat, _col) (MATRIX_ITEM_INDEX(_mat, 0, _col))
+#define MATRIX_COL_PTR( _mat, _col) ((_mat)->matrix + MATRIX_COL_INDEX(_mat, _col))
+
typedef struct {
- BASE_MATH_MEMBERS(contigPtr);
- float *matrix[MATRIX_MAX_DIM]; /* ptr to the contigPtr (accessor) */
- unsigned short row_size;
- unsigned short col_size;
+ BASE_MATH_MEMBERS(matrix);
+ unsigned short num_col;
+ unsigned short num_row;
} MatrixObject;
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-be stored in py_data) or be a wrapper for data allocated through
-blender (stored in blend_data). This is an either/or struct not both*/
+/* struct data contains a pointer to the actual data that the
+ * object uses. It can use either PyMem allocated data (which will
+ * be stored in py_data) or be a wrapper for data allocated through
+ * blender (stored in blend_data). This is an either/or struct not both */
-/*prototypes*/
+/* prototypes */
PyObject *Matrix_CreatePyObject(float *mat,
- const unsigned short row_size, const unsigned short col_size,
+ const unsigned short num_col, const unsigned short num_row,
int type, PyTypeObject *base_type);
-PyObject *Matrix_CreatePyObject_cb(PyObject *user, int row_size, int col_size, int cb_type, int cb_subtype);
+PyObject *Matrix_CreatePyObject_cb(PyObject *user,
+ const unsigned short num_col, const unsigned short num_row,
+ int cb_type, int cb_subtype);
+
+extern int mathutils_matrix_row_cb_index; /* default */
+extern int mathutils_matrix_col_cb_index;
+extern int mathutils_matrix_translation_cb_index;
-extern int mathutils_matrix_vector_cb_index;
-extern struct Mathutils_Callback mathutils_matrix_vector_cb;
+extern struct Mathutils_Callback mathutils_matrix_row_cb; /* default */
+extern struct Mathutils_Callback mathutils_matrix_col_cb;
+extern struct Mathutils_Callback mathutils_matrix_translation_cb;
void matrix_as_3x3(float mat[3][3], MatrixObject *self);
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index cf817003a98..20e951800c2 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -35,6 +35,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_dynstr.h"
#define QUAT_SIZE 4
@@ -50,15 +51,15 @@ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
PyObject *ret;
int i;
- ret= PyTuple_New(QUAT_SIZE);
+ ret = PyTuple_New(QUAT_SIZE);
if (ndigits >= 0) {
- for (i= 0; i < QUAT_SIZE; i++) {
+ for (i = 0; i < QUAT_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->quat[i], ndigits)));
}
}
else {
- for (i= 0; i < QUAT_SIZE; i++) {
+ for (i = 0; i < QUAT_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->quat[i]));
}
}
@@ -85,8 +86,8 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
{
float tquat[4];
float eul[3];
- const char *order_str= NULL;
- short order= EULER_ORDER_XYZ;
+ const char *order_str = NULL;
+ short order = EULER_ORDER_XYZ;
EulerObject *eul_compat = NULL;
if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat))
@@ -96,7 +97,7 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
return NULL;
if (order_str) {
- order= euler_order_from_string(order_str, "Matrix.to_euler()");
+ order = euler_order_from_string(order_str, "Matrix.to_euler()");
if (order == -1)
return NULL;
@@ -168,7 +169,7 @@ static PyObject *Quaternion_to_axis_angle(QuaternionObject *self)
quat__axis_angle_sanitize(axis, &angle);
- ret= PyTuple_New(2);
+ ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(axis, 3, Py_NEW, NULL));
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(angle));
return ret;
@@ -193,8 +194,10 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.cross(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value,
+ "Quaternion.cross(other), invalid 'other' arg") == -1) {
return NULL;
+ }
mul_qt_qtqt(quat, self->quat, tquat);
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
@@ -319,7 +322,7 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
if (mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1)
return NULL;
- length= normalize_qt_qt(tquat, self->quat);
+ length = normalize_qt_qt(tquat, self->quat);
quat_to_mat3(self_rmat, tquat);
mul_m3_m3m3(rmat, other_rmat, self_rmat);
@@ -485,27 +488,42 @@ static PyObject *Quaternion_repr(QuaternionObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- tuple= Quaternion_to_tuple_ext(self, -1);
+ tuple = Quaternion_to_tuple_ext(self, -1);
- ret= PyUnicode_FromFormat("Quaternion(%R)", tuple);
+ ret = PyUnicode_FromFormat("Quaternion(%R)", tuple);
Py_DECREF(tuple);
return ret;
}
-static PyObject* Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
+static PyObject *Quaternion_str(QuaternionObject *self)
+{
+ DynStr *ds;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ ds = BLI_dynstr_new();
+
+ BLI_dynstr_appendf(ds, "<Quaternion (w=%.4f, x=%.4f, y=%.4f, z=%.4f)>",
+ self->quat[0], self->quat[1], self->quat[2], self->quat[3]);
+
+ return mathutils_dynstr_to_py(ds); /* frees ds */
+}
+
+static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
{
PyObject *res;
- int ok= -1; /* zero is true */
+ int ok = -1; /* zero is true */
if (QuaternionObject_Check(a) && QuaternionObject_Check(b)) {
- QuaternionObject *quatA= (QuaternionObject *)a;
- QuaternionObject *quatB= (QuaternionObject *)b;
+ QuaternionObject *quatA = (QuaternionObject *)a;
+ QuaternionObject *quatB = (QuaternionObject *)b;
if (BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1)
return NULL;
- ok= (EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1)) ? 0 : -1;
+ ok = (EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1)) ? 0 : -1;
}
switch (op) {
@@ -540,7 +558,7 @@ static int Quaternion_len(QuaternionObject *UNUSED(self))
//sequence accessor (get)
static PyObject *Quaternion_item(QuaternionObject *self, int i)
{
- if (i<0) i= QUAT_SIZE-i;
+ if (i < 0) i = QUAT_SIZE-i;
if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
@@ -559,15 +577,15 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i)
//sequence accessor (set)
static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
{
- float scalar= (float)PyFloat_AsDouble(ob);
- if (scalar==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
+ float scalar = (float)PyFloat_AsDouble(ob);
+ if (scalar == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError,
"quaternion[index] = x: "
"index argument not a number");
return -1;
}
- if (i<0) i= QUAT_SIZE-i;
+ if (i < 0) i = QUAT_SIZE-i;
if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
@@ -593,12 +611,12 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end)
return NULL;
CLAMP(begin, 0, QUAT_SIZE);
- if (end<0) end= (QUAT_SIZE + 1) + end;
+ if (end < 0) end = (QUAT_SIZE + 1) + end;
CLAMP(end, 0, QUAT_SIZE);
- begin= MIN2(begin, end);
+ begin = MIN2(begin, end);
- tuple= PyTuple_New(end - begin);
- for (count= begin; count < end; count++) {
+ tuple = PyTuple_New(end - begin);
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->quat[count]));
}
@@ -615,11 +633,11 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
return -1;
CLAMP(begin, 0, QUAT_SIZE);
- if (end<0) end= (QUAT_SIZE + 1) + end;
+ if (end < 0) end = (QUAT_SIZE + 1) + end;
CLAMP(end, 0, QUAT_SIZE);
begin = MIN2(begin, end);
- if ((size=mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1)
+ if ((size = mathutils_array_parse(quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1)
return -1;
if (size != (end - begin)) {
@@ -630,7 +648,7 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
}
/* parsed well - now set in vector */
- for (i= 0; i < size; i++)
+ for (i = 0; i < size; i++)
self->quat[begin + i] = quat[i];
(void)BaseMath_WriteCallback(self);
@@ -793,7 +811,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
}
/* the only case this can happen (for a supported type is "FLOAT*QUAT") */
else if (quat2) { /* FLOAT*QUAT */
- if (((scalar= PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred())==0) {
+ if (((scalar = PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred()) == 0) {
return quat_mul_float(quat2, scalar);
}
}
@@ -820,7 +838,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(vec2));
}
/* QUAT * FLOAT */
- else if ((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) {
+ else if ((((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) {
return quat_mul_float(quat1, scalar);
}
}
@@ -906,17 +924,23 @@ static PyNumberMethods Quaternion_NumMethods = {
NULL, /* nb_index */
};
-static PyObject *Quaternion_getAxis(QuaternionObject *self, void *type)
+PyDoc_STRVAR(Quaternion_axis_doc,
+"Quaternion axis value.\n\n:type: float"
+);
+static PyObject *Quaternion_axis_get(QuaternionObject *self, void *type)
{
return Quaternion_item(self, GET_INT_FROM_POINTER(type));
}
-static int Quaternion_setAxis(QuaternionObject *self, PyObject *value, void *type)
+static int Quaternion_axis_set(QuaternionObject *self, PyObject *value, void *type)
{
return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
-static PyObject *Quaternion_getMagnitude(QuaternionObject *self, void *UNUSED(closure))
+PyDoc_STRVAR(Quaternion_magnitude_doc,
+"Size of the quaternion (readonly).\n\n:type: float"
+);
+static PyObject *Quaternion_magnitude_get(QuaternionObject *self, void *UNUSED(closure))
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -924,7 +948,10 @@ static PyObject *Quaternion_getMagnitude(QuaternionObject *self, void *UNUSED(cl
return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat)));
}
-static PyObject *Quaternion_getAngle(QuaternionObject *self, void *UNUSED(closure))
+PyDoc_STRVAR(Quaternion_angle_doc,
+"Angle of the quaternion.\n\n:type: float"
+);
+static PyObject *Quaternion_angle_get(QuaternionObject *self, void *UNUSED(closure))
{
float tquat[4];
float angle;
@@ -934,14 +961,14 @@ static PyObject *Quaternion_getAngle(QuaternionObject *self, void *UNUSED(closur
normalize_qt_qt(tquat, self->quat);
- angle= 2.0f * saacos(tquat[0]);
+ angle = 2.0f * saacos(tquat[0]);
quat__axis_angle_sanitize(NULL, &angle);
return PyFloat_FromDouble(angle);
}
-static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
+static int Quaternion_angle_set(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
{
float tquat[4];
float len;
@@ -952,18 +979,18 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
if (BaseMath_ReadCallback(self) == -1)
return -1;
- len= normalize_qt_qt(tquat, self->quat);
+ len = normalize_qt_qt(tquat, self->quat);
quat_to_axis_angle(axis, &angle_dummy, tquat);
- angle= PyFloat_AsDouble(value);
+ angle = PyFloat_AsDouble(value);
- if (angle==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
+ if (angle == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError,
"Quaternion.angle = value: float expected");
return -1;
}
- angle= angle_wrap_rad(angle);
+ angle = angle_wrap_rad(angle);
quat__axis_angle_sanitize(axis, &angle);
@@ -976,7 +1003,10 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
return 0;
}
-static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(closure))
+PyDoc_STRVAR(Quaternion_axis_vector_doc,
+"Quaternion axis as a vector.\n\n:type: :class:`Vector`"
+);
+static PyObject *Quaternion_axis_vector_get(QuaternionObject *self, void *UNUSED(closure))
{
float tquat[4];
@@ -994,7 +1024,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos
return Vector_CreatePyObject(axis, 3, Py_NEW, NULL);
}
-static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
+static int Quaternion_axis_vector_set(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
{
float tquat[4];
float len;
@@ -1005,7 +1035,7 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *
if (BaseMath_ReadCallback(self) == -1)
return -1;
- len= normalize_qt_qt(tquat, self->quat);
+ len = normalize_qt_qt(tquat, self->quat);
quat_to_axis_angle(axis, &angle, tquat); /* axis value is unused */
if (mathutils_array_parse(axis, 3, 3, value, "quat.axis = other") == -1)
@@ -1025,9 +1055,9 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *
//----------------------------------mathutils.Quaternion() --------------
static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- PyObject *seq= NULL;
+ PyObject *seq = NULL;
double angle = 0.0f;
- float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f};
+ float quat[QUAT_SIZE] = {0.0f, 0.0f, 0.0f, 0.0f};
if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
@@ -1039,7 +1069,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
if (!PyArg_ParseTuple(args, "|Od:mathutils.Quaternion", &seq, &angle))
return NULL;
- switch(PyTuple_GET_SIZE(args)) {
+ switch (PyTuple_GET_SIZE(args)) {
case 0:
break;
case 1:
@@ -1049,7 +1079,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
case 2:
if (mathutils_array_parse(quat, 3, 3, seq, "mathutils.Quaternion()") == -1)
return NULL;
- angle= angle_wrap_rad(angle); /* clamp because of precision issues */
+ angle = angle_wrap_rad(angle); /* clamp because of precision issues */
axis_angle_to_quat(quat, quat, angle);
break;
/* PyArg_ParseTuple assures no more then 2 */
@@ -1059,8 +1089,8 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self)
{
- PyObject *ret= Quaternion_copy(self);
- PyObject *ret_dummy= quat_func(ret);
+ PyObject *ret = Quaternion_copy(self);
+ PyObject *ret_dummy = quat_func(ret);
if (ret_dummy) {
Py_DECREF(ret_dummy);
return ret;
@@ -1075,25 +1105,25 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec
static void quat__axis_angle_sanitize(float axis[3], float *angle)
{
if (axis) {
- if ( !finite(axis[0]) ||
- !finite(axis[1]) ||
- !finite(axis[2]))
+ if ( !finite(axis[0]) ||
+ !finite(axis[1]) ||
+ !finite(axis[2]))
{
- axis[0]= 1.0f;
- axis[1]= 0.0f;
- axis[2]= 0.0f;
+ axis[0] = 1.0f;
+ axis[1] = 0.0f;
+ axis[2] = 0.0f;
}
- else if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
- EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
- ) {
+ else if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+ EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
+ EXPP_FloatsAreEqual(axis[2], 0.0f, 10))
+ {
axis[0] = 1.0f;
}
}
if (angle) {
if (!finite(*angle)) {
- *angle= 0.0f;
+ *angle = 0.0f;
}
}
}
@@ -1135,15 +1165,15 @@ static struct PyMethodDef Quaternion_methods[] = {
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef Quaternion_getseters[] = {
- {(char *)"w", (getter)Quaternion_getAxis, (setter)Quaternion_setAxis, (char *)"Quaternion W value.\n\n:type: float", (void *)0},
- {(char *)"x", (getter)Quaternion_getAxis, (setter)Quaternion_setAxis, (char *)"Quaternion X axis.\n\n:type: float", (void *)1},
- {(char *)"y", (getter)Quaternion_getAxis, (setter)Quaternion_setAxis, (char *)"Quaternion Y axis.\n\n:type: float", (void *)2},
- {(char *)"z", (getter)Quaternion_getAxis, (setter)Quaternion_setAxis, (char *)"Quaternion Z axis.\n\n:type: float", (void *)3},
- {(char *)"magnitude", (getter)Quaternion_getMagnitude, (setter)NULL, (char *)"Size of the quaternion (readonly).\n\n:type: float", NULL},
- {(char *)"angle", (getter)Quaternion_getAngle, (setter)Quaternion_setAngle, (char *)"angle of the quaternion.\n\n:type: float", NULL},
- {(char *)"axis",(getter)Quaternion_getAxisVec, (setter)Quaternion_setAxisVec, (char *)"quaternion axis as a vector.\n\n:type: :class:`Vector`", NULL},
- {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
- {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
+ {(char *)"w", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)0},
+ {(char *)"x", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)1},
+ {(char *)"y", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)2},
+ {(char *)"z", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)3},
+ {(char *)"magnitude", (getter)Quaternion_magnitude_get, (setter)NULL, Quaternion_magnitude_doc, NULL},
+ {(char *)"angle", (getter)Quaternion_angle_get, (setter)Quaternion_angle_set, Quaternion_angle_doc, NULL},
+ {(char *)"axis",(getter)Quaternion_axis_vector_get, (setter)Quaternion_axis_vector_set, Quaternion_axis_vector_doc, NULL},
+ {(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
+ {(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -1167,7 +1197,7 @@ PyTypeObject quaternion_Type = {
&Quaternion_AsMapping, //tp_as_mapping
NULL, //tp_hash
NULL, //tp_call
- NULL, //tp_str
+ (reprfunc) Quaternion_str, //tp_str
NULL, //tp_getattro
NULL, //tp_setattro
NULL, //tp_as_buffer
@@ -1209,13 +1239,13 @@ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_ty
{
QuaternionObject *self;
- self= base_type ? (QuaternionObject *)base_type->tp_alloc(base_type, 0) :
- (QuaternionObject *)PyObject_GC_New(QuaternionObject, &quaternion_Type);
+ self = base_type ? (QuaternionObject *)base_type->tp_alloc(base_type, 0) :
+ (QuaternionObject *)PyObject_GC_New(QuaternionObject, &quaternion_Type);
if (self) {
/* init callbacks as NULL */
- self->cb_user= NULL;
- self->cb_type= self->cb_subtype= 0;
+ self->cb_user = NULL;
+ self->cb_type = self->cb_subtype = 0;
if (type == Py_WRAP) {
self->quat = quat;
@@ -1240,12 +1270,12 @@ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_ty
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
{
- QuaternionObject *self= (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
+ QuaternionObject *self = (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user= cb_user;
- self->cb_type= (unsigned char)cb_type;
- self->cb_subtype= (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = (unsigned char)cb_type;
+ self->cb_subtype = (unsigned char)cb_subtype;
PyObject_GC_Track(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 9d1a22adb12..e137c7846bb 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -35,6 +35,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_dynstr.h"
#define MAX_DIMENSIONS 4
@@ -54,15 +55,29 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
*/
static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
{
- float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f};
- int size= 3; /* default to a 3D vector */
+ float *vec = NULL;
+ int size = 3; /* default to a 3D vector */
- switch(PyTuple_GET_SIZE(args)) {
+ switch (PyTuple_GET_SIZE(args)) {
case 0:
+ vec = PyMem_Malloc(size * sizeof(float));
+
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ fill_vn_fl(vec, size, 0.0f);
break;
case 1:
- if ((size=mathutils_array_parse(vec, 2, 4, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1)
+ if ((size = mathutils_array_parse_alloc(&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) {
+ if (vec) {
+ PyMem_Free(vec);
+ }
return NULL;
+ }
break;
default:
PyErr_SetString(PyExc_TypeError,
@@ -75,8 +90,8 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED
static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *self)
{
- PyObject *ret= Vector_copy(self);
- PyObject *ret_dummy= vec_func(ret);
+ PyObject *ret = Vector_copy(self);
+ PyObject *ret_dummy = vec_func(ret);
if (ret_dummy) {
Py_DECREF(ret_dummy);
return (PyObject *)ret;
@@ -87,6 +102,217 @@ static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *sel
}
}
+/*-----------------------CLASS-METHODS----------------------------*/
+PyDoc_STRVAR(C_Vector_Fill_doc,
+".. classmethod:: Fill(size, fill=0.0)\n"
+"\n"
+" Create a vector of length size with all values set to fill.\n"
+"\n"
+" :arg size: The length of the vector to be created.\n"
+" :type size: int\n"
+" :arg fill: The value used to fill the vector.\n"
+" :type fill: float\n"
+);
+static PyObject *C_Vector_Fill(PyObject *cls, PyObject *args)
+{
+ float *vec;
+ int size;
+ float fill = 0.0f;
+
+ if (!PyArg_ParseTuple(args, "i|f:Vector.Fill", &size, &fill)) {
+ return NULL;
+ }
+
+ if (size < 2) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Vector(): invalid size");
+ return NULL;
+ }
+
+ vec = PyMem_Malloc(size * sizeof(float));
+
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.Fill(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ fill_vn_fl(vec, size, fill);
+
+ return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
+}
+
+PyDoc_STRVAR(C_Vector_Range_doc,
+".. classmethod:: Range(start=0, stop, step=1)\n"
+"\n"
+" Create a filled with a range of values.\n"
+"\n"
+" :arg start: The start of the range used to fill the vector.\n"
+" :type start: int\n"
+" :arg stop: The end of the range used to fill the vector.\n"
+" :type stop: int\n"
+" :arg step: The step between successive values in the vector.\n"
+" :type step: int\n"
+);
+static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
+{
+ float *vec;
+ int stop, size;
+ int start = 0;
+ int step = 1;
+
+ if (!PyArg_ParseTuple(args, "i|ii:Vector.Range", &start, &stop, &step)) {
+ return NULL;
+ }
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ size = start;
+ start = 0;
+ break;
+ case 2:
+ if (start >= stop) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Start value is larger"
+ "than the stop value");
+ return NULL;
+ }
+
+ size = stop - start;
+ break;
+ default:
+ if (start >= stop) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Start value is larger"
+ "than the stop value");
+ return NULL;
+ }
+ size = (stop - start)/step;
+ if (size%step)
+ size++;
+ break;
+ }
+
+ vec = PyMem_Malloc(size * sizeof(float));
+
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.Range(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ range_vn_fl(vec, size, (float)start, (float)step);
+
+ return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
+}
+
+PyDoc_STRVAR(C_Vector_Linspace_doc,
+".. classmethod:: Linspace(start, stop, size)\n"
+"\n"
+" Create a vector of the specified size which is filled with linearly spaced values between start and stop values.\n"
+"\n"
+" :arg start: The start of the range used to fill the vector.\n"
+" :type start: int\n"
+" :arg stop: The end of the range used to fill the vector.\n"
+" :type stop: int\n"
+" :arg size: The size of the vector to be created.\n"
+" :type size: int\n"
+);
+static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args)
+{
+ float *vec;
+ int size;
+ float start, end, step;
+
+ if (!PyArg_ParseTuple(args, "ffi:Vector.Linspace", &start, &end, &size)) {
+ return NULL;
+ }
+
+ if (size < 2) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Vector.Linspace(): invalid size");
+ return NULL;
+ }
+
+ step = (end - start)/(float)(size-1);
+
+ vec = PyMem_Malloc(size * sizeof(float));
+
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.Linspace(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ range_vn_fl(vec, size, start, step);
+
+ return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
+}
+
+PyDoc_STRVAR(C_Vector_Repeat_doc,
+".. classmethod:: Repeat(vector, size)\n"
+"\n"
+" Create a vector by repeating the values in vector until the required size is reached.\n"
+"\n"
+" :arg tuple: The vector to draw values from.\n"
+" :type tuple: :class:`mathutils.Vector`\n"
+" :arg size: The size of the vector to be created.\n"
+" :type size: int\n"
+);
+static PyObject *C_Vector_Repeat(PyObject *cls, PyObject *args)
+{
+ float *vec;
+ float *iter_vec = NULL;
+ int i, size, value_size;
+ PyObject *value;
+
+ if (!PyArg_ParseTuple(args, "Oi:Vector.Repeat", &value, &size)) {
+ return NULL;
+ }
+
+ if (size < 2) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Vector.Repeat(): invalid size");
+ return NULL;
+ }
+
+ if ((value_size = mathutils_array_parse_alloc(&iter_vec, 2, value,
+ "Vector.Repeat(vector, size), invalid 'vector' arg")) == -1)
+ {
+ PyMem_Free(iter_vec);
+ return NULL;
+ }
+
+ if (iter_vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.Repeat(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ vec = PyMem_Malloc(size * sizeof(float));
+
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.Repeat(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ i = 0;
+ while (i < size) {
+ vec[i] = iter_vec[i % value_size];
+ i++;
+ }
+
+ PyMem_Free(iter_vec);
+
+ return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
+}
+
/*-----------------------------METHODS---------------------------- */
PyDoc_STRVAR(Vector_zero_doc,
".. method:: zero()\n"
@@ -137,6 +363,101 @@ static PyObject *Vector_normalized(VectorObject *self)
return vec__apply_to_copy((PyNoArgsFunction)Vector_normalize, self);
}
+PyDoc_STRVAR(Vector_resize_doc,
+".. method:: resize(size=3)\n"
+"\n"
+" Resize the vector to have size number of elements.\n"
+"\n"
+" :return: an instance of itself\n"
+" :rtype: :class:`Vector`\n"
+);
+static PyObject *Vector_resize(VectorObject *self, PyObject *value)
+{
+ int size;
+
+ if (self->wrapped == Py_WRAP) {
+ PyErr_SetString(PyExc_TypeError,
+ "Vector.resize(): "
+ "cannot resize wrapped data - only python vectors");
+ return NULL;
+ }
+ if (self->cb_user) {
+ PyErr_SetString(PyExc_TypeError,
+ "Vector.resize(): "
+ "cannot resize a vector that has an owner");
+ return NULL;
+ }
+
+ if ((size = PyLong_AsLong(value)) == -1) {
+ PyErr_SetString(PyExc_TypeError,
+ "Vector.resize(size): "
+ "expected size argument to be an integer");
+ return NULL;
+ }
+
+ if (size < 2) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Vector.resize(): invalid size");
+ return NULL;
+ }
+
+ self->vec = PyMem_Realloc(self->vec, (size * sizeof(float)));
+ if (self->vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.resize(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ /* If the vector has increased in length, set all new elements to 0.0f */
+ if (size > self->size) {
+ fill_vn_fl(self->vec + self->size, size - self->size, 0.0f);
+ }
+
+ self->size = size;
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(Vector_resized_doc,
+".. method:: resized(size=3)\n"
+"\n"
+" Return a resized copy of the vector with size number of elements.\n"
+"\n"
+" :return: a new vector\n"
+" :rtype: :class:`Vector`\n"
+);
+static PyObject *Vector_resized(VectorObject *self, PyObject *value)
+{
+ int size;
+ float *vec;
+
+ /*if (!PyArg_ParseTuple(args, "i:resize", &size))
+ return NULL;*/
+ if ((size = PyLong_AsLong(value)) == -1) {
+ return NULL;
+ }
+
+ if (size < 2) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Vector.resized(): invalid size");
+ return NULL;
+ }
+
+ vec = PyMem_Malloc(size * sizeof(float));
+
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.resized(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
+ fill_vn_fl(vec, size, 0.0f);
+ memcpy(vec, self->vec, self->size * sizeof(float));
+
+ return Vector_CreatePyObject_alloc(vec, size, NULL);
+}
+
PyDoc_STRVAR(Vector_resize_2d_doc,
".. method:: resize_2d()\n"
"\n"
@@ -147,7 +468,7 @@ PyDoc_STRVAR(Vector_resize_2d_doc,
);
static PyObject *Vector_resize_2d(VectorObject *self)
{
- if (self->wrapped==Py_WRAP) {
+ if (self->wrapped == Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_2d(): "
"cannot resize wrapped data - only python vectors");
@@ -182,7 +503,7 @@ PyDoc_STRVAR(Vector_resize_3d_doc,
);
static PyObject *Vector_resize_3d(VectorObject *self)
{
- if (self->wrapped==Py_WRAP) {
+ if (self->wrapped == Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_3d(): "
"cannot resize wrapped data - only python vectors");
@@ -220,7 +541,7 @@ PyDoc_STRVAR(Vector_resize_4d_doc,
);
static PyObject *Vector_resize_4d(VectorObject *self)
{
- if (self->wrapped==Py_WRAP) {
+ if (self->wrapped == Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize_4d(): "
"cannot resize wrapped data - only python vectors");
@@ -276,7 +597,7 @@ PyDoc_STRVAR(Vector_to_3d_doc,
);
static PyObject *Vector_to_3d(VectorObject *self)
{
- float tvec[3]= {0.0f};
+ float tvec[3] = {0.0f};
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -294,7 +615,7 @@ PyDoc_STRVAR(Vector_to_4d_doc,
);
static PyObject *Vector_to_4d(VectorObject *self)
{
- float tvec[4]= {0.0f, 0.0f, 0.0f, 1.0f};
+ float tvec[4] = {0.0f, 0.0f, 0.0f, 1.0f};
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -319,7 +640,7 @@ static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits)
PyObject *ret;
int i;
- ret= PyTuple_New(self->size);
+ ret = PyTuple_New(self->size);
if (ndigits >= 0) {
for (i = 0; i < self->size; i++) {
@@ -337,7 +658,7 @@ static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits)
static PyObject *Vector_to_tuple(VectorObject *self, PyObject *args)
{
- int ndigits= 0;
+ int ndigits = 0;
if (!PyArg_ParseTuple(args, "|i:to_tuple", &ndigits))
return NULL;
@@ -349,8 +670,8 @@ static PyObject *Vector_to_tuple(VectorObject *self, PyObject *args)
return NULL;
}
- if (PyTuple_GET_SIZE(args)==0)
- ndigits= -1;
+ if (PyTuple_GET_SIZE(args) == 0)
+ ndigits = -1;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -390,11 +711,11 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
return NULL;
if (strack) {
- const char *axis_err_msg= "only X, -X, Y, -Y, Z or -Z for track axis";
+ const char *axis_err_msg = "only X, -X, Y, -Y, Z or -Z for track axis";
if (strlen(strack) == 2) {
if (strack[0] == '-') {
- switch(strack[1]) {
+ switch (strack[1]) {
case 'X':
track = 3;
break;
@@ -415,7 +736,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
}
}
else if (strlen(strack) == 1) {
- switch(strack[0]) {
+ switch (strack[0]) {
case '-':
case 'X':
track = 0;
@@ -438,9 +759,9 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
}
if (sup) {
- const char *axis_err_msg= "only X, Y or Z for up axis";
+ const char *axis_err_msg = "only X, Y or Z for up axis";
if (strlen(sup) == 1) {
- switch(*sup) {
+ switch (*sup) {
case 'X':
up = 0;
break;
@@ -502,9 +823,15 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if ((value_size= mathutils_array_parse(tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1)
+ if ((value_size = mathutils_array_parse(tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1)
return NULL;
+ if (self->size < 2 || self->size > 4) {
+ PyErr_SetString(PyExc_ValueError,
+ "Vector must be 2D, 3D or 4D");
+ return NULL;
+ }
+
mirror[0] = tvec[0];
mirror[1] = tvec[1];
if (value_size > 2) mirror[2] = tvec[2];
@@ -544,7 +871,13 @@ static PyObject *Vector_cross(VectorObject *self, PyObject *value)
if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1)
return NULL;
- ret= (VectorObject *)Vector_CreatePyObject(NULL, 3, Py_NEW, Py_TYPE(self));
+ if (self->size != 3) {
+ PyErr_SetString(PyExc_ValueError,
+ "Vector must be 3D");
+ return NULL;
+ }
+
+ ret = (VectorObject *)Vector_CreatePyObject(NULL, 3, Py_NEW, Py_TYPE(self));
cross_v3_v3v3(ret->vec, self->vec, tvec);
return (PyObject *)ret;
}
@@ -561,15 +894,20 @@ PyDoc_STRVAR(Vector_dot_doc,
);
static PyObject *Vector_dot(VectorObject *self, PyObject *value)
{
- float tvec[MAX_DIMENSIONS];
+ float *tvec;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1)
- return NULL;
+ if (mathutils_array_parse_alloc(&tvec, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1) {
+ goto cleanup;
+ }
return PyFloat_FromDouble(dot_vn_vn(self->vec, tvec, self->size));
+
+cleanup:
+ PyMem_Free(tvec);
+ return NULL;
}
PyDoc_STRVAR(Vector_angle_doc,
@@ -589,12 +927,12 @@ PyDoc_STRVAR(Vector_angle_doc,
);
static PyObject *Vector_angle(VectorObject *self, PyObject *args)
{
- const int size= MIN2(self->size, 3); /* 4D angle makes no sense */
+ const int size = MIN2(self->size, 3); /* 4D angle makes no sense */
float tvec[MAX_DIMENSIONS];
PyObject *value;
- double dot= 0.0f, dot_self= 0.0f, dot_other= 0.0f;
+ double dot = 0.0f, dot_self = 0.0f, dot_other = 0.0f;
int x;
- PyObject *fallback= NULL;
+ PyObject *fallback = NULL;
if (!PyArg_ParseTuple(args, "O|O:angle", &value, &fallback))
return NULL;
@@ -607,6 +945,12 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.angle(other), invalid 'other' arg") == -1)
return NULL;
+ if (self->size > 4) {
+ PyErr_SetString(PyExc_ValueError,
+ "Vector must be 2D, 3D or 4D");
+ return NULL;
+ }
+
for (x = 0; x < size; x++) {
dot_self += (double)self->vec[x] * (double)self->vec[x];
dot_other += (double)tvec[x] * (double)tvec[x];
@@ -647,7 +991,7 @@ static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value)
{
float quat[4], vec_a[3], vec_b[3];
- if (self->size < 3) {
+ if (self->size < 3 || self->size > 4) {
PyErr_SetString(PyExc_ValueError,
"vec.difference(value): "
"expects both vectors to be size 3 or 4");
@@ -680,7 +1024,7 @@ PyDoc_STRVAR(Vector_project_doc,
);
static PyObject *Vector_project(VectorObject *self, PyObject *value)
{
- const int size= self->size;
+ const int size = self->size;
float tvec[MAX_DIMENSIONS];
float vec[MAX_DIMENSIONS];
double dot = 0.0f, dot2 = 0.0f;
@@ -692,6 +1036,12 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
if (mathutils_array_parse(tvec, size, size, value, "Vector.project(other), invalid 'other' arg") == -1)
return NULL;
+ if (self->size > 4) {
+ PyErr_SetString(PyExc_ValueError,
+ "Vector must be 2D, 3D or 4D");
+ return NULL;
+ }
+
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -722,27 +1072,44 @@ PyDoc_STRVAR(Vector_lerp_doc,
);
static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
{
- const int size= self->size;
- PyObject *value= NULL;
+ const int size = self->size;
+ PyObject *value = NULL;
float fac, ifac;
- float tvec[MAX_DIMENSIONS], vec[MAX_DIMENSIONS];
+ float *tvec, *vec;
int x;
if (!PyArg_ParseTuple(args, "Of:lerp", &value, &fac))
return NULL;
- if (mathutils_array_parse(tvec, size, size, value, "Vector.lerp(other), invalid 'other' arg") == -1)
- return NULL;
+ if (mathutils_array_parse_alloc(&tvec, size, value, "Vector.lerp(other), invalid 'other' arg") == -1) {
+ goto cleanup;
+ }
- if (BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1) {
+ goto cleanup;
+ }
+
+ vec = PyMem_Malloc(size * sizeof(float));
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector.lerp(): "
+ "problem allocating pointer space");
return NULL;
+ }
- ifac= 1.0f - fac;
+ ifac = 1.0f - fac;
for (x = 0; x < size; x++) {
vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]);
}
- return Vector_CreatePyObject(vec, size, Py_NEW, Py_TYPE(self));
+
+ PyMem_Free(tvec);
+
+ return Vector_CreatePyObject_alloc(vec, size, Py_TYPE(self));
+
+cleanup:
+ PyMem_Free(tvec);
+ return NULL;
}
PyDoc_STRVAR(Vector_rotate_doc,
@@ -763,7 +1130,7 @@ static PyObject *Vector_rotate(VectorObject *self, PyObject *value)
if (mathutils_any_to_rotmat(other_rmat, value, "Vector.rotate(value)") == -1)
return NULL;
- if (self->size < 3) {
+ if (self->size < 3 || self->size > 4) {
PyErr_SetString(PyExc_ValueError,
"Vector must be 3D or 4D");
return NULL;
@@ -801,12 +1168,35 @@ static PyObject *Vector_repr(VectorObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- tuple= Vector_to_tuple_ext(self, -1);
- ret= PyUnicode_FromFormat("Vector(%R)", tuple);
+ tuple = Vector_to_tuple_ext(self, -1);
+ ret = PyUnicode_FromFormat("Vector(%R)", tuple);
Py_DECREF(tuple);
return ret;
}
+static PyObject *Vector_str(VectorObject *self)
+{
+ int i;
+
+ DynStr *ds;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ ds = BLI_dynstr_new();
+
+ BLI_dynstr_append(ds, "<Vector (");
+
+ for (i = 0; i < self->size; i++) {
+ BLI_dynstr_appendf(ds, i ? ", %.4f" : "%.4f", self->vec[i]);
+ }
+
+ BLI_dynstr_append(ds, ")>");
+
+ return mathutils_dynstr_to_py(ds); /* frees ds */
+}
+
+
/* Sequence Protocol */
/* sequence length len(vector) */
static int Vector_len(VectorObject *self)
@@ -816,7 +1206,7 @@ static int Vector_len(VectorObject *self)
/* sequence accessor (get): vector[index] */
static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr)
{
- if (i<0) i= self->size-i;
+ if (i < 0) i = self->size-i;
if (i < 0 || i >= self->size) {
if (is_attr) {
@@ -845,14 +1235,14 @@ static PyObject *Vector_item(VectorObject *self, int i)
static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, const int is_attr)
{
float scalar;
- if ((scalar=PyFloat_AsDouble(value))==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
+ if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError,
"vector[index] = x: "
"index argument not a number");
return -1;
}
- if (i<0) i= self->size-i;
+ if (i < 0) i = self->size-i;
if (i < 0 || i >= self->size) {
if (is_attr) {
@@ -889,11 +1279,11 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end)
return NULL;
CLAMP(begin, 0, self->size);
- if (end<0) end= self->size+end+1;
+ if (end < 0) end = self->size + end + 1;
CLAMP(end, 0, self->size);
- begin= MIN2(begin, end);
+ begin = MIN2(begin, end);
- tuple= PyTuple_New(end - begin);
+ tuple = PyTuple_New(end - begin);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->vec[count]));
}
@@ -903,8 +1293,8 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end)
/* sequence slice (set): vector[a:b] = value */
static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *seq)
{
- int y, size = 0;
- float vec[MAX_DIMENSIONS];
+ int size = 0;
+ float *vec = NULL;
if (BaseMath_ReadCallback(self) == -1)
return -1;
@@ -914,18 +1304,30 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se
begin = MIN2(begin, end);
size = (end - begin);
- if (mathutils_array_parse(vec, size, size, seq, "vector[begin:end] = [...]") == -1)
+ if (mathutils_array_parse_alloc(&vec, size, seq, "vector[begin:end] = [...]") == -1) {
+ goto cleanup;
+ }
+
+ if (vec == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "vec[:] = seq: "
+ "problem allocating pointer space");
return -1;
+ }
/*parsed well - now set in vector*/
- for (y = 0; y < size; y++) {
- self->vec[begin + y] = vec[y];
- }
+ memcpy(self->vec + begin, vec, size * sizeof(float));
if (BaseMath_WriteCallback(self) == -1)
return -1;
+ PyMem_Free(vec);
+
return 0;
+
+cleanup:
+ PyMem_Free(vec);
+ return -1;
}
/* Numeric Protocols */
@@ -933,7 +1335,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se
static PyObject *Vector_add(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
- float vec[MAX_DIMENSIONS];
+ float *vec = NULL;
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
PyErr_Format(PyExc_AttributeError,
@@ -956,9 +1358,18 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2)
return NULL;
}
+ vec = PyMem_Malloc(vec1->size * sizeof(float));
+
+ if (vec == NULL) { /*allocation failure*/
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
add_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size);
- return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
+ return Vector_CreatePyObject_alloc(vec, vec1->size, Py_TYPE(v1));
}
/* addition in-place: obj += obj */
@@ -997,7 +1408,7 @@ static PyObject *Vector_iadd(PyObject *v1, PyObject *v2)
static PyObject *Vector_sub(PyObject *v1, PyObject *v2)
{
VectorObject *vec1 = NULL, *vec2 = NULL;
- float vec[MAX_DIMENSIONS];
+ float *vec;
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
PyErr_Format(PyExc_AttributeError,
@@ -1019,15 +1430,24 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2)
return NULL;
}
+ vec = PyMem_Malloc(vec1->size * sizeof(float));
+
+ if (vec == NULL) { /*allocation failure*/
+ PyErr_SetString(PyExc_MemoryError,
+ "Vector(): "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
sub_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size);
- return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
+ return Vector_CreatePyObject_alloc(vec, vec1->size, Py_TYPE(v1));
}
/* subtraction in-place: obj -= obj */
static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
{
- VectorObject *vec1= NULL, *vec2= NULL;
+ VectorObject *vec1 = NULL, *vec2 = NULL;
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
PyErr_Format(PyExc_AttributeError,
@@ -1068,14 +1488,13 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
* note: vector/matrix multiplication IS NOT COMMUTATIVE!!!!
* note: assume read callbacks have been done first.
*/
-int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec, MatrixObject * mat)
+int column_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
{
float vec_cpy[MAX_DIMENSIONS];
- double dot = 0.0f;
- int x, y, z = 0;
+ int row, col, z = 0;
- if (mat->row_size != vec->size) {
- if (mat->row_size == 4 && vec->size == 3) {
+ if (mat->num_col != vec->size) {
+ if (mat->num_col == 4 && vec->size == 3) {
vec_cpy[3] = 1.0f;
}
else {
@@ -1089,14 +1508,14 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec,
memcpy(vec_cpy, vec->vec, vec->size * sizeof(float));
- rvec[3] = 1.0f;
+ r_vec[3] = 1.0f;
- for (x = 0; x < mat->col_size; x++) {
- for (y = 0; y < mat->row_size; y++) {
- dot += (double)(mat->matrix[y][x] * vec_cpy[y]);
+ for (row = 0; row < mat->num_row; row++) {
+ double dot = 0.0f;
+ for (col = 0; col < mat->num_col; col++) {
+ dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[col]);
}
- rvec[z++] = (float)dot;
- dot = 0.0f;
+ r_vec[z++] = (float)dot;
}
return 0;
@@ -1104,23 +1523,32 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec,
static PyObject *vector_mul_float(VectorObject *vec, const float scalar)
{
- float tvec[MAX_DIMENSIONS];
+ float *tvec = PyMem_Malloc(vec->size * sizeof(float));
+
+ if (tvec == NULL) { /*allocation failure*/
+ PyErr_SetString(PyExc_MemoryError,
+ "vec * float: "
+ "problem allocating pointer space");
+ return NULL;
+ }
+
mul_vn_vn_fl(tvec, vec->vec, vec->size, scalar);
- return Vector_CreatePyObject(tvec, vec->size, Py_NEW, Py_TYPE(vec));
+ return Vector_CreatePyObject_alloc(tvec, vec->size, Py_TYPE(vec));
}
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;
+ vec1 = (VectorObject *)v1;
if (BaseMath_ReadCallback(vec1) == -1)
return NULL;
}
if VectorObject_Check(v2) {
- vec2= (VectorObject *)v2;
+ vec2 = (VectorObject *)v2;
if (BaseMath_ReadCallback(vec2) == -1)
return NULL;
}
@@ -1149,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 */
@@ -1179,12 +1614,12 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
#endif
/* ------ to be removed ------*/
}
- else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC * FLOAT */
+ else if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* VEC * FLOAT */
return vector_mul_float(vec1, scalar);
}
}
else if (vec2) {
- if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* FLOAT * VEC */
+ if (((scalar = PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred()) == 0) { /* FLOAT * VEC */
return vector_mul_float(vec2, scalar);
}
}
@@ -1258,7 +1693,7 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
#endif
/* ------ to be removed ------*/
}
- else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC *= FLOAT */
+ else if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* VEC *= FLOAT */
mul_vn_fl(vec->vec, vec->size, scalar);
}
else {
@@ -1277,8 +1712,7 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
/* divid: obj / obj */
static PyObject *Vector_div(PyObject *v1, PyObject *v2)
{
- int i;
- float vec[4], scalar;
+ float *vec = NULL, scalar;
VectorObject *vec1 = NULL;
if (!VectorObject_Check(v1)) { /* not a vector */
@@ -1287,57 +1721,63 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2)
"Vector must be divided by a float");
return NULL;
}
- vec1 = (VectorObject*)v1; /* vector */
+ vec1 = (VectorObject *)v1; /* vector */
if (BaseMath_ReadCallback(vec1) == -1)
return NULL;
- if ((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
+ if ((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError,
"Vector division: "
"Vector must be divided by a float");
return NULL;
}
- if (scalar==0.0f) {
+ if (scalar == 0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError,
"Vector division: "
"divide by zero error");
return NULL;
}
- for (i = 0; i < vec1->size; i++) {
- vec[i] = vec1->vec[i] / scalar;
+ vec = PyMem_Malloc(vec1->size * sizeof(float));
+
+ if (vec == NULL) { /*allocation failure*/
+ PyErr_SetString(PyExc_MemoryError,
+ "vec / value: "
+ "problem allocating pointer space");
+ return NULL;
}
- return Vector_CreatePyObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
+
+ mul_vn_vn_fl(vec, vec1->vec, vec1->size, 1.0f / scalar);
+
+ return Vector_CreatePyObject_alloc(vec, vec1->size, Py_TYPE(v1));
}
/* divide in-place: obj /= obj */
static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
{
- int i;
float scalar;
VectorObject *vec1 = (VectorObject*)v1;
if (BaseMath_ReadCallback(vec1) == -1)
return NULL;
- if ((scalar=PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
+ if ((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError,
"Vector division: "
"Vector must be divided by a float");
return NULL;
}
- if (scalar==0.0f) {
+ if (scalar == 0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError,
"Vector division: "
"divide by zero error");
return NULL;
}
- for (i = 0; i < vec1->size; i++) {
- vec1->vec[i] /= scalar;
- }
+
+ mul_vn_fl(vec1->vec, vec1->size, 1.0f / scalar);
(void)BaseMath_WriteCallback(vec1);
@@ -1349,35 +1789,30 @@ static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
returns the negative of this object*/
static PyObject *Vector_neg(VectorObject *self)
{
- float tvec[MAX_DIMENSIONS];
+ float *tvec;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
+ tvec = PyMem_Malloc(self->size * sizeof(float));
negate_vn_vn(tvec, self->vec, self->size);
- return Vector_CreatePyObject(tvec, self->size, Py_NEW, Py_TYPE(self));
+ return Vector_CreatePyObject_alloc(tvec, self->size, Py_TYPE(self));
}
/*------------------------vec_magnitude_nosqrt (internal) - for comparing only */
static double vec_magnitude_nosqrt(float *data, int size)
{
- double dot = 0.0f;
- int i;
-
- for (i=0; i<size; i++) {
- dot += (double)data[i];
- }
/*return (double)sqrt(dot);*/
/* warning, line above removed because we are not using the length,
rather the comparing the sizes and for this we do not need the sqrt
for the actual length, the dot must be sqrt'd */
- return dot;
+ return dot_vn_vn(data, data, size);
}
/*------------------------tp_richcmpr
returns -1 execption, 0 false, 1 true */
-static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
+static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
{
VectorObject *vecA = NULL, *vecB = NULL;
int result = 0;
@@ -1474,7 +1909,7 @@ static PySequenceMethods Vector_SeqMethods = {
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
-static PyObject *Vector_subscript(VectorObject* self, PyObject* item)
+static PyObject *Vector_subscript(VectorObject *self, PyObject *item)
{
if (PyIndex_Check(item)) {
Py_ssize_t i;
@@ -1511,7 +1946,7 @@ static PyObject *Vector_subscript(VectorObject* self, PyObject* item)
}
}
-static int Vector_ass_subscript(VectorObject* self, PyObject* item, PyObject* value)
+static int Vector_ass_subscript(VectorObject *self, PyObject *item, PyObject *value)
{
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
@@ -1589,43 +2024,44 @@ static PyNumberMethods Vector_NumMethods = {
/*------------------PY_OBECT DEFINITION--------------------------*/
-/*
- * vector axis, vector.x/y/z/w
- */
+/* vector axis, vector.x/y/z/w */
+
+PyDoc_STRVAR(Vector_axis_x_doc, "Vector X axis.\n\n:type: float");
+PyDoc_STRVAR(Vector_axis_y_doc, "Vector Y axis.\n\n:type: float");
+PyDoc_STRVAR(Vector_axis_z_doc, "Vector Z axis (3D Vectors only).\n\n:type: float");
+PyDoc_STRVAR(Vector_axis_w_doc, "Vector W axis (4D Vectors only).\n\n:type: float");
-static PyObject *Vector_getAxis(VectorObject *self, void *type)
+static PyObject *Vector_axis_get(VectorObject *self, void *type)
{
return vector_item_internal(self, GET_INT_FROM_POINTER(type), TRUE);
}
-static int Vector_setAxis(VectorObject *self, PyObject *value, void *type)
+static int Vector_axis_set(VectorObject *self, PyObject *value, void *type)
{
return vector_ass_item_internal(self, GET_INT_FROM_POINTER(type), value, TRUE);
}
/* vector.length */
-static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure))
-{
- double dot = 0.0f;
- int i;
+PyDoc_STRVAR(Vector_length_doc,
+"Vector Length.\n\n:type: float"
+);
+static PyObject *Vector_length_get(VectorObject *self, void *UNUSED(closure))
+{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
- for (i = 0; i < self->size; i++) {
- dot += (double)(self->vec[i] * self->vec[i]);
- }
- return PyFloat_FromDouble(sqrt(dot));
+ return PyFloat_FromDouble(sqrt(dot_vn_vn(self->vec, self->vec, self->size)));
}
-static int Vector_setLength(VectorObject *self, PyObject *value)
+static int Vector_length_set(VectorObject *self, PyObject *value)
{
double dot = 0.0f, param;
if (BaseMath_ReadCallback(self) == -1)
return -1;
- if ((param=PyFloat_AsDouble(value)) == -1.0 && PyErr_Occurred()) {
+ if ((param = PyFloat_AsDouble(value)) == -1.0 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"length must be set to a number");
return -1;
@@ -1641,19 +2077,19 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
return 0;
}
- dot= dot_vn_vn(self->vec, self->vec, self->size);
+ dot = dot_vn_vn(self->vec, self->vec, self->size);
if (!dot) /* cant sqrt zero */
return 0;
dot = sqrt(dot);
- if (dot==param)
+ if (dot == param)
return 0;
- dot= dot/param;
+ dot = dot / param;
- mul_vn_fl(self->vec, self->size, 1.0/dot);
+ mul_vn_fl(self->vec, self->size, 1.0 / dot);
(void)BaseMath_WriteCallback(self); /* checked already */
@@ -1661,7 +2097,10 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
}
/* vector.length_squared */
-static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closure))
+PyDoc_STRVAR(Vector_length_squared_doc,
+"Vector length squared (v.dot(v)).\n\n:type: float"
+);
+static PyObject *Vector_length_squared_get(VectorObject *self, void *UNUSED(closure))
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -1670,9 +2109,9 @@ static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closur
}
/* Get a new Vector according to the provided swizzle. This function has little
- error checking, as we are in control of the inputs: the closure is set by us
- in Vector_createSwizzleGetSeter. */
-static PyObject *Vector_getSwizzle(VectorObject *self, void *closure)
+ * error checking, as we are in control of the inputs: the closure is set by us
+ * in Vector_createSwizzleGetSeter. */
+static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
{
size_t axis_to;
size_t axis_from;
@@ -1685,8 +2124,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure)
/* Unpack the axes from the closure into an array. */
axis_to = 0;
swizzleClosure = GET_INT_FROM_POINTER(closure);
- while (swizzleClosure & SWIZZLE_VALID_AXIS)
- {
+ while (swizzleClosure & SWIZZLE_VALID_AXIS) {
axis_from = swizzleClosure & SWIZZLE_AXIS;
if (axis_from >= self->size) {
PyErr_SetString(PyExc_AttributeError,
@@ -1704,16 +2142,16 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure)
}
/* Set the items of this vector using a swizzle.
- - If value is a vector or list this operates like an array copy, except that
- the destination is effectively re-ordered as defined by the swizzle. At
- most min(len(source), len(dest)) values will be copied.
- - If the value is scalar, it is copied to all axes listed in the swizzle.
- - If an axis appears more than once in the swizzle, the final occurrence is
- the one that determines its value.
-
- Returns 0 on success and -1 on failure. On failure, the vector will be
- unchanged. */
-static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
+ * - If value is a vector or list this operates like an array copy, except that
+ * the destination is effectively re-ordered as defined by the swizzle. At
+ * most min(len(source), len(dest)) values will be copied.
+ * - If the value is scalar, it is copied to all axes listed in the swizzle.
+ * - If an axis appears more than once in the swizzle, the final occurrence is
+ * the one that determines its value.
+
+ * Returns 0 on success and -1 on failure. On failure, the vector will be
+ * unchanged. */
+static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure)
{
size_t size_from;
float scalarVal;
@@ -1730,13 +2168,13 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
return -1;
/* Check that the closure can be used with this vector: even 2D vectors have
- swizzles defined for axes z and w, but they would be invalid. */
+ * swizzles defined for axes z and w, but they would be invalid. */
swizzleClosure = GET_INT_FROM_POINTER(closure);
- axis_from= 0;
+ axis_from = 0;
+
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
axis_to = swizzleClosure & SWIZZLE_AXIS;
- if (axis_to >= self->size)
- {
+ if (axis_to >= self->size) {
PyErr_SetString(PyExc_AttributeError,
"Vector swizzle: "
"specified axis not present");
@@ -1746,15 +2184,17 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
axis_from++;
}
- if (((scalarVal=PyFloat_AsDouble(value)) == -1 && PyErr_Occurred())==0) {
+ if (((scalarVal = PyFloat_AsDouble(value)) == -1 && PyErr_Occurred()) == 0) {
int i;
- for (i=0; i < MAX_DIMENSIONS; i++)
- vec_assign[i]= scalarVal;
- size_from= axis_from;
+ for (i = 0; i < MAX_DIMENSIONS; i++) {
+ vec_assign[i] = scalarVal;
+ }
+
+ size_from = axis_from;
}
else if ( (PyErr_Clear()), /* run but ignore the result */
- (size_from=mathutils_array_parse(vec_assign, 2, 4, value,
+ (size_from = mathutils_array_parse(vec_assign, 2, 4, value,
"mathutils.Vector.**** = swizzle assignment")) == -1)
{
return -1;
@@ -1769,8 +2209,8 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
/* Copy vector contents onto swizzled axes. */
axis_from = 0;
swizzleClosure = GET_INT_FROM_POINTER(closure);
- while (swizzleClosure & SWIZZLE_VALID_AXIS)
- {
+
+ while (swizzleClosure & SWIZZLE_VALID_AXIS) {
axis_to = swizzleClosure & SWIZZLE_AXIS;
tvec[axis_to] = vec_assign[axis_from];
swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
@@ -1790,353 +2230,353 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef Vector_getseters[] = {
- {(char *)"x", (getter)Vector_getAxis, (setter)Vector_setAxis, (char *)"Vector X axis.\n\n:type: float", (void *)0},
- {(char *)"y", (getter)Vector_getAxis, (setter)Vector_setAxis, (char *)"Vector Y axis.\n\n:type: float", (void *)1},
- {(char *)"z", (getter)Vector_getAxis, (setter)Vector_setAxis, (char *)"Vector Z axis (3D Vectors only).\n\n:type: float", (void *)2},
- {(char *)"w", (getter)Vector_getAxis, (setter)Vector_setAxis, (char *)"Vector W axis (4D Vectors only).\n\n:type: float", (void *)3},
- {(char *)"length", (getter)Vector_getLength, (setter)Vector_setLength, (char *)"Vector Length.\n\n:type: float", NULL},
- {(char *)"length_squared", (getter)Vector_getLengthSquared, (setter)NULL, (char *)"Vector length squared (v.dot(v)).\n\n:type: float", NULL},
- {(char *)"magnitude", (getter)Vector_getLength, (setter)Vector_setLength, (char *)"Vector Length.\n\n:type: float", NULL},
- {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},
- {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL},
+ {(char *)"x", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_x_doc, (void *)0},
+ {(char *)"y", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_y_doc, (void *)1},
+ {(char *)"z", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_z_doc, (void *)2},
+ {(char *)"w", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_w_doc, (void *)3},
+ {(char *)"length", (getter)Vector_length_get, (setter)Vector_length_set, Vector_length_doc, NULL},
+ {(char *)"length_squared", (getter)Vector_length_squared_get, (setter)NULL, Vector_length_squared_doc, NULL},
+ {(char *)"magnitude", (getter)Vector_length_get, (setter)Vector_length_set, Vector_length_doc, NULL},
+ {(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
+ {(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
/* autogenerated swizzle attrs, see python script below */
- {(char *)"xx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 36
- {(char *)"xxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 292
- {(char *)"xxxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2340
- {(char *)"xxxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2852
- {(char *)"xxxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3364
- {(char *)"xxxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3876
- {(char *)"xxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 356
- {(char *)"xxyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2404
- {(char *)"xxyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2916
- {(char *)"xxyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3428
- {(char *)"xxyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3940
- {(char *)"xxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 420
- {(char *)"xxzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2468
- {(char *)"xxzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2980
- {(char *)"xxzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3492
- {(char *)"xxzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4004
- {(char *)"xxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 484
- {(char *)"xxwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2532
- {(char *)"xxwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3044
- {(char *)"xxwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3556
- {(char *)"xxww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4068
- {(char *)"xy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 44
- {(char *)"xyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 300
- {(char *)"xyxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2348
- {(char *)"xyxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2860
- {(char *)"xyxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3372
- {(char *)"xyxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3884
- {(char *)"xyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 364
- {(char *)"xyyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2412
- {(char *)"xyyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2924
- {(char *)"xyyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3436
- {(char *)"xyyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3948
- {(char *)"xyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 428
- {(char *)"xyzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2476
- {(char *)"xyzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2988
- {(char *)"xyzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3500
- {(char *)"xyzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4012
- {(char *)"xyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 492
- {(char *)"xywx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2540
- {(char *)"xywy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3052
- {(char *)"xywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3564
- {(char *)"xyww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4076
- {(char *)"xz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 52
- {(char *)"xzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 308
- {(char *)"xzxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2356
- {(char *)"xzxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2868
- {(char *)"xzxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3380
- {(char *)"xzxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3892
- {(char *)"xzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 372
- {(char *)"xzyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2420
- {(char *)"xzyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2932
- {(char *)"xzyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3444
- {(char *)"xzyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3956
- {(char *)"xzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 436
- {(char *)"xzzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2484
- {(char *)"xzzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2996
- {(char *)"xzzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3508
- {(char *)"xzzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4020
- {(char *)"xzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 500
- {(char *)"xzwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2548
- {(char *)"xzwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3060
- {(char *)"xzwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3572
- {(char *)"xzww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4084
- {(char *)"xw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 60
- {(char *)"xwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 316
- {(char *)"xwxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2364
- {(char *)"xwxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2876
- {(char *)"xwxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3388
- {(char *)"xwxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3900
- {(char *)"xwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 380
- {(char *)"xwyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2428
- {(char *)"xwyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2940
- {(char *)"xwyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3452
- {(char *)"xwyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3964
- {(char *)"xwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 444
- {(char *)"xwzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2492
- {(char *)"xwzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3004
- {(char *)"xwzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3516
- {(char *)"xwzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4028
- {(char *)"xww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 508
- {(char *)"xwwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2556
- {(char *)"xwwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3068
- {(char *)"xwwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3580
- {(char *)"xwww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4092
- {(char *)"yx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 37
- {(char *)"yxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 293
- {(char *)"yxxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2341
- {(char *)"yxxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2853
- {(char *)"yxxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3365
- {(char *)"yxxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3877
- {(char *)"yxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 357
- {(char *)"yxyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2405
- {(char *)"yxyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2917
- {(char *)"yxyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3429
- {(char *)"yxyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3941
- {(char *)"yxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 421
- {(char *)"yxzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2469
- {(char *)"yxzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2981
- {(char *)"yxzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3493
- {(char *)"yxzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4005
- {(char *)"yxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 485
- {(char *)"yxwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2533
- {(char *)"yxwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3045
- {(char *)"yxwz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3557
- {(char *)"yxww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4069
- {(char *)"yy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 45
- {(char *)"yyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 301
- {(char *)"yyxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2349
- {(char *)"yyxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2861
- {(char *)"yyxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3373
- {(char *)"yyxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3885
- {(char *)"yyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 365
- {(char *)"yyyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2413
- {(char *)"yyyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2925
- {(char *)"yyyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3437
- {(char *)"yyyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3949
- {(char *)"yyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 429
- {(char *)"yyzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2477
- {(char *)"yyzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2989
- {(char *)"yyzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3501
- {(char *)"yyzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4013
- {(char *)"yyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 493
- {(char *)"yywx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2541
- {(char *)"yywy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3053
- {(char *)"yywz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3565
- {(char *)"yyww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4077
- {(char *)"yz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 53
- {(char *)"yzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 309
- {(char *)"yzxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2357
- {(char *)"yzxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2869
- {(char *)"yzxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3381
- {(char *)"yzxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3893
- {(char *)"yzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 373
- {(char *)"yzyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2421
- {(char *)"yzyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2933
- {(char *)"yzyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3445
- {(char *)"yzyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3957
- {(char *)"yzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 437
- {(char *)"yzzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2485
- {(char *)"yzzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2997
- {(char *)"yzzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3509
- {(char *)"yzzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4021
- {(char *)"yzw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 501
- {(char *)"yzwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2549
- {(char *)"yzwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3061
- {(char *)"yzwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3573
- {(char *)"yzww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4085
- {(char *)"yw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 61
- {(char *)"ywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 317
- {(char *)"ywxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2365
- {(char *)"ywxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2877
- {(char *)"ywxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3389
- {(char *)"ywxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3901
- {(char *)"ywy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 381
- {(char *)"ywyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2429
- {(char *)"ywyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2941
- {(char *)"ywyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3453
- {(char *)"ywyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3965
- {(char *)"ywz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 445
- {(char *)"ywzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2493
- {(char *)"ywzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3005
- {(char *)"ywzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3517
- {(char *)"ywzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4029
- {(char *)"yww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 509
- {(char *)"ywwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2557
- {(char *)"ywwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3069
- {(char *)"ywwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3581
- {(char *)"ywww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4093
- {(char *)"zx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 38
- {(char *)"zxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 294
- {(char *)"zxxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2342
- {(char *)"zxxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2854
- {(char *)"zxxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3366
- {(char *)"zxxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3878
- {(char *)"zxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 358
- {(char *)"zxyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2406
- {(char *)"zxyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2918
- {(char *)"zxyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3430
- {(char *)"zxyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3942
- {(char *)"zxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 422
- {(char *)"zxzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2470
- {(char *)"zxzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2982
- {(char *)"zxzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3494
- {(char *)"zxzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4006
- {(char *)"zxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 486
- {(char *)"zxwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2534
- {(char *)"zxwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3046
- {(char *)"zxwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3558
- {(char *)"zxww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4070
- {(char *)"zy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 46
- {(char *)"zyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 302
- {(char *)"zyxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2350
- {(char *)"zyxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2862
- {(char *)"zyxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3374
- {(char *)"zyxw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3886
- {(char *)"zyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 366
- {(char *)"zyyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2414
- {(char *)"zyyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2926
- {(char *)"zyyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3438
- {(char *)"zyyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3950
- {(char *)"zyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 430
- {(char *)"zyzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2478
- {(char *)"zyzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2990
- {(char *)"zyzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3502
- {(char *)"zyzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4014
- {(char *)"zyw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 494
- {(char *)"zywx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2542
- {(char *)"zywy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3054
- {(char *)"zywz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3566
- {(char *)"zyww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4078
- {(char *)"zz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 54
- {(char *)"zzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 310
- {(char *)"zzxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2358
- {(char *)"zzxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2870
- {(char *)"zzxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3382
- {(char *)"zzxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3894
- {(char *)"zzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 374
- {(char *)"zzyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2422
- {(char *)"zzyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2934
- {(char *)"zzyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3446
- {(char *)"zzyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3958
- {(char *)"zzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 438
- {(char *)"zzzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2486
- {(char *)"zzzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2998
- {(char *)"zzzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3510
- {(char *)"zzzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4022
- {(char *)"zzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 502
- {(char *)"zzwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2550
- {(char *)"zzwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3062
- {(char *)"zzwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3574
- {(char *)"zzww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4086
- {(char *)"zw", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 62
- {(char *)"zwx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 318
- {(char *)"zwxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2366
- {(char *)"zwxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2878
- {(char *)"zwxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3390
- {(char *)"zwxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3902
- {(char *)"zwy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 382
- {(char *)"zwyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2430
- {(char *)"zwyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2942
- {(char *)"zwyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3454
- {(char *)"zwyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3966
- {(char *)"zwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 446
- {(char *)"zwzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2494
- {(char *)"zwzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3006
- {(char *)"zwzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3518
- {(char *)"zwzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4030
- {(char *)"zww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 510
- {(char *)"zwwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2558
- {(char *)"zwwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3070
- {(char *)"zwwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3582
- {(char *)"zwww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4094
- {(char *)"wx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 39
- {(char *)"wxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 295
- {(char *)"wxxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2343
- {(char *)"wxxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2855
- {(char *)"wxxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3367
- {(char *)"wxxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3879
- {(char *)"wxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 359
- {(char *)"wxyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2407
- {(char *)"wxyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2919
- {(char *)"wxyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3431
- {(char *)"wxyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3943
- {(char *)"wxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 423
- {(char *)"wxzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2471
- {(char *)"wxzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2983
- {(char *)"wxzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3495
- {(char *)"wxzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4007
- {(char *)"wxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 487
- {(char *)"wxwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2535
- {(char *)"wxwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3047
- {(char *)"wxwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3559
- {(char *)"wxww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4071
- {(char *)"wy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 47
- {(char *)"wyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 303
- {(char *)"wyxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2351
- {(char *)"wyxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2863
- {(char *)"wyxz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3375
- {(char *)"wyxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3887
- {(char *)"wyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 367
- {(char *)"wyyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2415
- {(char *)"wyyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2927
- {(char *)"wyyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3439
- {(char *)"wyyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3951
- {(char *)"wyz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 431
- {(char *)"wyzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2479
- {(char *)"wyzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2991
- {(char *)"wyzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3503
- {(char *)"wyzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4015
- {(char *)"wyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 495
- {(char *)"wywx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2543
- {(char *)"wywy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3055
- {(char *)"wywz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3567
- {(char *)"wyww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4079
- {(char *)"wz", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 55
- {(char *)"wzx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 311
- {(char *)"wzxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2359
- {(char *)"wzxy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2871
- {(char *)"wzxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3383
- {(char *)"wzxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3895
- {(char *)"wzy", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 375
- {(char *)"wzyx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2423
- {(char *)"wzyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2935
- {(char *)"wzyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3447
- {(char *)"wzyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3959
- {(char *)"wzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 439
- {(char *)"wzzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2487
- {(char *)"wzzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2999
- {(char *)"wzzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3511
- {(char *)"wzzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4023
- {(char *)"wzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 503
- {(char *)"wzwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2551
- {(char *)"wzwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3063
- {(char *)"wzwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3575
- {(char *)"wzww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4087
- {(char *)"ww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 63
- {(char *)"wwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 319
- {(char *)"wwxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2367
- {(char *)"wwxy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2879
- {(char *)"wwxz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3391
- {(char *)"wwxw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3903
- {(char *)"wwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 383
- {(char *)"wwyx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2431
- {(char *)"wwyy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2943
- {(char *)"wwyz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3455
- {(char *)"wwyw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3967
- {(char *)"wwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 447
- {(char *)"wwzx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2495
- {(char *)"wwzy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3007
- {(char *)"wwzz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3519
- {(char *)"wwzw", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4031
- {(char *)"www", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 511
- {(char *)"wwwx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2559
- {(char *)"wwwy", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3071
- {(char *)"wwwz", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3583
- {(char *)"wwww", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4095
+ {(char *)"xx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 36
+ {(char *)"xxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 292
+ {(char *)"xxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2340
+ {(char *)"xxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2852
+ {(char *)"xxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3364
+ {(char *)"xxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3876
+ {(char *)"xxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 356
+ {(char *)"xxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2404
+ {(char *)"xxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2916
+ {(char *)"xxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3428
+ {(char *)"xxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3940
+ {(char *)"xxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 420
+ {(char *)"xxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2468
+ {(char *)"xxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2980
+ {(char *)"xxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3492
+ {(char *)"xxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4004
+ {(char *)"xxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 484
+ {(char *)"xxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2532
+ {(char *)"xxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3044
+ {(char *)"xxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3556
+ {(char *)"xxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4068
+ {(char *)"xy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 44
+ {(char *)"xyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 300
+ {(char *)"xyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2348
+ {(char *)"xyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2860
+ {(char *)"xyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3372
+ {(char *)"xyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3884
+ {(char *)"xyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 364
+ {(char *)"xyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2412
+ {(char *)"xyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2924
+ {(char *)"xyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3436
+ {(char *)"xyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3948
+ {(char *)"xyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 428
+ {(char *)"xyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2476
+ {(char *)"xyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2988
+ {(char *)"xyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3500
+ {(char *)"xyzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4012
+ {(char *)"xyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 492
+ {(char *)"xywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2540
+ {(char *)"xywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3052
+ {(char *)"xywz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3564
+ {(char *)"xyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4076
+ {(char *)"xz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 52
+ {(char *)"xzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 308
+ {(char *)"xzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2356
+ {(char *)"xzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2868
+ {(char *)"xzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3380
+ {(char *)"xzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3892
+ {(char *)"xzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 372
+ {(char *)"xzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2420
+ {(char *)"xzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2932
+ {(char *)"xzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3444
+ {(char *)"xzyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3956
+ {(char *)"xzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 436
+ {(char *)"xzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2484
+ {(char *)"xzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2996
+ {(char *)"xzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3508
+ {(char *)"xzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4020
+ {(char *)"xzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 500
+ {(char *)"xzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2548
+ {(char *)"xzwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3060
+ {(char *)"xzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3572
+ {(char *)"xzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4084
+ {(char *)"xw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 60
+ {(char *)"xwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 316
+ {(char *)"xwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2364
+ {(char *)"xwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2876
+ {(char *)"xwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3388
+ {(char *)"xwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3900
+ {(char *)"xwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 380
+ {(char *)"xwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2428
+ {(char *)"xwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2940
+ {(char *)"xwyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3452
+ {(char *)"xwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3964
+ {(char *)"xwz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 444
+ {(char *)"xwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2492
+ {(char *)"xwzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3004
+ {(char *)"xwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3516
+ {(char *)"xwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4028
+ {(char *)"xww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 508
+ {(char *)"xwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2556
+ {(char *)"xwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3068
+ {(char *)"xwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3580
+ {(char *)"xwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4092
+ {(char *)"yx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 37
+ {(char *)"yxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 293
+ {(char *)"yxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2341
+ {(char *)"yxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2853
+ {(char *)"yxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3365
+ {(char *)"yxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3877
+ {(char *)"yxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 357
+ {(char *)"yxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2405
+ {(char *)"yxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2917
+ {(char *)"yxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3429
+ {(char *)"yxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3941
+ {(char *)"yxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 421
+ {(char *)"yxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2469
+ {(char *)"yxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2981
+ {(char *)"yxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3493
+ {(char *)"yxzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4005
+ {(char *)"yxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 485
+ {(char *)"yxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2533
+ {(char *)"yxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3045
+ {(char *)"yxwz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3557
+ {(char *)"yxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4069
+ {(char *)"yy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 45
+ {(char *)"yyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 301
+ {(char *)"yyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2349
+ {(char *)"yyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2861
+ {(char *)"yyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3373
+ {(char *)"yyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3885
+ {(char *)"yyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 365
+ {(char *)"yyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2413
+ {(char *)"yyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2925
+ {(char *)"yyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3437
+ {(char *)"yyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3949
+ {(char *)"yyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 429
+ {(char *)"yyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2477
+ {(char *)"yyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2989
+ {(char *)"yyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3501
+ {(char *)"yyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4013
+ {(char *)"yyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 493
+ {(char *)"yywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2541
+ {(char *)"yywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3053
+ {(char *)"yywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3565
+ {(char *)"yyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4077
+ {(char *)"yz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 53
+ {(char *)"yzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 309
+ {(char *)"yzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2357
+ {(char *)"yzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2869
+ {(char *)"yzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3381
+ {(char *)"yzxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3893
+ {(char *)"yzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 373
+ {(char *)"yzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2421
+ {(char *)"yzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2933
+ {(char *)"yzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3445
+ {(char *)"yzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3957
+ {(char *)"yzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 437
+ {(char *)"yzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2485
+ {(char *)"yzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2997
+ {(char *)"yzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3509
+ {(char *)"yzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4021
+ {(char *)"yzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 501
+ {(char *)"yzwx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2549
+ {(char *)"yzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3061
+ {(char *)"yzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3573
+ {(char *)"yzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4085
+ {(char *)"yw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 61
+ {(char *)"ywx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 317
+ {(char *)"ywxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2365
+ {(char *)"ywxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2877
+ {(char *)"ywxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3389
+ {(char *)"ywxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3901
+ {(char *)"ywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 381
+ {(char *)"ywyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2429
+ {(char *)"ywyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2941
+ {(char *)"ywyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3453
+ {(char *)"ywyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3965
+ {(char *)"ywz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 445
+ {(char *)"ywzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2493
+ {(char *)"ywzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3005
+ {(char *)"ywzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3517
+ {(char *)"ywzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4029
+ {(char *)"yww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 509
+ {(char *)"ywwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2557
+ {(char *)"ywwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3069
+ {(char *)"ywwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3581
+ {(char *)"ywww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4093
+ {(char *)"zx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 38
+ {(char *)"zxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 294
+ {(char *)"zxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2342
+ {(char *)"zxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2854
+ {(char *)"zxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3366
+ {(char *)"zxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3878
+ {(char *)"zxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 358
+ {(char *)"zxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2406
+ {(char *)"zxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2918
+ {(char *)"zxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3430
+ {(char *)"zxyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3942
+ {(char *)"zxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 422
+ {(char *)"zxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2470
+ {(char *)"zxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2982
+ {(char *)"zxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3494
+ {(char *)"zxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4006
+ {(char *)"zxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 486
+ {(char *)"zxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2534
+ {(char *)"zxwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3046
+ {(char *)"zxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3558
+ {(char *)"zxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4070
+ {(char *)"zy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 46
+ {(char *)"zyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 302
+ {(char *)"zyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2350
+ {(char *)"zyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2862
+ {(char *)"zyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3374
+ {(char *)"zyxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3886
+ {(char *)"zyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 366
+ {(char *)"zyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2414
+ {(char *)"zyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2926
+ {(char *)"zyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3438
+ {(char *)"zyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3950
+ {(char *)"zyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 430
+ {(char *)"zyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2478
+ {(char *)"zyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2990
+ {(char *)"zyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3502
+ {(char *)"zyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4014
+ {(char *)"zyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 494
+ {(char *)"zywx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2542
+ {(char *)"zywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3054
+ {(char *)"zywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3566
+ {(char *)"zyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4078
+ {(char *)"zz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 54
+ {(char *)"zzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 310
+ {(char *)"zzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2358
+ {(char *)"zzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2870
+ {(char *)"zzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3382
+ {(char *)"zzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3894
+ {(char *)"zzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 374
+ {(char *)"zzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2422
+ {(char *)"zzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2934
+ {(char *)"zzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3446
+ {(char *)"zzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3958
+ {(char *)"zzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 438
+ {(char *)"zzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2486
+ {(char *)"zzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2998
+ {(char *)"zzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3510
+ {(char *)"zzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4022
+ {(char *)"zzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 502
+ {(char *)"zzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2550
+ {(char *)"zzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3062
+ {(char *)"zzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3574
+ {(char *)"zzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4086
+ {(char *)"zw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 62
+ {(char *)"zwx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 318
+ {(char *)"zwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2366
+ {(char *)"zwxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2878
+ {(char *)"zwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3390
+ {(char *)"zwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3902
+ {(char *)"zwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 382
+ {(char *)"zwyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2430
+ {(char *)"zwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2942
+ {(char *)"zwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3454
+ {(char *)"zwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3966
+ {(char *)"zwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 446
+ {(char *)"zwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2494
+ {(char *)"zwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3006
+ {(char *)"zwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3518
+ {(char *)"zwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4030
+ {(char *)"zww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 510
+ {(char *)"zwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2558
+ {(char *)"zwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3070
+ {(char *)"zwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3582
+ {(char *)"zwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4094
+ {(char *)"wx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 39
+ {(char *)"wxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 295
+ {(char *)"wxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2343
+ {(char *)"wxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2855
+ {(char *)"wxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3367
+ {(char *)"wxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3879
+ {(char *)"wxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 359
+ {(char *)"wxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2407
+ {(char *)"wxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2919
+ {(char *)"wxyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3431
+ {(char *)"wxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3943
+ {(char *)"wxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 423
+ {(char *)"wxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2471
+ {(char *)"wxzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2983
+ {(char *)"wxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3495
+ {(char *)"wxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4007
+ {(char *)"wxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 487
+ {(char *)"wxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2535
+ {(char *)"wxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3047
+ {(char *)"wxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3559
+ {(char *)"wxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4071
+ {(char *)"wy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 47
+ {(char *)"wyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 303
+ {(char *)"wyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2351
+ {(char *)"wyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2863
+ {(char *)"wyxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3375
+ {(char *)"wyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3887
+ {(char *)"wyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 367
+ {(char *)"wyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2415
+ {(char *)"wyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2927
+ {(char *)"wyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3439
+ {(char *)"wyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3951
+ {(char *)"wyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 431
+ {(char *)"wyzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2479
+ {(char *)"wyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2991
+ {(char *)"wyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3503
+ {(char *)"wyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4015
+ {(char *)"wyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 495
+ {(char *)"wywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2543
+ {(char *)"wywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3055
+ {(char *)"wywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3567
+ {(char *)"wyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4079
+ {(char *)"wz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 55
+ {(char *)"wzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 311
+ {(char *)"wzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2359
+ {(char *)"wzxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2871
+ {(char *)"wzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3383
+ {(char *)"wzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3895
+ {(char *)"wzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 375
+ {(char *)"wzyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2423
+ {(char *)"wzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2935
+ {(char *)"wzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3447
+ {(char *)"wzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3959
+ {(char *)"wzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 439
+ {(char *)"wzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2487
+ {(char *)"wzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2999
+ {(char *)"wzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3511
+ {(char *)"wzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4023
+ {(char *)"wzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 503
+ {(char *)"wzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2551
+ {(char *)"wzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3063
+ {(char *)"wzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3575
+ {(char *)"wzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4087
+ {(char *)"ww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 63
+ {(char *)"wwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 319
+ {(char *)"wwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2367
+ {(char *)"wwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2879
+ {(char *)"wwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3391
+ {(char *)"wwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3903
+ {(char *)"wwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 383
+ {(char *)"wwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2431
+ {(char *)"wwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2943
+ {(char *)"wwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3455
+ {(char *)"wwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3967
+ {(char *)"wwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 447
+ {(char *)"wwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2495
+ {(char *)"wwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3007
+ {(char *)"wwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3519
+ {(char *)"wwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4031
+ {(char *)"www", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 511
+ {(char *)"wwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 2559
+ {(char *)"wwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3071
+ {(char *)"wwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 3583
+ {(char *)"wwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) )}, // 4095
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -2154,15 +2594,15 @@ while len(axises) >= 2:
axis_0_pos = axis_pos[axis_0]
for axis_1 in axises:
axis_1_pos = axis_pos[axis_1]
- axis_dict[axis_0+axis_1] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS))' % (axis_0_pos, axis_1_pos)
+ axis_dict[axis_0 + axis_1] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS))' % (axis_0_pos, axis_1_pos)
if len(axises)>2:
for axis_2 in axises:
axis_2_pos = axis_pos[axis_2]
- axis_dict[axis_0+axis_1+axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
+ axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
if len(axises)>3:
for axis_3 in axises:
axis_3_pos = axis_pos[axis_3]
- axis_dict[axis_0+axis_1+axis_2+axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
+ axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
axises = axises[:-1]
@@ -2182,26 +2622,25 @@ 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!!!! */
-static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
+static int row_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
{
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->col_size != vec_size) {
- if (mat->col_size == 4 && vec_size != 3) {
+ if (mat->num_row != vec_size) {
+ 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)
@@ -2209,14 +2648,14 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
memcpy(vec_cpy, vec->vec, vec_size * sizeof(float));
- rvec[3] = 1.0f;
+ r_vec[3] = 1.0f;
//muliplication
- for (x = 0; x < mat->row_size; x++) {
- for (y = 0; y < mat->col_size; y++) {
- dot += mat->matrix[x][y] * vec_cpy[y];
+ for (col = 0; col < mat->num_col; col++) {
+ double dot = 0.0;
+ for (row = 0; row < mat->num_row; row++) {
+ dot += MATRIX_ITEM(mat, row, col) * vec_cpy[row];
}
- rvec[z++] = (float)dot;
- dot = 0.0f;
+ r_vec[z++] = (float)dot;
}
return 0;
}
@@ -2242,6 +2681,12 @@ static PyObject *Vector_negate(VectorObject *self)
}
static struct PyMethodDef Vector_methods[] = {
+ /* Class Methods */
+ {"Fill", (PyCFunction) C_Vector_Fill, METH_VARARGS | METH_CLASS, C_Vector_Fill_doc},
+ {"Range", (PyCFunction) C_Vector_Range, METH_VARARGS | METH_CLASS, C_Vector_Range_doc},
+ {"Linspace", (PyCFunction) C_Vector_Linspace, METH_VARARGS | METH_CLASS, C_Vector_Linspace_doc},
+ {"Repeat", (PyCFunction) C_Vector_Repeat, METH_VARARGS | METH_CLASS, C_Vector_Repeat_doc},
+
/* in place only */
{"zero", (PyCFunction) Vector_zero, METH_NOARGS, Vector_zero_doc},
{"negate", (PyCFunction) Vector_negate, METH_NOARGS, Vector_negate_doc},
@@ -2250,6 +2695,8 @@ static struct PyMethodDef Vector_methods[] = {
{"normalize", (PyCFunction) Vector_normalize, METH_NOARGS, Vector_normalize_doc},
{"normalized", (PyCFunction) Vector_normalized, METH_NOARGS, Vector_normalized_doc},
+ {"resize", (PyCFunction) Vector_resize, METH_O, Vector_resize_doc},
+ {"resized", (PyCFunction) Vector_resized, METH_O, Vector_resized_doc},
{"to_2d", (PyCFunction) Vector_to_2d, METH_NOARGS, Vector_to_2d_doc},
{"resize_2d", (PyCFunction) Vector_resize_2d, METH_NOARGS, Vector_resize_2d_doc},
{"to_3d", (PyCFunction) Vector_to_3d, METH_NOARGS, Vector_to_3d_doc},
@@ -2310,7 +2757,7 @@ PyTypeObject vector_Type = {
NULL, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
+ (reprfunc)Vector_str, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
NULL, /* setattrofunc tp_setattro; */
@@ -2375,28 +2822,28 @@ PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTy
{
VectorObject *self;
- if (size > 4 || size < 2) {
+ if (size < 2) {
PyErr_SetString(PyExc_RuntimeError,
"Vector(): invalid size");
return NULL;
}
- self= base_type ? (VectorObject *)base_type->tp_alloc(base_type, 0) :
- (VectorObject *)PyObject_GC_New(VectorObject, &vector_Type);
+ self = base_type ? (VectorObject *)base_type->tp_alloc(base_type, 0) :
+ (VectorObject *)PyObject_GC_New(VectorObject, &vector_Type);
if (self) {
self->size = size;
/* init callbacks as NULL */
- self->cb_user= NULL;
- self->cb_type= self->cb_subtype= 0;
+ self->cb_user = NULL;
+ self->cb_type = self->cb_subtype = 0;
if (type == Py_WRAP) {
self->vec = vec;
self->wrapped = Py_WRAP;
}
else if (type == Py_NEW) {
- self->vec= PyMem_Malloc(size * sizeof(float));
+ self->vec = PyMem_Malloc(size * sizeof(float));
if (vec) {
memcpy(self->vec, vec, size * sizeof(float));
}
@@ -2418,14 +2865,23 @@ PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTy
PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype)
{
float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */
- VectorObject *self= (VectorObject *)Vector_CreatePyObject(dummy, size, Py_NEW, NULL);
+ VectorObject *self = (VectorObject *)Vector_CreatePyObject(dummy, size, Py_NEW, NULL);
if (self) {
Py_INCREF(cb_user);
- self->cb_user= cb_user;
- self->cb_type= (unsigned char)cb_type;
- self->cb_subtype= (unsigned char)cb_subtype;
+ self->cb_user = cb_user;
+ self->cb_type = (unsigned char)cb_type;
+ self->cb_subtype = (unsigned char)cb_subtype;
PyObject_GC_Track(self);
}
return (PyObject *)self;
}
+
+PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type)
+{
+ VectorObject *vect_ob;
+ vect_ob = (VectorObject *)Vector_CreatePyObject(vec, size, Py_WRAP, base_type);
+ vect_ob->wrapped = Py_NEW;
+
+ return (PyObject *)vect_ob;
+}
diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h
index 0f7fa174d18..4e10e795602 100644
--- a/source/blender/python/mathutils/mathutils_Vector.h
+++ b/source/blender/python/mathutils/mathutils_Vector.h
@@ -41,11 +41,12 @@ extern PyTypeObject vector_Type;
typedef struct {
BASE_MATH_MEMBERS(vec);
- unsigned char size; /* vec size 2,3 or 4 */
+ int size; /* vec size 2,3 or 4 */
} VectorObject;
/*prototypes*/
PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type);
PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, int callback_type, int subtype);
+PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type);
#endif /* MATHUTILS_VECTOR_H */
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index d3b6e2e8b29..b4f3f4e470e 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -47,7 +47,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#define SWAP_FLOAT(a, b, tmp) tmp=a; a=b; b=tmp
+#define SWAP_FLOAT(a, b, tmp) tmp = a; a = b; b = tmp
/*-------------------------DOC STRINGS ---------------------------*/
PyDoc_STRVAR(M_Geometry_doc,
@@ -76,12 +76,12 @@ PyDoc_STRVAR(M_Geometry_intersect_ray_tri_doc,
" :return: The point of intersection or None if no intersection is found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
);
-static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *ray, *ray_off, *vec1, *vec2, *vec3;
float dir[3], orig[3], v1[3], v2[3], v3[3], e1[3], e2[3], pvec[3], tvec[3], qvec[3];
float det, inv_det, u, v, t;
- int clip= 1;
+ int clip = 1;
if (!PyArg_ParseTuple(args,
"O!O!O!O!O!|i:intersect_ray_tri",
@@ -99,11 +99,11 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1 ||
- BaseMath_ReadCallback(ray) == -1 ||
- BaseMath_ReadCallback(ray_off) == -1)
+ if ( BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1 ||
+ BaseMath_ReadCallback(ray) == -1 ||
+ BaseMath_ReadCallback(ray_off) == -1)
{
return NULL;
}
@@ -125,19 +125,19 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
cross_v3_v3v3(pvec, dir, e2);
/* if determinant is near zero, ray lies in plane of triangle */
- det= dot_v3v3(e1, pvec);
+ det = dot_v3v3(e1, pvec);
if (det > -0.000001f && det < 0.000001f) {
Py_RETURN_NONE;
}
- inv_det= 1.0f / det;
+ inv_det = 1.0f / det;
/* calculate distance from v1 to ray origin */
sub_v3_v3v3(tvec, orig, v1);
/* calculate U parameter and test bounds */
- u= dot_v3v3(tvec, pvec) * inv_det;
+ u = dot_v3v3(tvec, pvec) * inv_det;
if (clip && (u < 0.0f || u > 1.0f)) {
Py_RETURN_NONE;
}
@@ -146,14 +146,14 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
cross_v3_v3v3(qvec, tvec, e1);
/* calculate V parameter and test bounds */
- v= dot_v3v3(dir, qvec) * inv_det;
+ v = dot_v3v3(dir, qvec) * inv_det;
if (clip && (v < 0.0f || u + v > 1.0f)) {
Py_RETURN_NONE;
}
/* calculate t, ray intersects triangle */
- t= dot_v3v3(e2, qvec) * inv_det;
+ t = dot_v3v3(e2, qvec) * inv_det;
mul_v3_fl(dir, t);
add_v3_v3v3(pvec, orig, dir);
@@ -199,10 +199,10 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1 ||
- BaseMath_ReadCallback(vec4) == -1)
+ if ( BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1 ||
+ BaseMath_ReadCallback(vec4) == -1)
{
return NULL;
}
@@ -217,31 +217,31 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
copy_v3_v3(v4, vec4->vec);
}
else {
- v1[0]= vec1->vec[0];
- v1[1]= vec1->vec[1];
- v1[2]= 0.0f;
+ v1[0] = vec1->vec[0];
+ v1[1] = vec1->vec[1];
+ v1[2] = 0.0f;
- v2[0]= vec2->vec[0];
- v2[1]= vec2->vec[1];
- v2[2]= 0.0f;
+ v2[0] = vec2->vec[0];
+ v2[1] = vec2->vec[1];
+ v2[2] = 0.0f;
- v3[0]= vec3->vec[0];
- v3[1]= vec3->vec[1];
- v3[2]= 0.0f;
+ v3[0] = vec3->vec[0];
+ v3[1] = vec3->vec[1];
+ v3[2] = 0.0f;
- v4[0]= vec4->vec[0];
- v4[1]= vec4->vec[1];
- v4[2]= 0.0f;
+ v4[0] = vec4->vec[0];
+ v4[1] = vec4->vec[1];
+ v4[2] = 0.0f;
}
- result= isect_line_line_v3(v1, v2, v3, v4, i1, i2);
+ result = isect_line_line_v3(v1, v2, v3, v4, i1, i2);
if (result == 0) {
/* colinear */
Py_RETURN_NONE;
}
else {
- tuple= PyTuple_New(2);
+ tuple = PyTuple_New(2);
PyTuple_SET_ITEM(tuple, 0, Vector_CreatePyObject(i1, vec1->size, Py_NEW, NULL));
PyTuple_SET_ITEM(tuple, 1, Vector_CreatePyObject(i2, vec1->size, Py_NEW, NULL));
return tuple;
@@ -273,7 +273,7 @@ PyDoc_STRVAR(M_Geometry_normal_doc,
" :type v4: :class:`mathutils.Vector`\n"
" :rtype: :class:`mathutils.Vector`\n"
);
-static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *vec1, *vec2, *vec3, *vec4;
float n[3];
@@ -298,9 +298,9 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1)
+ if ( BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1)
{
return NULL;
}
@@ -327,10 +327,10 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1 ||
- BaseMath_ReadCallback(vec4) == -1)
+ if ( BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1 ||
+ BaseMath_ReadCallback(vec4) == -1)
{
return NULL;
}
@@ -356,7 +356,7 @@ PyDoc_STRVAR(M_Geometry_area_tri_doc,
" :type v3: :class:`mathutils.Vector`\n"
" :rtype: float\n"
);
-static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *vec1, *vec2, *vec3;
@@ -374,9 +374,9 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args)
return NULL;
}
- if ( BaseMath_ReadCallback(vec1) == -1 ||
- BaseMath_ReadCallback(vec2) == -1 ||
- BaseMath_ReadCallback(vec3) == -1)
+ if ( BaseMath_ReadCallback(vec1) == -1 ||
+ BaseMath_ReadCallback(vec2) == -1 ||
+ BaseMath_ReadCallback(vec3) == -1)
{
return NULL;
}
@@ -411,7 +411,7 @@ PyDoc_STRVAR(M_Geometry_intersect_line_line_2d_doc,
" :return: The point of intersection or None when not found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
);
-static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *line_a1, *line_a2, *line_b1, *line_b2;
float vi[2];
@@ -424,10 +424,10 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
return NULL;
}
- if ( BaseMath_ReadCallback(line_a1) == -1 ||
- BaseMath_ReadCallback(line_a2) == -1 ||
- BaseMath_ReadCallback(line_b1) == -1 ||
- BaseMath_ReadCallback(line_b2) == -1)
+ if ( BaseMath_ReadCallback(line_a1) == -1 ||
+ BaseMath_ReadCallback(line_a2) == -1 ||
+ BaseMath_ReadCallback(line_b1) == -1 ||
+ BaseMath_ReadCallback(line_b2) == -1)
{
return NULL;
}
@@ -459,10 +459,10 @@ PyDoc_STRVAR(M_Geometry_intersect_line_plane_doc,
" :return: The point of intersection or None when not found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
);
-static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *line_a, *line_b, *plane_co, *plane_no;
- int no_flip= 0;
+ int no_flip = 0;
float isect[3];
if (!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane",
&vector_Type, &line_a,
@@ -474,10 +474,10 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
return NULL;
}
- if ( BaseMath_ReadCallback(line_a) == -1 ||
- BaseMath_ReadCallback(line_b) == -1 ||
- BaseMath_ReadCallback(plane_co) == -1 ||
- BaseMath_ReadCallback(plane_no) == -1)
+ if ( BaseMath_ReadCallback(line_a) == -1 ||
+ BaseMath_ReadCallback(line_b) == -1 ||
+ BaseMath_ReadCallback(plane_co) == -1 ||
+ BaseMath_ReadCallback(plane_no) == -1)
{
return NULL;
}
@@ -513,7 +513,7 @@ PyDoc_STRVAR(M_Geometry_intersect_plane_plane_doc,
" :return: The line of the intersection represented as a point and a vector\n"
" :rtype: tuple pair of :class:`mathutils.Vector`\n"
);
-static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObject *args)
{
PyObject *ret;
VectorObject *plane_a_co, *plane_a_no, *plane_b_co, *plane_b_no;
@@ -530,10 +530,10 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje
return NULL;
}
- if ( BaseMath_ReadCallback(plane_a_co) == -1 ||
- BaseMath_ReadCallback(plane_a_no) == -1 ||
- BaseMath_ReadCallback(plane_b_co) == -1 ||
- BaseMath_ReadCallback(plane_b_no) == -1)
+ if ( BaseMath_ReadCallback(plane_a_co) == -1 ||
+ BaseMath_ReadCallback(plane_a_no) == -1 ||
+ BaseMath_ReadCallback(plane_b_co) == -1 ||
+ BaseMath_ReadCallback(plane_b_no) == -1)
{
return NULL;
}
@@ -551,7 +551,7 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje
normalize_v3(isect_no);
- ret= PyTuple_New(2);
+ ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_co, 3, Py_NEW, NULL));
PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(isect_no, 3, Py_NEW, NULL));
return ret;
@@ -574,11 +574,11 @@ PyDoc_STRVAR(M_Geometry_intersect_line_sphere_doc,
" :return: The intersection points as a pair of vectors or None when there is no intersection\n"
" :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n"
);
-static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *line_a, *line_b, *sphere_co;
float sphere_radius;
- int clip= TRUE;
+ int clip = TRUE;
float isect_a[3];
float isect_b[3];
@@ -592,9 +592,9 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
return NULL;
}
- if ( BaseMath_ReadCallback(line_a) == -1 ||
- BaseMath_ReadCallback(line_b) == -1 ||
- BaseMath_ReadCallback(sphere_co) == -1)
+ if ( BaseMath_ReadCallback(line_a) == -1 ||
+ BaseMath_ReadCallback(line_b) == -1 ||
+ BaseMath_ReadCallback(sphere_co) == -1)
{
return NULL;
}
@@ -606,24 +606,24 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
return NULL;
}
else {
- short use_a= TRUE;
- short use_b= TRUE;
+ short use_a = TRUE;
+ short use_b = TRUE;
float lambda;
- PyObject *ret= PyTuple_New(2);
+ PyObject *ret = PyTuple_New(2);
- switch(isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
+ switch (isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
case 1:
- if (!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
- use_b= FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ use_b = FALSE;
break;
case 2:
- if (!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
- if (!(!clip || (((lambda= line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
break;
default:
- use_a= FALSE;
- use_b= FALSE;
+ use_a = FALSE;
+ use_b = FALSE;
}
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); }
@@ -654,11 +654,11 @@ PyDoc_STRVAR(M_Geometry_intersect_line_sphere_2d_doc,
" :return: The intersection points as a pair of vectors or None when there is no intersection\n"
" :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n"
);
-static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *line_a, *line_b, *sphere_co;
float sphere_radius;
- int clip= TRUE;
+ int clip = TRUE;
float isect_a[3];
float isect_b[3];
@@ -672,31 +672,31 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
return NULL;
}
- if ( BaseMath_ReadCallback(line_a) == -1 ||
- BaseMath_ReadCallback(line_b) == -1 ||
- BaseMath_ReadCallback(sphere_co) == -1)
+ if ( BaseMath_ReadCallback(line_a) == -1 ||
+ BaseMath_ReadCallback(line_b) == -1 ||
+ BaseMath_ReadCallback(sphere_co) == -1)
{
return NULL;
}
else {
- short use_a= TRUE;
- short use_b= TRUE;
+ short use_a = TRUE;
+ short use_b = TRUE;
float lambda;
- PyObject *ret= PyTuple_New(2);
+ PyObject *ret = PyTuple_New(2);
- switch(isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
+ switch (isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
case 1:
- if (!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
- use_b= FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ use_b = FALSE;
break;
case 2:
- if (!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
- if (!(!clip || (((lambda= line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+ if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
break;
default:
- use_a= FALSE;
- use_b= FALSE;
+ use_a = FALSE;
+ use_b = FALSE;
}
if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); }
@@ -722,7 +722,7 @@ PyDoc_STRVAR(M_Geometry_intersect_point_line_doc,
" :type line_p1: :class:`mathutils.Vector`\n"
" :rtype: (:class:`mathutils.Vector`, float)\n"
);
-static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *pt, *line_1, *line_2;
float pt_in[3], pt_out[3], l1[3], l2[3];
@@ -737,27 +737,27 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
return NULL;
}
- if ( BaseMath_ReadCallback(pt) == -1 ||
- BaseMath_ReadCallback(line_1) == -1 ||
- BaseMath_ReadCallback(line_2) == -1)
+ if ( BaseMath_ReadCallback(pt) == -1 ||
+ BaseMath_ReadCallback(line_1) == -1 ||
+ BaseMath_ReadCallback(line_2) == -1)
{
return NULL;
}
/* accept 2d verts */
- if (pt->size==3) { copy_v3_v3(pt_in, pt->vec);}
- else { pt_in[2]=0.0; copy_v2_v2(pt_in, pt->vec); }
+ if (pt->size == 3) { copy_v3_v3(pt_in, pt->vec);}
+ else { pt_in[2] = 0.0f; copy_v2_v2(pt_in, pt->vec); }
- if (line_1->size==3) { copy_v3_v3(l1, line_1->vec);}
- else { l1[2]=0.0; copy_v2_v2(l1, line_1->vec); }
+ if (line_1->size == 3) { copy_v3_v3(l1, line_1->vec);}
+ else { l1[2] = 0.0f; copy_v2_v2(l1, line_1->vec); }
- if (line_2->size==3) { copy_v3_v3(l2, line_2->vec);}
- else { l2[2]=0.0; copy_v2_v2(l2, line_2->vec); }
+ if (line_2->size == 3) { copy_v3_v3(l2, line_2->vec);}
+ else { l2[2] = 0.0f; copy_v2_v2(l2, line_2->vec); }
/* do the calculation */
- lambda= closest_to_line_v3(pt_out, pt_in, l1, l2);
+ lambda = closest_to_line_v3(pt_out, pt_in, l1, l2);
- ret= PyTuple_New(2);
+ ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(pt_out, 3, Py_NEW, NULL));
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(lambda));
return ret;
@@ -778,7 +778,7 @@ PyDoc_STRVAR(M_Geometry_intersect_point_tri_2d_doc,
" :type tri_p3: :class:`mathutils.Vector`\n"
" :rtype: int\n"
);
-static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
@@ -791,10 +791,10 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj
return NULL;
}
- if ( BaseMath_ReadCallback(pt_vec) == -1 ||
- BaseMath_ReadCallback(tri_p1) == -1 ||
- BaseMath_ReadCallback(tri_p2) == -1 ||
- BaseMath_ReadCallback(tri_p3) == -1)
+ if ( BaseMath_ReadCallback(pt_vec) == -1 ||
+ BaseMath_ReadCallback(tri_p1) == -1 ||
+ BaseMath_ReadCallback(tri_p2) == -1 ||
+ BaseMath_ReadCallback(tri_p3) == -1)
{
return NULL;
}
@@ -820,7 +820,7 @@ PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc,
" :type quad_p4: :class:`mathutils.Vector`\n"
" :rtype: int\n"
);
-static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
@@ -834,11 +834,11 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb
return NULL;
}
- if ( BaseMath_ReadCallback(pt_vec) == -1 ||
- BaseMath_ReadCallback(quad_p1) == -1 ||
- BaseMath_ReadCallback(quad_p2) == -1 ||
- BaseMath_ReadCallback(quad_p3) == -1 ||
- BaseMath_ReadCallback(quad_p4) == -1)
+ if ( BaseMath_ReadCallback(pt_vec) == -1 ||
+ BaseMath_ReadCallback(quad_p1) == -1 ||
+ BaseMath_ReadCallback(quad_p2) == -1 ||
+ BaseMath_ReadCallback(quad_p3) == -1 ||
+ BaseMath_ReadCallback(quad_p4) == -1)
{
return NULL;
}
@@ -860,7 +860,7 @@ PyDoc_STRVAR(M_Geometry_distance_point_to_plane_doc,
" :type plane_no: :class:`mathutils.Vector`\n"
" :rtype: float\n"
);
-static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *pt, *plene_co, *plane_no;
@@ -872,9 +872,9 @@ static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyOb
return NULL;
}
- if ( BaseMath_ReadCallback(pt) == -1 ||
- BaseMath_ReadCallback(plene_co) == -1 ||
- BaseMath_ReadCallback(plane_no) == -1)
+ if ( BaseMath_ReadCallback(pt) == -1 ||
+ BaseMath_ReadCallback(plene_co) == -1 ||
+ BaseMath_ReadCallback(plane_no) == -1)
{
return NULL;
}
@@ -963,7 +963,7 @@ PyDoc_STRVAR(M_Geometry_interpolate_bezier_doc,
" :return: The interpolated points\n"
" :rtype: list of :class:`mathutils.Vector`'s\n"
);
-static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2;
int resolu;
@@ -972,10 +972,10 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
float *coord_array, *fp;
PyObject *list;
- float k1[4]= {0.0, 0.0, 0.0, 0.0};
- float h1[4]= {0.0, 0.0, 0.0, 0.0};
- float k2[4]= {0.0, 0.0, 0.0, 0.0};
- float h2[4]= {0.0, 0.0, 0.0, 0.0};
+ float k1[4] = {0.0, 0.0, 0.0, 0.0};
+ float h1[4] = {0.0, 0.0, 0.0, 0.0};
+ float k2[4] = {0.0, 0.0, 0.0, 0.0};
+ float h2[4] = {0.0, 0.0, 0.0, 0.0};
if (!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier",
@@ -993,29 +993,29 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
return NULL;
}
- if ( BaseMath_ReadCallback(vec_k1) == -1 ||
- BaseMath_ReadCallback(vec_h1) == -1 ||
- BaseMath_ReadCallback(vec_k2) == -1 ||
- BaseMath_ReadCallback(vec_h2) == -1)
+ if ( BaseMath_ReadCallback(vec_k1) == -1 ||
+ BaseMath_ReadCallback(vec_h1) == -1 ||
+ BaseMath_ReadCallback(vec_k2) == -1 ||
+ BaseMath_ReadCallback(vec_h2) == -1)
{
return NULL;
}
- dims= MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size);
+ dims = MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size);
- for (i=0; i < vec_k1->size; i++) k1[i]= vec_k1->vec[i];
- for (i=0; i < vec_h1->size; i++) h1[i]= vec_h1->vec[i];
- for (i=0; i < vec_k2->size; i++) k2[i]= vec_k2->vec[i];
- for (i=0; i < vec_h2->size; i++) h2[i]= vec_h2->vec[i];
+ for (i = 0; i < vec_k1->size; i++) k1[i] = vec_k1->vec[i];
+ for (i = 0; i < vec_h1->size; i++) h1[i] = vec_h1->vec[i];
+ for (i = 0; i < vec_k2->size; i++) k2[i] = vec_k2->vec[i];
+ for (i = 0; i < vec_h2->size; i++) h2[i] = vec_h2->vec[i];
- coord_array= MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier");
- for (i=0; i<dims; i++) {
- forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array+i, resolu-1, sizeof(float)*dims);
+ coord_array = MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier");
+ for (i = 0; i < dims; i++) {
+ forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array + i, resolu - 1, sizeof(float)*dims);
}
- list= PyList_New(resolu);
- fp= coord_array;
- for (i=0; i<resolu; i++, fp= fp+dims) {
+ list = PyList_New(resolu);
+ fp = coord_array;
+ for (i = 0; i < resolu; i++, fp = fp + dims) {
PyList_SET_ITEM(list, i, Vector_CreatePyObject(fp, dims, Py_NEW, NULL));
}
MEM_freeN(coord_array);
@@ -1036,13 +1036,13 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
{
PyObject *tri_list; /*return this list of tri's */
PyObject *polyLine, *polyVec;
- int i, len_polylines, len_polypoints, ls_error= 0;
+ int i, len_polylines, len_polypoints, ls_error = 0;
/* display listbase */
- ListBase dispbase={NULL, NULL};
+ ListBase dispbase = {NULL, NULL};
DispList *dl;
float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */
- int index, *dl_face, totpoints=0;
+ int index, *dl_face, totpoints = 0;
if (!PySequence_Check(polyLineSeq)) {
PyErr_SetString(PyExc_TypeError,
@@ -1050,10 +1050,10 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
return NULL;
}
- len_polylines= PySequence_Size(polyLineSeq);
+ len_polylines = PySequence_Size(polyLineSeq);
- for (i= 0; i < len_polylines; ++i) {
- polyLine= PySequence_GetItem(polyLineSeq, i);
+ for (i = 0; i < len_polylines; i++) {
+ polyLine = PySequence_GetItem(polyLineSeq, i);
if (!PySequence_Check(polyLine)) {
freedisplist(&dispbase);
Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/
@@ -1062,8 +1062,8 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
return NULL;
}
- len_polypoints= PySequence_Size(polyLine);
- if (len_polypoints>0) { /* dont bother adding edges as polylines */
+ len_polypoints = PySequence_Size(polyLine);
+ if (len_polypoints > 0) { /* dont bother adding edges as polylines */
#if 0
if (EXPP_check_sequence_consistency(polyLine, &vector_Type) != 1) {
freedisplist(&dispbase);
@@ -1073,32 +1073,32 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
return NULL;
}
#endif
- dl= MEM_callocN(sizeof(DispList), "poly disp");
+ dl = MEM_callocN(sizeof(DispList), "poly disp");
BLI_addtail(&dispbase, dl);
- dl->type= DL_INDEX3;
- dl->nr= len_polypoints;
- dl->type= DL_POLY;
- dl->parts= 1; /* no faces, 1 edge loop */
- dl->col= 0; /* no material */
- dl->verts= fp= MEM_callocN(sizeof(float)*3*len_polypoints, "dl verts");
- dl->index= MEM_callocN(sizeof(int)*3*len_polypoints, "dl index");
-
- for (index= 0; index<len_polypoints; ++index, fp+=3) {
- polyVec= PySequence_GetItem(polyLine, index);
+ dl->type = DL_INDEX3;
+ dl->nr = len_polypoints;
+ dl->type = DL_POLY;
+ dl->parts = 1; /* no faces, 1 edge loop */
+ dl->col = 0; /* no material */
+ dl->verts = fp = MEM_callocN(sizeof(float) * 3 * len_polypoints, "dl verts");
+ dl->index = MEM_callocN(sizeof(int) * 3 * len_polypoints, "dl index");
+
+ for (index = 0; index < len_polypoints; index++, fp += 3) {
+ polyVec = PySequence_GetItem(polyLine, index);
if (VectorObject_Check(polyVec)) {
if (BaseMath_ReadCallback((VectorObject *)polyVec) == -1)
- ls_error= 1;
+ ls_error = 1;
- fp[0]= ((VectorObject *)polyVec)->vec[0];
- fp[1]= ((VectorObject *)polyVec)->vec[1];
+ fp[0] = ((VectorObject *)polyVec)->vec[0];
+ fp[1] = ((VectorObject *)polyVec)->vec[1];
if (((VectorObject *)polyVec)->size > 2)
- fp[2]= ((VectorObject *)polyVec)->vec[2];
+ fp[2] = ((VectorObject *)polyVec)->vec[2];
else
- fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */
+ fp[2] = 0.0f; /* if its a 2d vector then set the z to be zero */
}
else {
- ls_error= 1;
+ ls_error = 1;
}
totpoints++;
@@ -1121,9 +1121,9 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
/* The faces are stored in a new DisplayList
thats added to the head of the listbase */
- dl= dispbase.first;
+ dl = dispbase.first;
- tri_list= PyList_New(dl->parts);
+ tri_list = PyList_New(dl->parts);
if (!tri_list) {
freedisplist(&dispbase);
PyErr_SetString(PyExc_RuntimeError,
@@ -1131,11 +1131,11 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
return NULL;
}
- index= 0;
- dl_face= dl->index;
+ index = 0;
+ dl_face = dl->index;
while (index < dl->parts) {
PyList_SET_ITEM(tri_list, index, Py_BuildValue("iii", dl_face[0], dl_face[1], dl_face[2]));
- dl_face+= 3;
+ dl_face += 3;
index++;
}
freedisplist(&dispbase);
@@ -1143,7 +1143,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
else {
/* no points, do this so scripts dont barf */
freedisplist(&dispbase); /* possible some dl was allocated */
- tri_list= PyList_New(0);
+ tri_list = PyList_New(0);
}
return tri_list;
@@ -1164,13 +1164,13 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
return -1;
}
- len= PyList_GET_SIZE(value);
+ len = PyList_GET_SIZE(value);
- (*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box");
+ *boxarray = MEM_mallocN(len * sizeof(boxPack), "boxPack box");
- for (i= 0; i < len; i++) {
- list_item= PyList_GET_ITEM(value, i);
+ for (i = 0; i < len; i++) {
+ list_item = PyList_GET_ITEM(value, i);
if (!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) {
MEM_freeN(*boxarray);
PyErr_SetString(PyExc_TypeError,
@@ -1178,14 +1178,14 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
return -1;
}
- box= (*boxarray)+i;
+ box = (*boxarray) + i;
- item_1= PyList_GET_ITEM(list_item, 2);
- item_2= PyList_GET_ITEM(list_item, 3);
+ item_1 = PyList_GET_ITEM(list_item, 2);
+ item_2 = PyList_GET_ITEM(list_item, 3);
- box->w= (float)PyFloat_AsDouble(item_1);
- box->h= (float)PyFloat_AsDouble(item_2);
- box->index= i;
+ box->w = (float)PyFloat_AsDouble(item_1);
+ box->h = (float)PyFloat_AsDouble(item_2);
+ box->index = i;
/* accounts for error case too and overwrites with own error */
if (box->w < 0.0f || box->h < 0.0f) {
@@ -1207,11 +1207,11 @@ static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
PyObject *list_item;
boxPack *box;
- len= PyList_GET_SIZE(value);
+ len = PyList_GET_SIZE(value);
- for (i= 0; i < len; i++) {
- box= (*boxarray)+i;
- list_item= PyList_GET_ITEM(value, box->index);
+ for (i = 0; i < len; i++) {
+ box = (*boxarray) + i;
+ list_item = PyList_GET_ITEM(value, box->index);
PyList_SET_ITEM(list_item, 0, PyFloat_FromDouble(box->x));
PyList_SET_ITEM(list_item, 1, PyFloat_FromDouble(box->y));
}
@@ -1230,7 +1230,7 @@ PyDoc_STRVAR(M_Geometry_box_pack_2d_doc,
);
static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
{
- float tot_width= 0.0f, tot_height= 0.0f;
+ float tot_width = 0.0f, tot_height = 0.0f;
Py_ssize_t len;
PyObject *ret;
@@ -1241,9 +1241,9 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
return NULL;
}
- len= PyList_GET_SIZE(boxlist);
+ len = PyList_GET_SIZE(boxlist);
if (len) {
- boxPack *boxarray= NULL;
+ boxPack *boxarray = NULL;
if (boxPack_FromPyObject(boxlist, &boxarray) == -1) {
return NULL; /* exception set */
}
@@ -1254,7 +1254,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
boxPack_ToPyObject(boxlist, &boxarray);
}
- ret= PyTuple_New(2);
+ ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(tot_width));
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(tot_width));
return ret;
@@ -1263,7 +1263,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
#endif /* MATH_STANDALONE */
-static PyMethodDef M_Geometry_methods[]= {
+static PyMethodDef M_Geometry_methods[] = {
{"intersect_ray_tri", (PyCFunction) M_Geometry_intersect_ray_tri, METH_VARARGS, M_Geometry_intersect_ray_tri_doc},
{"intersect_point_line", (PyCFunction) M_Geometry_intersect_point_line, METH_VARARGS, M_Geometry_intersect_point_line_doc},
{"intersect_point_tri_2d", (PyCFunction) M_Geometry_intersect_point_tri_2d, METH_VARARGS, M_Geometry_intersect_point_tri_2d_doc},
@@ -1286,7 +1286,7 @@ static PyMethodDef M_Geometry_methods[]= {
{NULL, NULL, 0, NULL}
};
-static struct PyModuleDef M_Geometry_module_def= {
+static struct PyModuleDef M_Geometry_module_def = {
PyModuleDef_HEAD_INIT,
"mathutils.geometry", /* m_name */
M_Geometry_doc, /* m_doc */
@@ -1301,6 +1301,6 @@ static struct PyModuleDef M_Geometry_module_def= {
/*----------------------------MODULE INIT-------------------------*/
PyMODINIT_FUNC PyInit_mathutils_geometry(void)
{
- PyObject *submodule= PyModule_Create(&M_Geometry_module_def);
+ PyObject *submodule = PyModule_Create(&M_Geometry_module_def);
return submodule;
}
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index 09337d9a23b..fceff965fcb 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -199,18 +199,18 @@ static float frand(void)
/* Fills an array of length size with random numbers in the range (-1, 1)*/
static void rand_vn(float *array_tar, const int size)
{
- float *array_pt= array_tar + (size-1);
- int i= size;
- while(i--) { *(array_pt--) = 2.0f * frand() - 1.0f; }
+ float *array_pt = array_tar + (size-1);
+ int i = size;
+ while (i--) { *(array_pt--) = 2.0f * frand() - 1.0f; }
}
/* Fills an array of length 3 with noise values */
static void noise_vector(float x, float y, float z, int nb, float v[3])
{
/* Simply evaluate noise at 3 different positions */
- v[0]= (float)(2.0f * BLI_gNoise(1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0, nb) - 1.0f);
- v[1]= (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f);
- v[2]= (float)(2.0f * BLI_gNoise(1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0, nb) - 1.0f);
+ v[0] = (float)(2.0f * BLI_gNoise(1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0, nb) - 1.0f);
+ v[1] = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f);
+ v[2] = (float)(2.0f * BLI_gNoise(1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0, nb) - 1.0f);
}
/* Returns a turbulence value for a given position (x, y, z) */
@@ -301,9 +301,9 @@ PyDoc_STRVAR(M_Noise_random_unit_vector_doc,
);
static PyObject *M_Noise_random_unit_vector(PyObject *UNUSED(self), PyObject *args)
{
- float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f};
- float norm= 2.0f;
- int size= 3;
+ float vec[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ float norm = 2.0f;
+ int size = 3;
if (!PyArg_ParseTuple(args, "|i:random_vector", &size))
return NULL;
@@ -313,9 +313,9 @@ static PyObject *M_Noise_random_unit_vector(PyObject *UNUSED(self), PyObject *ar
return NULL;
}
- while (norm==0.0f || norm>=1.0f) {
+ while (norm == 0.0f || norm >= 1.0f) {
rand_vn(vec, size);
- norm= normalize_vn(vec, size);
+ norm = normalize_vn(vec, size);
}
return Vector_CreatePyObject(vec, size, Py_NEW, NULL);
@@ -384,7 +384,7 @@ static PyObject *M_Noise_noise(PyObject *UNUSED(self), PyObject *args)
{
PyObject *value;
float vec[3];
- int nb= 1;
+ int nb = 1;
if (!PyArg_ParseTuple(args, "O|i:noise", &value, &nb))
return NULL;
@@ -410,7 +410,7 @@ static PyObject *M_Noise_noise_vector(PyObject *UNUSED(self), PyObject *args)
{
PyObject *value;
float vec[3], r_vec[3];
- int nb= 1;
+ int nb = 1;
if (!PyArg_ParseTuple(args, "O|i:noise_vector", &value, &nb))
return NULL;
@@ -447,8 +447,8 @@ static PyObject *M_Noise_turbulence(PyObject *UNUSED(self), PyObject *args)
{
PyObject *value;
float vec[3];
- int oct, hd, nb= 1;
- float as= 0.5f, fs= 2.0f;
+ int oct, hd, nb = 1;
+ float as = 0.5f, fs = 2.0f;
if (!PyArg_ParseTuple(args, "Oii|iff:turbulence", &value, &oct, &hd, &nb, &as, &fs))
return NULL;
@@ -483,8 +483,8 @@ static PyObject *M_Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *arg
{
PyObject *value;
float vec[3], r_vec[3];
- int oct, hd, nb= 1;
- float as =0.5f, fs= 2.0f;
+ int oct, hd, nb = 1;
+ float as =0.5f, fs = 2.0f;
if (!PyArg_ParseTuple(args, "Oii|iff:turbulence_vector", &value, &oct, &hd, &nb, &as, &fs))
return NULL;
@@ -519,7 +519,7 @@ static PyObject *M_Noise_fractal(PyObject *UNUSED(self), PyObject *args)
PyObject *value;
float vec[3];
float H, lac, oct;
- int nb= 1;
+ int nb = 1;
if (!PyArg_ParseTuple(args, "Offf|i:fractal", &value, &H, &lac, &oct, &nb))
return NULL;
@@ -553,7 +553,7 @@ static PyObject *M_Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args)
PyObject *value;
float vec[3];
float H, lac, oct;
- int nb= 1;
+ int nb = 1;
if (!PyArg_ParseTuple(args, "Offf|i:multi_fractal", &value, &H, &lac, &oct, &nb))
return NULL;
@@ -585,7 +585,7 @@ static PyObject *M_Noise_variable_lacunarity(PyObject *UNUSED(self), PyObject *a
PyObject *value;
float vec[3];
float d;
- int nt1= 1, nt2= 1;
+ int nt1 = 1, nt2 = 1;
if (!PyArg_ParseTuple(args, "Of|ii:variable_lacunarity", &value, &d, &nt1, &nt2))
return NULL;
@@ -621,7 +621,7 @@ static PyObject *M_Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args)
PyObject *value;
float vec[3];
float H, lac, oct, ofs;
- int nb= 1;
+ int nb = 1;
if (!PyArg_ParseTuple(args, "Offff|i:hetero_terrain", &value, &H, &lac, &oct, &ofs, &nb))
return NULL;
@@ -659,7 +659,7 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
PyObject *value;
float vec[3];
float H, lac, oct, ofs, gn;
- int nb= 1;
+ int nb = 1;
if (!PyArg_ParseTuple(args, "Offfff|i:hybrid_multi_fractal", &value, &H, &lac, &oct, &ofs, &gn, &nb))
return NULL;
@@ -697,7 +697,7 @@ static PyObject *M_Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *
PyObject *value;
float vec[3];
float H, lac, oct, ofs, gn;
- int nb= 1;
+ int nb = 1;
if (!PyArg_ParseTuple(args, "Offfff|i:ridged_multi_fractal", &value, &H, &lac, &oct, &ofs, &gn, &nb))
return NULL;
@@ -728,8 +728,8 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
PyObject *list;
float vec[3];
float da[4], pa[12];
- int dtype= 0;
- float me= 2.5f; /* default minkovsky exponent */
+ int dtype = 0;
+ float me = 2.5f; /* default minkovsky exponent */
int i;
@@ -739,12 +739,12 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
if (mathutils_array_parse(vec, 3, 3, value, "voronoi: invalid 'position' arg") == -1)
return NULL;
- list= PyList_New(4);
+ list = PyList_New(4);
voronoi(vec[0], vec[1], vec[2], da, pa, me, dtype);
- for (i=0; i<4; i++) {
- PyList_SET_ITEM(list, i, Vector_CreatePyObject(pa + 3*i, 3, Py_NEW, NULL));
+ for (i = 0; i < 4; i++) {
+ PyList_SET_ITEM(list, i, Vector_CreatePyObject(pa + 3 * i, 3, Py_NEW, NULL));
}
return Py_BuildValue("[[ffff]O]", da[0], da[1], da[2], da[3], list);
@@ -841,11 +841,11 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void)
/* use current time as seed for random number generator by default */
setRndSeed(0);
- PyModule_AddObject(submodule, "types", (item_types=PyInit_mathutils_noise_types()));
+ PyModule_AddObject(submodule, "types", (item_types = PyInit_mathutils_noise_types()));
PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.types", item_types);
Py_INCREF(item_types);
- PyModule_AddObject(submodule, "distance_metrics", (item_metrics=PyInit_mathutils_noise_metrics()));
+ PyModule_AddObject(submodule, "distance_metrics", (item_metrics = PyInit_mathutils_noise_metrics()));
PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.distance_metrics", item_metrics);
Py_INCREF(item_metrics);
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index 75c7d890ddd..b1fa00d3509 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -106,21 +106,26 @@ static struct QuicktimeExport *qtexport;
/* Video codec */
static QuicktimeCodecTypeDesc qtVideoCodecList[] = {
{kRawCodecType, 1, "Uncompressed"},
- {kJPEGCodecType, 2, "JPEG"},
- {kMotionJPEGACodecType, 3, "M-JPEG A"},
- {kMotionJPEGBCodecType, 4, "M-JPEG B"},
- {kDVCPALCodecType, 5, "DV PAL"},
- {kDVCNTSCCodecType, 6, "DV/DVCPRO NTSC"},
- {kDVCPROHD720pCodecType, 7, "DVCPRO HD 720p"},
- {kDVCPROHD1080i50CodecType, 8, "DVCPRO HD 1080i50"},
- {kDVCPROHD1080i60CodecType, 9, "DVCPRO HD 1080i60"},
- {kMPEG4VisualCodecType, 10, "MPEG4"},
- {kH263CodecType, 11, "H.263"},
- {kH264CodecType, 12, "H.264"},
- {kAnimationCodecType, 13, "Animation"},
+ {k422YpCbCr8CodecType, 2, "Uncompressed 8-bit 4:2:2"},
+ {k422YpCbCr10CodecType, 3, "Uncompressed 10-bit 4:2:2"},
+ {kComponentVideoCodecType, 4, "Component Video"},
+ {kPixletCodecType, 5, "Pixlet"},
+ {kPNGCodecType, 6, "PNG"},
+ {kJPEGCodecType, 7, "JPEG"},
+ {kMotionJPEGACodecType, 8, "M-JPEG A"},
+ {kMotionJPEGBCodecType, 9, "M-JPEG B"},
+ {kDVCPALCodecType, 10, "DV PAL"},
+ {kDVCNTSCCodecType, 11, "DV/DVCPRO NTSC"},
+ {kDVCPROHD720pCodecType, 12, "DVCPRO HD 720p"},
+ {kDVCPROHD1080i50CodecType, 13, "DVCPRO HD 1080i50"},
+ {kDVCPROHD1080i60CodecType, 14, "DVCPRO HD 1080i60"},
+ {kMPEG4VisualCodecType, 15, "MPEG4"},
+ {kH263CodecType, 16, "H.263"},
+ {kH264CodecType, 17, "H.264"},
+ {kAnimationCodecType, 18, "Animation"},
{0,0,NULL}};
-static int qtVideoCodecCount = 13;
+static int qtVideoCodecCount = 18;
int quicktime_get_num_videocodecs() {
return qtVideoCodecCount;
@@ -777,9 +782,9 @@ void end_qt(void)
void free_qtcomponentdata(void) {
}
-void quicktime_verify_image_type(RenderData *rd)
+void quicktime_verify_image_type(RenderData *rd, ImageFormatData *imf)
{
- if (rd->im_format.imtype == R_IMF_IMTYPE_QUICKTIME) {
+ if (imf->imtype == R_IMF_IMTYPE_QUICKTIME) {
if ((rd->qtcodecsettings.codecType<= 0) ||
(rd->qtcodecsettings.codecSpatialQuality <0) ||
(rd->qtcodecsettings.codecSpatialQuality > 100)) {
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index 937e1b6be46..5dfce9d3e80 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -687,9 +687,9 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
}
}
-void quicktime_verify_image_type(RenderData *rd)
+void quicktime_verify_image_type(RenderData *rd, ImageFormatData *imf)
{
- if (rd->im_format.imtype == R_IMF_IMTYPE_QUICKTIME) {
+ if (imf->imtype == R_IMF_IMTYPE_QUICKTIME) {
if ((rd->qtcodecsettings.codecType== 0) ||
(rd->qtcodecsettings.codecSpatialQuality <0) ||
(rd->qtcodecsettings.codecSpatialQuality > 100)) {
diff --git a/source/blender/quicktime/quicktime_export.h b/source/blender/quicktime/quicktime_export.h
index 517e0c8c0f6..f64521bda35 100644
--- a/source/blender/quicktime/quicktime_export.h
+++ b/source/blender/quicktime/quicktime_export.h
@@ -61,7 +61,7 @@ void end_qt(void);
void filepath_qt(char *string, struct RenderData *rd);
/*RNA helper functions */
-void quicktime_verify_image_type(struct RenderData *rd); //used by RNA for defaults values init, if needed
+void quicktime_verify_image_type(struct RenderData *rd, struct ImageFormatData *imf); //used by RNA for defaults values init, if needed
/*Video codec type*/
int quicktime_get_num_videocodecs(void);
QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue);
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 b09dbbde744..8dc37dc209f 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -593,7 +593,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");
@@ -681,8 +681,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;
@@ -702,11 +701,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)
@@ -1069,7 +1066,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;
@@ -3061,17 +3057,19 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
/* ------------------------------------------------------------------------- */
struct edgesort {
- int v1, v2;
+ unsigned int v1, v2;
int f;
- int i1, i2;
+ unsigned int i1, i2;
};
/* edges have to be added with lowest index first for sorting */
-static void to_edgesort(struct edgesort *ed, int i1, int i2, int v1, int v2, int f)
+static void to_edgesort(struct edgesort *ed,
+ unsigned int i1, unsigned int i2,
+ unsigned int v1, unsigned int v2, int f)
{
- if(v1>v2) {
- SWAP(int, v1, v2);
- SWAP(int, i1, i2);
+ if (v1 > v2) {
+ SWAP(unsigned int, v1, v2);
+ SWAP(unsigned int, i1, i2);
}
ed->v1= v1;
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 2b44bad82ab..dc2de5fb450 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -190,6 +190,11 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result)
if(!result)
return;
+
+ result->tilerect.xmin += re->disprect.xmin;
+ result->tilerect.xmax += re->disprect.xmin;
+ result->tilerect.ymin += re->disprect.ymin;
+ result->tilerect.ymax += re->disprect.ymin;
/* merge. on break, don't merge in result for preview renders, looks nicer */
if(!(re->test_break(re->tbh) && (re->r.scemode & R_PREVIEWBUTS)))
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/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 883684c3483..f9992050052 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -3083,6 +3083,12 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
continue;
}
break;
+ case TEXCO_EQUIRECTMAP:
+ tempvec[0]= atan2f(lo[0], lo[2]) / (float)M_PI;
+ tempvec[1]= 1.0f - 2.0f*saacos(lo[1]) / (float)M_PI;
+ tempvec[2]= 0.0f;
+ co= tempvec;
+ break;
case TEXCO_OBJECT:
if(mtex->object) {
copy_v3_v3(tempvec, lo);
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 9bc2529568f..900313182ce 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 4fc3bb7c5da..89f74418563 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;
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 1593f14a76c..43a691770c9 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -186,7 +186,7 @@ void wm_event_do_notifiers(bContext *C)
wmWindowManager *wm= CTX_wm_manager(C);
wmNotifier *note, *next;
wmWindow *win;
- unsigned int win_combine_v3d_datamask= 0;
+ uint64_t win_combine_v3d_datamask= 0;
if(wm==NULL)
return;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index b6f59418f0a..db8f9794c88 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -46,6 +46,7 @@
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
+#include "DNA_mesh_types.h" /* only for USE_MESH_FORWARDS_COMAT */
#include "BLF_translation.h"
@@ -2011,6 +2012,9 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory");
RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active");
+#ifdef USE_MESH_FORWARDS_COMAT
+ RNA_def_boolean(ot->srna, "use_mesh_compat", 0, "Legacy Mesh Format", "Save using legacy mesh format (no ngons)");
+#endif
}
/* *************** save file directly ******** */
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 24195c3f679..f90da4e3139 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -492,7 +492,6 @@ elseif(WIN32)
else()
install(
FILES
- ${LIBDIR}/png/lib/libpng.dll
${LIBDIR}/zlib/lib/zlib.dll
DESTINATION ${TARGETDIR}
)
@@ -534,7 +533,6 @@ elseif(WIN32)
install(
FILES
${LIBDIR}/openal/lib/OpenAL32.dll
- ${LIBDIR}/openal/lib/wrap_oal.dll
DESTINATION ${TARGETDIR}
)
endif()
@@ -778,11 +776,11 @@ endif()
bf_nodes
bf_gpu
bf_blenloader
+ bf_imbuf
bf_blenlib
bf_intern_ghost
bf_intern_string
bf_blenpluginapi
- bf_imbuf
bf_avi
bf_imbuf_cineon
bf_imbuf_openexr
diff --git a/source/creator/creator.c b/source/creator/creator.c
index f093de567dd..70624a692bf 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -303,7 +303,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
printf (" $BLENDER_USER_CONFIG Directory for user configuration files.\n");
printf (" $BLENDER_USER_SCRIPTS Directory for user scripts.\n");
printf (" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n");
- printf (" $BLENDER_USER_DAT`AFILES Directory for user data files (icons, translations, ..).\n");
+ printf (" $Directory for user data files (icons, translations, ..).\n");
printf (" $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n");
printf (" $BLENDER_SYSTEM_PYTHON Directory for system python libraries.\n");
#ifdef WIN32
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 360a082b03b..445f2b8f0ba 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -241,6 +241,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->SetUseFixedTime(usefixed);
ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS);
+ KX_KetsjiEngine::SetExitKey(ConvertKeyCode(startscene->gm.exitkey));
//set the global settings (carried over if restart/load new files)
ketsjiengine->SetGlobalSettings(&gs);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
index 1c91f498d32..93bf133635d 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
@@ -41,6 +41,7 @@
#include "wm_event_types.h"
#include "WM_types.h"
#include "SCA_IInputDevice.h"
+#include "BL_BlenderDataConversion.h"
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
@@ -51,172 +52,9 @@
*/
class BL_BlenderInputDevice : public SCA_IInputDevice
{
- // this map is Blender specific: a conversion between blender and ketsji enums
- std::map<int,KX_EnumInputs> m_reverseKeyTranslateTable;
public:
BL_BlenderInputDevice()
{
-
- /* The reverse table. In order to not confuse ourselves, we */
- /* immediately convert all events that come in to KX codes. */
- m_reverseKeyTranslateTable[LEFTMOUSE ] = KX_LEFTMOUSE;
- m_reverseKeyTranslateTable[MIDDLEMOUSE ] = KX_MIDDLEMOUSE;
- m_reverseKeyTranslateTable[RIGHTMOUSE ] = KX_RIGHTMOUSE;
- m_reverseKeyTranslateTable[WHEELUPMOUSE ] = KX_WHEELUPMOUSE;
- m_reverseKeyTranslateTable[WHEELDOWNMOUSE ] = KX_WHEELDOWNMOUSE;
- m_reverseKeyTranslateTable[MOUSEX ] = KX_MOUSEX;
- m_reverseKeyTranslateTable[MOUSEY ] = KX_MOUSEY;
-
- // TIMERS
-
- m_reverseKeyTranslateTable[TIMER0 ] = KX_TIMER0;
- m_reverseKeyTranslateTable[TIMER1 ] = KX_TIMER1;
- m_reverseKeyTranslateTable[TIMER2 ] = KX_TIMER2;
-
- // SYSTEM
-#if 0
- /* **** XXX **** */
- m_reverseKeyTranslateTable[KEYBD ] = KX_KEYBD;
- m_reverseKeyTranslateTable[RAWKEYBD ] = KX_RAWKEYBD;
- m_reverseKeyTranslateTable[REDRAW ] = KX_REDRAW;
- m_reverseKeyTranslateTable[INPUTCHANGE ] = KX_INPUTCHANGE;
- m_reverseKeyTranslateTable[QFULL ] = KX_QFULL;
- m_reverseKeyTranslateTable[WINFREEZE ] = KX_WINFREEZE;
- m_reverseKeyTranslateTable[WINTHAW ] = KX_WINTHAW;
- m_reverseKeyTranslateTable[WINCLOSE ] = KX_WINCLOSE;
- m_reverseKeyTranslateTable[WINQUIT ] = KX_WINQUIT;
- m_reverseKeyTranslateTable[Q_FIRSTTIME ] = KX_Q_FIRSTTIME;
- /* **** XXX **** */
-#endif
- // standard keyboard
-
- m_reverseKeyTranslateTable[AKEY ] = KX_AKEY;
- m_reverseKeyTranslateTable[BKEY ] = KX_BKEY;
- m_reverseKeyTranslateTable[CKEY ] = KX_CKEY;
- m_reverseKeyTranslateTable[DKEY ] = KX_DKEY;
- m_reverseKeyTranslateTable[EKEY ] = KX_EKEY;
- m_reverseKeyTranslateTable[FKEY ] = KX_FKEY;
- m_reverseKeyTranslateTable[GKEY ] = KX_GKEY;
- //XXX clean up
-#ifdef WIN32
-#define HKEY 'h'
-#endif
- m_reverseKeyTranslateTable[HKEY ] = KX_HKEY;
- //XXX clean up
-#ifdef WIN32
-#undef HKEY
-#endif
- m_reverseKeyTranslateTable[IKEY ] = KX_IKEY;
- m_reverseKeyTranslateTable[JKEY ] = KX_JKEY;
- m_reverseKeyTranslateTable[KKEY ] = KX_KKEY;
- m_reverseKeyTranslateTable[LKEY ] = KX_LKEY;
- m_reverseKeyTranslateTable[MKEY ] = KX_MKEY;
- m_reverseKeyTranslateTable[NKEY ] = KX_NKEY;
- m_reverseKeyTranslateTable[OKEY ] = KX_OKEY;
- m_reverseKeyTranslateTable[PKEY ] = KX_PKEY;
- m_reverseKeyTranslateTable[QKEY ] = KX_QKEY;
- m_reverseKeyTranslateTable[RKEY ] = KX_RKEY;
- m_reverseKeyTranslateTable[SKEY ] = KX_SKEY;
- m_reverseKeyTranslateTable[TKEY ] = KX_TKEY;
- m_reverseKeyTranslateTable[UKEY ] = KX_UKEY;
- m_reverseKeyTranslateTable[VKEY ] = KX_VKEY;
- m_reverseKeyTranslateTable[WKEY ] = KX_WKEY;
- m_reverseKeyTranslateTable[XKEY ] = KX_XKEY;
- m_reverseKeyTranslateTable[YKEY ] = KX_YKEY;
- m_reverseKeyTranslateTable[ZKEY ] = KX_ZKEY;
-
- m_reverseKeyTranslateTable[ZEROKEY ] = KX_ZEROKEY;
- m_reverseKeyTranslateTable[ONEKEY ] = KX_ONEKEY;
- m_reverseKeyTranslateTable[TWOKEY ] = KX_TWOKEY;
- m_reverseKeyTranslateTable[THREEKEY ] = KX_THREEKEY;
- m_reverseKeyTranslateTable[FOURKEY ] = KX_FOURKEY;
- m_reverseKeyTranslateTable[FIVEKEY ] = KX_FIVEKEY;
- m_reverseKeyTranslateTable[SIXKEY ] = KX_SIXKEY;
- m_reverseKeyTranslateTable[SEVENKEY ] = KX_SEVENKEY;
- m_reverseKeyTranslateTable[EIGHTKEY ] = KX_EIGHTKEY;
- m_reverseKeyTranslateTable[NINEKEY ] = KX_NINEKEY;
-
- m_reverseKeyTranslateTable[CAPSLOCKKEY ] = KX_CAPSLOCKKEY;
-
- m_reverseKeyTranslateTable[LEFTCTRLKEY ] = KX_LEFTCTRLKEY;
- m_reverseKeyTranslateTable[LEFTALTKEY ] = KX_LEFTALTKEY;
- m_reverseKeyTranslateTable[RIGHTALTKEY ] = KX_RIGHTALTKEY;
- m_reverseKeyTranslateTable[RIGHTCTRLKEY ] = KX_RIGHTCTRLKEY;
- m_reverseKeyTranslateTable[RIGHTSHIFTKEY ] = KX_RIGHTSHIFTKEY;
- m_reverseKeyTranslateTable[LEFTSHIFTKEY ] = KX_LEFTSHIFTKEY;
-
- m_reverseKeyTranslateTable[ESCKEY ] = KX_ESCKEY;
- m_reverseKeyTranslateTable[TABKEY ] = KX_TABKEY;
- m_reverseKeyTranslateTable[RETKEY ] = KX_RETKEY;
- m_reverseKeyTranslateTable[SPACEKEY ] = KX_SPACEKEY;
- m_reverseKeyTranslateTable[LINEFEEDKEY ] = KX_LINEFEEDKEY;
- m_reverseKeyTranslateTable[BACKSPACEKEY ] = KX_BACKSPACEKEY;
- m_reverseKeyTranslateTable[DELKEY ] = KX_DELKEY;
- m_reverseKeyTranslateTable[SEMICOLONKEY ] = KX_SEMICOLONKEY;
- m_reverseKeyTranslateTable[PERIODKEY ] = KX_PERIODKEY;
- m_reverseKeyTranslateTable[COMMAKEY ] = KX_COMMAKEY;
- m_reverseKeyTranslateTable[QUOTEKEY ] = KX_QUOTEKEY;
- m_reverseKeyTranslateTable[ACCENTGRAVEKEY ] = KX_ACCENTGRAVEKEY;
- m_reverseKeyTranslateTable[MINUSKEY ] = KX_MINUSKEY;
- m_reverseKeyTranslateTable[SLASHKEY ] = KX_SLASHKEY;
- m_reverseKeyTranslateTable[BACKSLASHKEY ] = KX_BACKSLASHKEY;
- m_reverseKeyTranslateTable[EQUALKEY ] = KX_EQUALKEY;
- m_reverseKeyTranslateTable[LEFTBRACKETKEY ] = KX_LEFTBRACKETKEY;
- m_reverseKeyTranslateTable[RIGHTBRACKETKEY ] = KX_RIGHTBRACKETKEY;
-
- m_reverseKeyTranslateTable[LEFTARROWKEY ] = KX_LEFTARROWKEY;
- m_reverseKeyTranslateTable[DOWNARROWKEY ] = KX_DOWNARROWKEY;
- m_reverseKeyTranslateTable[RIGHTARROWKEY ] = KX_RIGHTARROWKEY;
- m_reverseKeyTranslateTable[UPARROWKEY ] = KX_UPARROWKEY;
-
- m_reverseKeyTranslateTable[PAD2 ] = KX_PAD2;
- m_reverseKeyTranslateTable[PAD4 ] = KX_PAD4;
- m_reverseKeyTranslateTable[PAD6 ] = KX_PAD6;
- m_reverseKeyTranslateTable[PAD8 ] = KX_PAD8;
-
- m_reverseKeyTranslateTable[PAD1 ] = KX_PAD1;
- m_reverseKeyTranslateTable[PAD3 ] = KX_PAD3;
- m_reverseKeyTranslateTable[PAD5 ] = KX_PAD5;
- m_reverseKeyTranslateTable[PAD7 ] = KX_PAD7;
- m_reverseKeyTranslateTable[PAD9 ] = KX_PAD9;
-
- m_reverseKeyTranslateTable[PADPERIOD ] = KX_PADPERIOD;
- m_reverseKeyTranslateTable[PADSLASHKEY ] = KX_PADSLASHKEY;
- m_reverseKeyTranslateTable[PADASTERKEY ] = KX_PADASTERKEY;
-
-
- m_reverseKeyTranslateTable[PAD0 ] = KX_PAD0;
- m_reverseKeyTranslateTable[PADMINUS ] = KX_PADMINUS;
- m_reverseKeyTranslateTable[PADENTER ] = KX_PADENTER;
- m_reverseKeyTranslateTable[PADPLUSKEY ] = KX_PADPLUSKEY;
-
-
- m_reverseKeyTranslateTable[F1KEY ] = KX_F1KEY;
- m_reverseKeyTranslateTable[F2KEY ] = KX_F2KEY;
- m_reverseKeyTranslateTable[F3KEY ] = KX_F3KEY;
- m_reverseKeyTranslateTable[F4KEY ] = KX_F4KEY;
- m_reverseKeyTranslateTable[F5KEY ] = KX_F5KEY;
- m_reverseKeyTranslateTable[F6KEY ] = KX_F6KEY;
- m_reverseKeyTranslateTable[F7KEY ] = KX_F7KEY;
- m_reverseKeyTranslateTable[F8KEY ] = KX_F8KEY;
- m_reverseKeyTranslateTable[F9KEY ] = KX_F9KEY;
- m_reverseKeyTranslateTable[F10KEY ] = KX_F10KEY;
- m_reverseKeyTranslateTable[F11KEY ] = KX_F11KEY;
- m_reverseKeyTranslateTable[F12KEY ] = KX_F12KEY;
- m_reverseKeyTranslateTable[F13KEY ] = KX_F13KEY;
- m_reverseKeyTranslateTable[F14KEY ] = KX_F14KEY;
- m_reverseKeyTranslateTable[F15KEY ] = KX_F15KEY;
- m_reverseKeyTranslateTable[F16KEY ] = KX_F16KEY;
- m_reverseKeyTranslateTable[F17KEY ] = KX_F17KEY;
- m_reverseKeyTranslateTable[F18KEY ] = KX_F18KEY;
- m_reverseKeyTranslateTable[F19KEY ] = KX_F19KEY;
-
- m_reverseKeyTranslateTable[PAUSEKEY ] = KX_PAUSEKEY;
- m_reverseKeyTranslateTable[INSERTKEY ] = KX_INSERTKEY;
- m_reverseKeyTranslateTable[HOMEKEY ] = KX_HOMEKEY;
- m_reverseKeyTranslateTable[PAGEUPKEY ] = KX_PAGEUPKEY;
- m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY;
- m_reverseKeyTranslateTable[ENDKEY ] = KX_ENDKEY;
}
virtual ~BL_BlenderInputDevice()
@@ -225,7 +63,7 @@ public:
}
KX_EnumInputs ToNative(unsigned short incode) {
- return m_reverseKeyTranslateTable[incode];
+ return ConvertKeyCode(incode);
}
virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
index a6712c531fb..54c60096812 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
@@ -36,6 +36,7 @@
#endif
#include "KX_BlenderKeyboardDevice.h"
+#include "KX_KetsjiEngine.h"
KX_BlenderKeyboardDevice::KX_BlenderKeyboardDevice()
: m_hookesc(false)
@@ -106,7 +107,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode,short v
if (val == KM_PRESS)
{
- if (kxevent == KX_ESCKEY && val != 0 && !m_hookesc)
+ if (kxevent == KX_KetsjiEngine::GetExitKey() && val != 0 && !m_hookesc)
result = true;
if (kxevent == KX_PAUSEKEY && val && (IsPressed(KX_LEFTCTRLKEY) || IsPressed(KX_RIGHTCTRLKEY)))
result = true;
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
index 63a01db2fe0..3039e69efcd 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
@@ -50,6 +50,8 @@ public:
virtual bool ConvertBlenderEvent(unsigned short incode,short val);
virtual void NextFrame();
virtual void HookEscape();
+private:
+ short m_exit_key;
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 57611d65e14..c6a1105124c 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -197,6 +197,180 @@ extern "C" {
static bool default_light_mode = 0;
+static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
+{
+ std::map<int, SCA_IInputDevice::KX_EnumInputs> m;
+
+ /* The reverse table. In order to not confuse ourselves, we */
+ /* immediately convert all events that come in to KX codes. */
+ m[LEFTMOUSE ] = SCA_IInputDevice::KX_LEFTMOUSE;
+ m[MIDDLEMOUSE ] = SCA_IInputDevice::KX_MIDDLEMOUSE;
+ m[RIGHTMOUSE ] = SCA_IInputDevice::KX_RIGHTMOUSE;
+ m[WHEELUPMOUSE ] = SCA_IInputDevice::KX_WHEELUPMOUSE;
+ m[WHEELDOWNMOUSE ] = SCA_IInputDevice::KX_WHEELDOWNMOUSE;
+ m[MOUSEX ] = SCA_IInputDevice::KX_MOUSEX;
+ m[MOUSEY ] = SCA_IInputDevice::KX_MOUSEY;
+
+ // TIMERS
+
+ m[TIMER0 ] = SCA_IInputDevice::KX_TIMER0;
+ m[TIMER1 ] = SCA_IInputDevice::KX_TIMER1;
+ m[TIMER2 ] = SCA_IInputDevice::KX_TIMER2;
+
+ // SYSTEM
+
+#if 0
+ /* **** XXX **** */
+ m[KEYBD ] = SCA_IInputDevice::KX_KEYBD;
+ m[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD;
+ m[REDRAW ] = SCA_IInputDevice::KX_REDRAW;
+ m[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE;
+ m[QFULL ] = SCA_IInputDevice::KX_QFULL;
+ m[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE;
+ m[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW;
+ m[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE;
+ m[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT;
+ m[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME;
+ /* **** XXX **** */
+#endif
+
+ // standard keyboard
+
+ m[AKEY ] = SCA_IInputDevice::KX_AKEY;
+ m[BKEY ] = SCA_IInputDevice::KX_BKEY;
+ m[CKEY ] = SCA_IInputDevice::KX_CKEY;
+ m[DKEY ] = SCA_IInputDevice::KX_DKEY;
+ m[EKEY ] = SCA_IInputDevice::KX_EKEY;
+ m[FKEY ] = SCA_IInputDevice::KX_FKEY;
+ m[GKEY ] = SCA_IInputDevice::KX_GKEY;
+
+//XXX clean up
+#ifdef WIN32
+#define HKEY 'h'
+#endif
+ m[HKEY ] = SCA_IInputDevice::KX_HKEY;
+//XXX clean up
+#ifdef WIN32
+#undef HKEY
+#endif
+
+ m[IKEY ] = SCA_IInputDevice::KX_IKEY;
+ m[JKEY ] = SCA_IInputDevice::KX_JKEY;
+ m[KKEY ] = SCA_IInputDevice::KX_KKEY;
+ m[LKEY ] = SCA_IInputDevice::KX_LKEY;
+ m[MKEY ] = SCA_IInputDevice::KX_MKEY;
+ m[NKEY ] = SCA_IInputDevice::KX_NKEY;
+ m[OKEY ] = SCA_IInputDevice::KX_OKEY;
+ m[PKEY ] = SCA_IInputDevice::KX_PKEY;
+ m[QKEY ] = SCA_IInputDevice::KX_QKEY;
+ m[RKEY ] = SCA_IInputDevice::KX_RKEY;
+ m[SKEY ] = SCA_IInputDevice::KX_SKEY;
+ m[TKEY ] = SCA_IInputDevice::KX_TKEY;
+ m[UKEY ] = SCA_IInputDevice::KX_UKEY;
+ m[VKEY ] = SCA_IInputDevice::KX_VKEY;
+ m[WKEY ] = SCA_IInputDevice::KX_WKEY;
+ m[XKEY ] = SCA_IInputDevice::KX_XKEY;
+ m[YKEY ] = SCA_IInputDevice::KX_YKEY;
+ m[ZKEY ] = SCA_IInputDevice::KX_ZKEY;
+
+ m[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY;
+ m[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY;
+ m[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY;
+ m[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY;
+ m[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY;
+ m[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY;
+ m[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY;
+ m[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY;
+ m[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY;
+ m[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY;
+
+ m[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY;
+
+ m[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY;
+ m[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY;
+ m[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY;
+ m[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY;
+ m[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY;
+ m[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY;
+
+ m[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY;
+ m[TABKEY ] = SCA_IInputDevice::KX_TABKEY;
+ m[RETKEY ] = SCA_IInputDevice::KX_RETKEY;
+ m[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY;
+ m[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY;
+ m[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY;
+ m[DELKEY ] = SCA_IInputDevice::KX_DELKEY;
+ m[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY;
+ m[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY;
+ m[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY;
+ m[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY;
+ m[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY;
+ m[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY;
+ m[SLASHKEY ] = SCA_IInputDevice::KX_SLASHKEY;
+ m[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY;
+ m[EQUALKEY ] = SCA_IInputDevice::KX_EQUALKEY;
+ m[LEFTBRACKETKEY ] = SCA_IInputDevice::KX_LEFTBRACKETKEY;
+ m[RIGHTBRACKETKEY ] = SCA_IInputDevice::KX_RIGHTBRACKETKEY;
+
+ m[LEFTARROWKEY ] = SCA_IInputDevice::KX_LEFTARROWKEY;
+ m[DOWNARROWKEY ] = SCA_IInputDevice::KX_DOWNARROWKEY;
+ m[RIGHTARROWKEY ] = SCA_IInputDevice::KX_RIGHTARROWKEY;
+ m[UPARROWKEY ] = SCA_IInputDevice::KX_UPARROWKEY;
+
+ m[PAD2 ] = SCA_IInputDevice::KX_PAD2;
+ m[PAD4 ] = SCA_IInputDevice::KX_PAD4;
+ m[PAD6 ] = SCA_IInputDevice::KX_PAD6;
+ m[PAD8 ] = SCA_IInputDevice::KX_PAD8;
+
+ m[PAD1 ] = SCA_IInputDevice::KX_PAD1;
+ m[PAD3 ] = SCA_IInputDevice::KX_PAD3;
+ m[PAD5 ] = SCA_IInputDevice::KX_PAD5;
+ m[PAD7 ] = SCA_IInputDevice::KX_PAD7;
+ m[PAD9 ] = SCA_IInputDevice::KX_PAD9;
+
+ m[PADPERIOD ] = SCA_IInputDevice::KX_PADPERIOD;
+ m[PADSLASHKEY ] = SCA_IInputDevice::KX_PADSLASHKEY;
+ m[PADASTERKEY ] = SCA_IInputDevice::KX_PADASTERKEY;
+
+ m[PAD0 ] = SCA_IInputDevice::KX_PAD0;
+ m[PADMINUS ] = SCA_IInputDevice::KX_PADMINUS;
+ m[PADENTER ] = SCA_IInputDevice::KX_PADENTER;
+ m[PADPLUSKEY ] = SCA_IInputDevice::KX_PADPLUSKEY;
+
+
+ m[F1KEY ] = SCA_IInputDevice::KX_F1KEY;
+ m[F2KEY ] = SCA_IInputDevice::KX_F2KEY;
+ m[F3KEY ] = SCA_IInputDevice::KX_F3KEY;
+ m[F4KEY ] = SCA_IInputDevice::KX_F4KEY;
+ m[F5KEY ] = SCA_IInputDevice::KX_F5KEY;
+ m[F6KEY ] = SCA_IInputDevice::KX_F6KEY;
+ m[F7KEY ] = SCA_IInputDevice::KX_F7KEY;
+ m[F8KEY ] = SCA_IInputDevice::KX_F8KEY;
+ m[F9KEY ] = SCA_IInputDevice::KX_F9KEY;
+ m[F10KEY ] = SCA_IInputDevice::KX_F10KEY;
+ m[F11KEY ] = SCA_IInputDevice::KX_F11KEY;
+ m[F12KEY ] = SCA_IInputDevice::KX_F12KEY;
+ m[F13KEY ] = SCA_IInputDevice::KX_F13KEY;
+ m[F14KEY ] = SCA_IInputDevice::KX_F14KEY;
+ m[F15KEY ] = SCA_IInputDevice::KX_F15KEY;
+ m[F16KEY ] = SCA_IInputDevice::KX_F16KEY;
+ m[F17KEY ] = SCA_IInputDevice::KX_F17KEY;
+ m[F18KEY ] = SCA_IInputDevice::KX_F18KEY;
+ m[F19KEY ] = SCA_IInputDevice::KX_F19KEY;
+
+
+ m[PAUSEKEY ] = SCA_IInputDevice::KX_PAUSEKEY;
+ m[INSERTKEY ] = SCA_IInputDevice::KX_INSERTKEY;
+ m[HOMEKEY ] = SCA_IInputDevice::KX_HOMEKEY;
+ m[PAGEUPKEY ] = SCA_IInputDevice::KX_PAGEUPKEY;
+ m[PAGEDOWNKEY ] = SCA_IInputDevice::KX_PAGEDOWNKEY;
+ m[ENDKEY ] = SCA_IInputDevice::KX_ENDKEY;
+
+ return m;
+}
+
+static std::map<int, SCA_IInputDevice::KX_EnumInputs> gReverseKeyTranslateTable = create_translate_table();
+
static unsigned int KX_rgbaint2uint_new(unsigned int icol)
{
union
@@ -2854,3 +3028,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
RAS_BucketManager *bucketmanager = kxscene->GetBucketManager();
bucketmanager->OptimizeBuckets(distance);
}
+
+SCA_IInputDevice::KX_EnumInputs ConvertKeyCode(int key_code)
+{
+ return gReverseKeyTranslateTable[key_code];
+}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.h b/source/gameengine/Converter/BL_BlenderDataConversion.h
index 2ae7fee1798..6da3ac90aef 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.h
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.h
@@ -36,6 +36,7 @@
#include "STR_String.h"
#include "KX_Python.h"
#include "KX_PhysicsEngineEnums.h"
+#include "SCA_IInputDevice.h"
class RAS_MeshObject* BL_ConvertMesh(struct Mesh* mesh,struct Object* lightobj,class KX_Scene* scene, class KX_BlenderSceneConverter *converter);
@@ -49,5 +50,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
bool alwaysUseExpandFraming
);
+SCA_IInputDevice::KX_EnumInputs ConvertKeyCode(int key_code);
+
#endif // __BLENDER_CONVERT
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index b7aee8ec924..9391d12a3ce 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -86,10 +86,7 @@ probably misplaced */
#include "KX_KetsjiEngine.h"
#include "KX_BlenderSceneConverter.h"
-
-// this map is Blender specific: a conversion between blender and ketsji enums
-std::map<int,SCA_IInputDevice::KX_EnumInputs> gReverseKeyTranslateTable;
-
+#include "BL_BlenderDataConversion.h"
void BL_ConvertSensors(struct Object* blenderobject,
class KX_GameObject* gameobj,
@@ -102,177 +99,6 @@ void BL_ConvertSensors(struct Object* blenderobject,
KX_BlenderSceneConverter* converter
)
{
- static bool reverseTableConverted = false;
-
- if (!reverseTableConverted)
- {
- reverseTableConverted = true;
-
- /* The reverse table. In order to not confuse ourselves, we */
- /* immediately convert all events that come in to KX codes. */
- gReverseKeyTranslateTable[LEFTMOUSE ] = SCA_IInputDevice::KX_LEFTMOUSE;
- gReverseKeyTranslateTable[MIDDLEMOUSE ] = SCA_IInputDevice::KX_MIDDLEMOUSE;
- gReverseKeyTranslateTable[RIGHTMOUSE ] = SCA_IInputDevice::KX_RIGHTMOUSE;
- gReverseKeyTranslateTable[WHEELUPMOUSE ] = SCA_IInputDevice::KX_WHEELUPMOUSE;
- gReverseKeyTranslateTable[WHEELDOWNMOUSE ] = SCA_IInputDevice::KX_WHEELDOWNMOUSE;
- gReverseKeyTranslateTable[MOUSEX ] = SCA_IInputDevice::KX_MOUSEX;
- gReverseKeyTranslateTable[MOUSEY ] = SCA_IInputDevice::KX_MOUSEY;
-
- // TIMERS
-
- gReverseKeyTranslateTable[TIMER0 ] = SCA_IInputDevice::KX_TIMER0;
- gReverseKeyTranslateTable[TIMER1 ] = SCA_IInputDevice::KX_TIMER1;
- gReverseKeyTranslateTable[TIMER2 ] = SCA_IInputDevice::KX_TIMER2;
-
- // SYSTEM
-
-#if 0
- /* **** XXX **** */
- gReverseKeyTranslateTable[KEYBD ] = SCA_IInputDevice::KX_KEYBD;
- gReverseKeyTranslateTable[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD;
- gReverseKeyTranslateTable[REDRAW ] = SCA_IInputDevice::KX_REDRAW;
- gReverseKeyTranslateTable[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE;
- gReverseKeyTranslateTable[QFULL ] = SCA_IInputDevice::KX_QFULL;
- gReverseKeyTranslateTable[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE;
- gReverseKeyTranslateTable[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW;
- gReverseKeyTranslateTable[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE;
- gReverseKeyTranslateTable[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT;
- gReverseKeyTranslateTable[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME;
- /* **** XXX **** */
-#endif
-
- // standard keyboard
-
- gReverseKeyTranslateTable[AKEY ] = SCA_IInputDevice::KX_AKEY;
- gReverseKeyTranslateTable[BKEY ] = SCA_IInputDevice::KX_BKEY;
- gReverseKeyTranslateTable[CKEY ] = SCA_IInputDevice::KX_CKEY;
- gReverseKeyTranslateTable[DKEY ] = SCA_IInputDevice::KX_DKEY;
- gReverseKeyTranslateTable[EKEY ] = SCA_IInputDevice::KX_EKEY;
- gReverseKeyTranslateTable[FKEY ] = SCA_IInputDevice::KX_FKEY;
- gReverseKeyTranslateTable[GKEY ] = SCA_IInputDevice::KX_GKEY;
-
-//XXX clean up
-#ifdef WIN32
-#define HKEY 'h'
-#endif
- gReverseKeyTranslateTable[HKEY ] = SCA_IInputDevice::KX_HKEY;
-//XXX clean up
-#ifdef WIN32
-#undef HKEY
-#endif
-
- gReverseKeyTranslateTable[IKEY ] = SCA_IInputDevice::KX_IKEY;
- gReverseKeyTranslateTable[JKEY ] = SCA_IInputDevice::KX_JKEY;
- gReverseKeyTranslateTable[KKEY ] = SCA_IInputDevice::KX_KKEY;
- gReverseKeyTranslateTable[LKEY ] = SCA_IInputDevice::KX_LKEY;
- gReverseKeyTranslateTable[MKEY ] = SCA_IInputDevice::KX_MKEY;
- gReverseKeyTranslateTable[NKEY ] = SCA_IInputDevice::KX_NKEY;
- gReverseKeyTranslateTable[OKEY ] = SCA_IInputDevice::KX_OKEY;
- gReverseKeyTranslateTable[PKEY ] = SCA_IInputDevice::KX_PKEY;
- gReverseKeyTranslateTable[QKEY ] = SCA_IInputDevice::KX_QKEY;
- gReverseKeyTranslateTable[RKEY ] = SCA_IInputDevice::KX_RKEY;
- gReverseKeyTranslateTable[SKEY ] = SCA_IInputDevice::KX_SKEY;
- gReverseKeyTranslateTable[TKEY ] = SCA_IInputDevice::KX_TKEY;
- gReverseKeyTranslateTable[UKEY ] = SCA_IInputDevice::KX_UKEY;
- gReverseKeyTranslateTable[VKEY ] = SCA_IInputDevice::KX_VKEY;
- gReverseKeyTranslateTable[WKEY ] = SCA_IInputDevice::KX_WKEY;
- gReverseKeyTranslateTable[XKEY ] = SCA_IInputDevice::KX_XKEY;
- gReverseKeyTranslateTable[YKEY ] = SCA_IInputDevice::KX_YKEY;
- gReverseKeyTranslateTable[ZKEY ] = SCA_IInputDevice::KX_ZKEY;
-
- gReverseKeyTranslateTable[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY;
- gReverseKeyTranslateTable[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY;
- gReverseKeyTranslateTable[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY;
- gReverseKeyTranslateTable[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY;
- gReverseKeyTranslateTable[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY;
- gReverseKeyTranslateTable[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY;
- gReverseKeyTranslateTable[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY;
- gReverseKeyTranslateTable[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY;
- gReverseKeyTranslateTable[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY;
- gReverseKeyTranslateTable[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY;
-
- gReverseKeyTranslateTable[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY;
-
- gReverseKeyTranslateTable[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY;
- gReverseKeyTranslateTable[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY;
- gReverseKeyTranslateTable[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY;
- gReverseKeyTranslateTable[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY;
- gReverseKeyTranslateTable[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY;
- gReverseKeyTranslateTable[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY;
-
- gReverseKeyTranslateTable[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY;
- gReverseKeyTranslateTable[TABKEY ] = SCA_IInputDevice::KX_TABKEY;
- gReverseKeyTranslateTable[RETKEY ] = SCA_IInputDevice::KX_RETKEY;
- gReverseKeyTranslateTable[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY;
- gReverseKeyTranslateTable[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY;
- gReverseKeyTranslateTable[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY;
- gReverseKeyTranslateTable[DELKEY ] = SCA_IInputDevice::KX_DELKEY;
- gReverseKeyTranslateTable[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY;
- gReverseKeyTranslateTable[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY;
- gReverseKeyTranslateTable[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY;
- gReverseKeyTranslateTable[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY;
- gReverseKeyTranslateTable[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY;
- gReverseKeyTranslateTable[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY;
- gReverseKeyTranslateTable[SLASHKEY ] = SCA_IInputDevice::KX_SLASHKEY;
- gReverseKeyTranslateTable[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY;
- gReverseKeyTranslateTable[EQUALKEY ] = SCA_IInputDevice::KX_EQUALKEY;
- gReverseKeyTranslateTable[LEFTBRACKETKEY ] = SCA_IInputDevice::KX_LEFTBRACKETKEY;
- gReverseKeyTranslateTable[RIGHTBRACKETKEY ] = SCA_IInputDevice::KX_RIGHTBRACKETKEY;
-
- gReverseKeyTranslateTable[LEFTARROWKEY ] = SCA_IInputDevice::KX_LEFTARROWKEY;
- gReverseKeyTranslateTable[DOWNARROWKEY ] = SCA_IInputDevice::KX_DOWNARROWKEY;
- gReverseKeyTranslateTable[RIGHTARROWKEY ] = SCA_IInputDevice::KX_RIGHTARROWKEY;
- gReverseKeyTranslateTable[UPARROWKEY ] = SCA_IInputDevice::KX_UPARROWKEY;
-
- gReverseKeyTranslateTable[PAD2 ] = SCA_IInputDevice::KX_PAD2;
- gReverseKeyTranslateTable[PAD4 ] = SCA_IInputDevice::KX_PAD4;
- gReverseKeyTranslateTable[PAD6 ] = SCA_IInputDevice::KX_PAD6;
- gReverseKeyTranslateTable[PAD8 ] = SCA_IInputDevice::KX_PAD8;
-
- gReverseKeyTranslateTable[PAD1 ] = SCA_IInputDevice::KX_PAD1;
- gReverseKeyTranslateTable[PAD3 ] = SCA_IInputDevice::KX_PAD3;
- gReverseKeyTranslateTable[PAD5 ] = SCA_IInputDevice::KX_PAD5;
- gReverseKeyTranslateTable[PAD7 ] = SCA_IInputDevice::KX_PAD7;
- gReverseKeyTranslateTable[PAD9 ] = SCA_IInputDevice::KX_PAD9;
-
- gReverseKeyTranslateTable[PADPERIOD ] = SCA_IInputDevice::KX_PADPERIOD;
- gReverseKeyTranslateTable[PADSLASHKEY ] = SCA_IInputDevice::KX_PADSLASHKEY;
- gReverseKeyTranslateTable[PADASTERKEY ] = SCA_IInputDevice::KX_PADASTERKEY;
-
- gReverseKeyTranslateTable[PAD0 ] = SCA_IInputDevice::KX_PAD0;
- gReverseKeyTranslateTable[PADMINUS ] = SCA_IInputDevice::KX_PADMINUS;
- gReverseKeyTranslateTable[PADENTER ] = SCA_IInputDevice::KX_PADENTER;
- gReverseKeyTranslateTable[PADPLUSKEY ] = SCA_IInputDevice::KX_PADPLUSKEY;
-
-
- gReverseKeyTranslateTable[F1KEY ] = SCA_IInputDevice::KX_F1KEY;
- gReverseKeyTranslateTable[F2KEY ] = SCA_IInputDevice::KX_F2KEY;
- gReverseKeyTranslateTable[F3KEY ] = SCA_IInputDevice::KX_F3KEY;
- gReverseKeyTranslateTable[F4KEY ] = SCA_IInputDevice::KX_F4KEY;
- gReverseKeyTranslateTable[F5KEY ] = SCA_IInputDevice::KX_F5KEY;
- gReverseKeyTranslateTable[F6KEY ] = SCA_IInputDevice::KX_F6KEY;
- gReverseKeyTranslateTable[F7KEY ] = SCA_IInputDevice::KX_F7KEY;
- gReverseKeyTranslateTable[F8KEY ] = SCA_IInputDevice::KX_F8KEY;
- gReverseKeyTranslateTable[F9KEY ] = SCA_IInputDevice::KX_F9KEY;
- gReverseKeyTranslateTable[F10KEY ] = SCA_IInputDevice::KX_F10KEY;
- gReverseKeyTranslateTable[F11KEY ] = SCA_IInputDevice::KX_F11KEY;
- gReverseKeyTranslateTable[F12KEY ] = SCA_IInputDevice::KX_F12KEY;
- gReverseKeyTranslateTable[F13KEY ] = SCA_IInputDevice::KX_F13KEY;
- gReverseKeyTranslateTable[F14KEY ] = SCA_IInputDevice::KX_F14KEY;
- gReverseKeyTranslateTable[F15KEY ] = SCA_IInputDevice::KX_F15KEY;
- gReverseKeyTranslateTable[F16KEY ] = SCA_IInputDevice::KX_F16KEY;
- gReverseKeyTranslateTable[F17KEY ] = SCA_IInputDevice::KX_F17KEY;
- gReverseKeyTranslateTable[F18KEY ] = SCA_IInputDevice::KX_F18KEY;
- gReverseKeyTranslateTable[F19KEY ] = SCA_IInputDevice::KX_F19KEY;
-
-
- gReverseKeyTranslateTable[PAUSEKEY ] = SCA_IInputDevice::KX_PAUSEKEY;
- gReverseKeyTranslateTable[INSERTKEY ] = SCA_IInputDevice::KX_INSERTKEY;
- gReverseKeyTranslateTable[HOMEKEY ] = SCA_IInputDevice::KX_HOMEKEY;
- gReverseKeyTranslateTable[PAGEUPKEY ] = SCA_IInputDevice::KX_PAGEUPKEY;
- gReverseKeyTranslateTable[PAGEDOWNKEY ] = SCA_IInputDevice::KX_PAGEDOWNKEY;
- gReverseKeyTranslateTable[ENDKEY ] = SCA_IInputDevice::KX_ENDKEY;
- }
int executePriority = 0;
int uniqueint = 0;
@@ -470,9 +296,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
if (eventmgr)
{
gamesensor = new SCA_KeyboardSensor(eventmgr,
- gReverseKeyTranslateTable[blenderkeybdsensor->key],
- gReverseKeyTranslateTable[blenderkeybdsensor->qual],
- gReverseKeyTranslateTable[blenderkeybdsensor->qual2],
+ ConvertKeyCode(blenderkeybdsensor->key),
+ ConvertKeyCode(blenderkeybdsensor->qual),
+ ConvertKeyCode(blenderkeybdsensor->qual2),
(blenderkeybdsensor->type == SENS_ALL_KEYS),
blenderkeybdsensor->targetName,
blenderkeybdsensor->toggleName,
diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
index 5b267c92908..3d88dc467b0 100644
--- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
+++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
@@ -57,6 +57,7 @@ protected:
* System dependent keyboard codes are stored as ints.
*/
std::map<int, KX_EnumInputs> m_reverseKeyTranslateTable;
+ short m_exitkey;
public:
bool m_hookesc;
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 7490e187824..f249510ecc7 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -40,6 +40,7 @@
#include "GPU_extensions.h"
#include "GPG_Application.h"
+#include "BL_BlenderDataConversion.h"
#include <iostream>
#include <MT_assert.h>
@@ -626,6 +627,8 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
m_ketsjiengine->SetRasterizer(m_rasterizer);
m_ketsjiengine->SetTimingDisplay(frameRate, false, false);
+
+ KX_KetsjiEngine::SetExitKey(ConvertKeyCode(gm->exitkey));
#ifdef WITH_PYTHON
CValue::SetDeprecationWarnings(nodepwarnings);
#else
@@ -786,6 +789,10 @@ void GPG_Application::stopEngine()
void GPG_Application::exitEngine()
{
+ // We only want to kill the engine if it has been initialized
+ if (!m_engineInitialized)
+ return;
+
sound_exit();
if (m_ketsjiengine)
{
@@ -908,12 +915,10 @@ bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown)
{
GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData();
GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>(eventData);
- //no need for this test
- //if (fSystem->getFullScreen()) {
- if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc && !m_isEmbedded) {
- m_exitRequested = KX_EXIT_REQUEST_OUTSIDE;
- }
- //}
+
+ if (m_keyboard->ToNative(keyData->key) == KX_KetsjiEngine::GetExitKey() && !m_keyboard->m_hookesc && !m_isEmbedded) {
+ m_exitRequested = KX_EXIT_REQUEST_OUTSIDE;
+ }
m_keyboard->ConvertEvent(keyData->key, isDown);
handled = true;
}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h
index a8a976f9dd2..37625dc8998 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h
@@ -103,6 +103,7 @@ protected:
* Shuts the game engine down.
*/
void exitEngine(void);
+ short m_exitkey;
/* The game data */
STR_String m_startSceneName;
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
index 70bb2dbb5a2..728d0fb8561 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
@@ -145,7 +145,8 @@ bool KX_IpoSGController::Update(double currentTime)
}
//modifies position?
- if (m_ipo_channels_active[OB_LOC_X] || m_ipo_channels_active[OB_LOC_Y] || m_ipo_channels_active[OB_LOC_Z] || m_ipo_channels_active[OB_DLOC_X] || m_ipo_channels_active[OB_DLOC_Y] || m_ipo_channels_active[OB_DLOC_Z])
+ if (m_ipo_channels_active[OB_LOC_X] || m_ipo_channels_active[OB_LOC_Y] || m_ipo_channels_active[OB_LOC_Z] ||
+ m_ipo_channels_active[OB_DLOC_X] || m_ipo_channels_active[OB_DLOC_Y] || m_ipo_channels_active[OB_DLOC_Z])
{
if (m_ipo_as_force == true)
{
@@ -198,7 +199,9 @@ bool KX_IpoSGController::Update(double currentTime)
}
}
//modifies orientation?
- if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z] || m_ipo_channels_active[OB_DROT_X] || m_ipo_channels_active[OB_DROT_Y] || m_ipo_channels_active[OB_DROT_Z]) {
+ if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z] ||
+ m_ipo_channels_active[OB_DROT_X] || m_ipo_channels_active[OB_DROT_Y] || m_ipo_channels_active[OB_DROT_Z])
+ {
if (m_ipo_as_force) {
if (m_game_object && ob) {
@@ -293,7 +296,9 @@ bool KX_IpoSGController::Update(double currentTime)
}
}
//modifies scale?
- if (m_ipo_channels_active[OB_SIZE_X] || m_ipo_channels_active[OB_SIZE_Y] || m_ipo_channels_active[OB_SIZE_Z] || m_ipo_channels_active[OB_DSIZE_X] || m_ipo_channels_active[OB_DSIZE_Y] || m_ipo_channels_active[OB_DSIZE_Z]) {
+ if (m_ipo_channels_active[OB_SIZE_X] || m_ipo_channels_active[OB_SIZE_Y] || m_ipo_channels_active[OB_SIZE_Z] ||
+ m_ipo_channels_active[OB_DSIZE_X] || m_ipo_channels_active[OB_DSIZE_Y] || m_ipo_channels_active[OB_DSIZE_Z])
+ {
//default is no scale change
MT_Vector3 newScale(1.0,1.0,1.0);
if (!m_ipo_add)
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index a9be588e6b2..29727dc04da 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -110,6 +110,7 @@ double KX_KetsjiEngine::m_suspendedtime = 0.0;
double KX_KetsjiEngine::m_suspendeddelta = 0.0;
double KX_KetsjiEngine::m_average_framerate = 0.0;
bool KX_KetsjiEngine::m_restrict_anim_fps = false;
+short KX_KetsjiEngine::m_exitkey = 130; //ESC Key
/**
@@ -1857,6 +1858,16 @@ double KX_KetsjiEngine::GetAverageFrameRate()
return m_average_framerate;
}
+void KX_KetsjiEngine::SetExitKey(short key)
+{
+ m_exitkey = key;
+}
+
+short KX_KetsjiEngine::GetExitKey()
+{
+ return m_exitkey;
+}
+
void KX_KetsjiEngine::SetTimingDisplay(bool frameRate, bool profile, bool properties)
{
m_show_framerate = frameRate;
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 5a02da07e43..96b737b686d 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -124,6 +124,8 @@ private:
static double m_suspendedtime;
static double m_suspendeddelta;
+ static short m_exitkey; /* Key used to exit the BGE */
+
int m_exitcode;
STR_String m_exitstring;
/**
@@ -352,6 +354,10 @@ public:
*/
static double GetAverageFrameRate();
+ static void SetExitKey(short key);
+
+ static short GetExitKey();
+
/**
* Activates or deactivates timing information display.
* @param frameRate Display for frame rate on or off.
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index b9ff3759452..392a6633067 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -65,32 +65,59 @@ bool PyMatTo(PyObject* pymat, T& mat)
{
bool noerror = true;
mat.setIdentity();
+
+
+#ifdef USE_MATHUTILS
+
+ if (MatrixObject_Check(pymat))
+ {
+ MatrixObject *pymatrix = (MatrixObject *)pymat;
+
+ if (BaseMath_ReadCallback(pymatrix) == -1)
+ return false;
+
+ if (pymatrix->num_col != Size(mat) || pymatrix->num_row != Size(mat))
+ return false;
+
+ for (unsigned int row = 0; row < Size(mat); row++)
+ {
+ for (unsigned int col = 0; col < Size(mat); col++)
+ {
+ mat[row][col] = *(pymatrix->matrix + col * pymatrix->num_row + row);
+ }
+ }
+ }
+ else
+
+#endif /* USE_MATHUTILS */
+
+
if (PySequence_Check(pymat))
{
- unsigned int cols = PySequence_Size(pymat);
- if (cols != Size(mat))
+ unsigned int rows = PySequence_Size(pymat);
+ if (rows != Size(mat))
return false;
- for (unsigned int x = 0; noerror && x < cols; x++)
+ for (unsigned int row = 0; noerror && row < rows; row++)
{
- PyObject *pycol = PySequence_GetItem(pymat, x); /* new ref */
- if (!PyErr_Occurred() && PySequence_Check(pycol))
+ PyObject *pyrow = PySequence_GetItem(pymat, row); /* new ref */
+ if (!PyErr_Occurred() && PySequence_Check(pyrow))
{
- unsigned int rows = PySequence_Size(pycol);
- if (rows != Size(mat))
+ unsigned int cols = PySequence_Size(pyrow);
+ if (cols != Size(mat))
noerror = false;
else
{
- for( unsigned int y = 0; y < rows; y++)
+ for( unsigned int col = 0; col < cols; col++)
{
- PyObject *item = PySequence_GetItem(pycol, y); /* new ref */
- mat[y][x] = PyFloat_AsDouble(item);
+ PyObject *item = PySequence_GetItem(pyrow, col); /* new ref */
+ mat[row][col] = PyFloat_AsDouble(item);
Py_DECREF(item);
}
}
} else
noerror = false;
- Py_DECREF(pycol);
+ Py_DECREF(pyrow);
}
} else
noerror = false;
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 29871c2b3cd..9a2c0cb89b1 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -419,6 +419,20 @@ static PyObject* gPyGetLogicTicRate(PyObject*)
return PyFloat_FromDouble(KX_KetsjiEngine::GetTicRate());
}
+static PyObject* gPySetExitKey(PyObject*, PyObject* args)
+{
+ short exitkey;
+ if (!PyArg_ParseTuple(args, "h:setExitKey", &exitkey))
+ return NULL;
+ KX_KetsjiEngine::SetExitKey(exitkey);
+ Py_RETURN_NONE;
+}
+
+static PyObject* gPyGetExitKey(PyObject*)
+{
+ return PyLong_FromSsize_t(KX_KetsjiEngine::GetExitKey());
+}
+
static PyObject* gPySetMaxLogicFrame(PyObject*, PyObject* args)
{
int frame;
@@ -812,6 +826,8 @@ static struct PyMethodDef game_methods[] = {
{"setLogicTicRate", (PyCFunction) gPySetLogicTicRate, METH_VARARGS, (const char *)"Sets the logic tic rate"},
{"getPhysicsTicRate", (PyCFunction) gPyGetPhysicsTicRate, METH_NOARGS, (const char *)"Gets the physics tic rate"},
{"setPhysicsTicRate", (PyCFunction) gPySetPhysicsTicRate, METH_VARARGS, (const char *)"Sets the physics tic rate"},
+ {"getExitKey", (PyCFunction) gPyGetExitKey, METH_NOARGS, (const char *)"Gets the key used to exit the game engine"},
+ {"setExitKey", (PyCFunction) gPySetExitKey, METH_VARARGS, (const char *)"Sets the key used to exit the game engine"},
{"getAverageFrameRate", (PyCFunction) gPyGetAverageFrameRate, METH_NOARGS, (const char *)"Gets the estimated average frame rate"},
{"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (const char *)"Gets a list of blend files in the same directory as the current blend file"},
{"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"},
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index 4eadf8e3e66..30344ce3a10 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -431,6 +431,8 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glViewport(0,0, texturewidth, textureheight);
glDisable(GL_DEPTH_TEST);
+ // in case the previous material was wire
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// if the last rendered face had alpha add it would messes with the color of the plane we apply 2DFilter to
glDisable(GL_BLEND);
glPushMatrix(); //GL_MODELVIEW
diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt
index 40d304ef4b9..74a0ad1c628 100644
--- a/source/tests/CMakeLists.txt
+++ b/source/tests/CMakeLists.txt
@@ -60,6 +60,11 @@ add_test(script_run_operators ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_run_operators.py
)
+# test running mathutils testing script
+add_test(script_pyapi_mathutils ${TEST_BLENDER_EXE}
+ --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_mathutils.py
+)
+
# ------------------------------------------------------------------------------
# IO TESTS
diff --git a/source/tests/bl_pyapi_mathutils.py b/source/tests/bl_pyapi_mathutils.py
new file mode 100644
index 00000000000..b2e9f27d9ec
--- /dev/null
+++ b/source/tests/bl_pyapi_mathutils.py
@@ -0,0 +1,163 @@
+import unittest
+from test import support
+from mathutils import Matrix, Vector
+
+
+class MatrixTesting(unittest.TestCase):
+ def test_matrix_column_access(self):
+ #mat =
+ #[ 1 2 3 4 ]
+ #[ 1 2 3 4 ]
+ #[ 1 2 3 4 ]
+ mat = Matrix(((1, 11, 111),
+ (2, 22, 222),
+ (3, 33, 333),
+ (4, 44, 444)))
+
+ self.assertEqual(mat[0], Vector((1, 11, 111)))
+ self.assertEqual(mat[1], Vector((2, 22, 222)))
+ self.assertEqual(mat[2], Vector((3, 33, 333)))
+ self.assertEqual(mat[3], Vector((4, 44, 444)))
+
+ def test_item_access(self):
+ args = ((1, 4, 0, -1),
+ (2, -1, 2, -2),
+ (0, 3, 8, 3),
+ (-2, 9, 1, 0))
+
+ mat = Matrix(args)
+
+ for row in range(4):
+ for col in range(4):
+ self.assertEqual(mat[row][col], args[row][col])
+
+ self.assertEqual(mat[0][2], 0)
+ self.assertEqual(mat[3][1], 9)
+ self.assertEqual(mat[2][3], 3)
+ self.assertEqual(mat[0][0], 1)
+ self.assertEqual(mat[3][3], 0)
+
+ def test_item_assignment(self):
+ mat = Matrix() - Matrix()
+ indices = (0, 0), (1, 3), (2, 0), (3, 2), (3, 1)
+ checked_indices = []
+ for row, col in indices:
+ mat[row][col] = 1
+
+ for row in range(4):
+ for col in range(4):
+ if mat[row][col]:
+ checked_indices.append((row, col))
+
+ for item in checked_indices:
+ self.assertIn(item, indices)
+
+ def test_matrix_to_3x3(self):
+ #mat =
+ #[ 1 2 3 4 ]
+ #[ 2 4 6 8 ]
+ #[ 3 6 9 12 ]
+ #[ 4 8 12 16 ]
+ mat = Matrix(tuple((i, 2 * i, 3 * i, 4 * i) for i in range(1, 5)))
+ mat_correct = Matrix(((1, 2, 3), (2, 4, 6), (3, 6, 9)))
+ self.assertEqual(mat.to_3x3(), mat_correct)
+
+ def test_matrix_to_translation(self):
+ mat = Matrix()
+ mat[0][3] = 1
+ mat[1][3] = 2
+ mat[2][3] = 3
+ self.assertEqual(mat.to_translation(), Vector((1, 2, 3)))
+
+ def test_matrix_translation(self):
+ mat = Matrix()
+ mat.translation = Vector((1, 2, 3))
+ self.assertEqual(mat[0][3], 1)
+ self.assertEqual(mat[1][3], 2)
+ self.assertEqual(mat[2][3], 3)
+
+ def test_non_square_mult(self):
+ mat1 = Matrix(((1, 2, 3),
+ (4, 5, 6)))
+ mat2 = Matrix(((1, 2),
+ (3, 4),
+ (5, 6)))
+
+ prod_mat1 = Matrix(((22, 28),
+ (49, 64)))
+ prod_mat2 = Matrix(((9, 12, 15),
+ (19, 26, 33),
+ (29, 40, 51)))
+
+ self.assertEqual(mat1*mat2, prod_mat1)
+ self.assertEqual(mat2 * mat1, prod_mat2)
+
+ def test_mat4x4_vec3D_mult(self):
+ mat = Matrix(((1, 0, 2, 0),
+ (0, 6, 0, 0),
+ (0, 0, 1, 1),
+ (0, 0, 0, 1)))
+
+ vec = Vector((1, 2, 3))
+
+ prod_mat_vec = Vector((7, 12, 4))
+ prod_vec_mat = Vector((1, 12, 5))
+
+ self.assertEqual(mat * vec, prod_mat_vec)
+ self.assertEqual(vec * mat, prod_vec_mat)
+
+ def test_mat_vec_mult(self):
+ mat1 = Matrix()
+
+ vec = Vector((1, 2))
+
+ self.assertRaises(TypeError, mat1.__mul__, vec)
+ self.assertRaises(ValueError, vec.__mul__, mat1) # Why are these different?!
+
+ mat2 = Matrix(((1, 2),
+ (-2, 3)))
+
+ prod = Vector((5, 4))
+
+ self.assertEqual(mat2 * vec, prod)
+
+ def test_matrix_inverse(self):
+ mat = Matrix(((1, 4, 0, -1),
+ (2, -1, 2, -2),
+ (0, 3, 8, 3),
+ (-2, 9, 1, 0)))
+
+ inv_mat = (1 / 285) * Matrix(((195, -57, 27, -102),
+ (50, -19, 4, 6),
+ (-60, 57, 18, 27),
+ (110, -133, 43, -78)))
+
+ self.assertEqual(mat.inverted(), inv_mat)
+
+ def test_matrix_mult(self):
+ mat = Matrix(((1, 4, 0, -1),
+ (2, -1, 2, -2),
+ (0, 3, 8, 3),
+ (-2, 9, 1, 0)))
+
+ prod_mat = Matrix(((11, -9, 7, -9),
+ (4, -3, 12, 6),
+ (0, 48, 73, 18),
+ (16, -14, 26, -13)))
+
+ self.assertEqual(mat * mat, prod_mat)
+
+
+def test_main():
+ try:
+ support.run_unittest(MatrixTesting)
+ except:
+ import traceback
+ traceback.print_exc()
+
+ # alert CTest we failed
+ import sys
+ sys.exit(1)
+
+if __name__ == '__main__':
+ test_main()