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:
authorMiika Hamalainen <blender@miikah.org>2011-10-14 01:43:02 +0400
committerMiika Hamalainen <blender@miikah.org>2011-10-14 01:43:02 +0400
commit8be3249537e7930e0fa5adb59bc343455da309e9 (patch)
tree0f4f14b046742f4380540e06c529cd417ddbc541 /source
parent8bf78d7f5676520bf6f4241afb88fba506e342f4 (diff)
parent818c098004ff64adcc0ff24fe29d40850f5591ce (diff)
Merge with trunk r40991
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf_lang.c1
-rw-r--r--source/blender/blenkernel/BKE_action.h2
-rw-r--r--source/blender/blenkernel/BKE_anim.h2
-rw-r--r--source/blender/blenkernel/BKE_animsys.h2
-rw-r--r--source/blender/blenkernel/BKE_armature.h2
-rw-r--r--source/blender/blenkernel/BKE_bullet.h1
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h54
-rw-r--r--source/blender/blenkernel/BKE_customdata.h54
-rw-r--r--source/blender/blenkernel/BKE_displist.h2
-rw-r--r--source/blender/blenkernel/BKE_font.h5
-rw-r--r--source/blender/blenkernel/BKE_icons.h55
-rw-r--r--source/blender/blenkernel/BKE_mesh.h6
-rw-r--r--source/blender/blenkernel/BKE_navmesh_conversion.h56
-rw-r--r--source/blender/blenkernel/BKE_nla.h2
-rw-r--r--source/blender/blenkernel/BKE_packedFile.h2
-rw-r--r--source/blender/blenkernel/BKE_paint.h2
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h53
-rw-r--r--source/blender/blenkernel/BKE_shrinkwrap.h2
-rw-r--r--source/blender/blenkernel/BKE_subsurf.h3
-rw-r--r--source/blender/blenkernel/BKE_suggestions.h2
-rw-r--r--source/blender/blenkernel/BKE_unit.h1
-rw-r--r--source/blender/blenkernel/BKE_writeffmpeg.h2
-rw-r--r--source/blender/blenkernel/BKE_writeframeserver.h2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c3
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.h3
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c196
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/anim.c6
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c2
-rw-r--r--source/blender/blenkernel/intern/blender.c5
-rw-r--r--source/blender/blenkernel/intern/bmfont.c6
-rw-r--r--source/blender/blenkernel/intern/boids.c4
-rw-r--r--source/blender/blenkernel/intern/bullet.c3
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c1
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c71
-rw-r--r--source/blender/blenkernel/intern/colortools.c8
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c11
-rw-r--r--source/blender/blenkernel/intern/customdata.c68
-rw-r--r--source/blender/blenkernel/intern/deform.c9
-rw-r--r--source/blender/blenkernel/intern/displist.c6
-rw-r--r--source/blender/blenkernel/intern/effect.c4
-rw-r--r--source/blender/blenkernel/intern/fcurve.c2
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c2
-rw-r--r--source/blender/blenkernel/intern/font.c34
-rw-r--r--source/blender/blenkernel/intern/gpencil.c6
-rw-r--r--source/blender/blenkernel/intern/icons.c56
-rw-r--r--source/blender/blenkernel/intern/image.c24
-rw-r--r--source/blender/blenkernel/intern/image_gen.c3
-rw-r--r--source/blender/blenkernel/intern/ipo.c4
-rw-r--r--source/blender/blenkernel/intern/key.c5
-rw-r--r--source/blender/blenkernel/intern/lattice.c3
-rw-r--r--source/blender/blenkernel/intern/library.c4
-rw-r--r--source/blender/blenkernel/intern/material.c29
-rw-r--r--source/blender/blenkernel/intern/mball.c16
-rw-r--r--source/blender/blenkernel/intern/mesh.c22
-rw-r--r--source/blender/blenkernel/intern/modifier.c68
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.c60
-rw-r--r--source/blender/blenkernel/intern/nla.c10
-rw-r--r--source/blender/blenkernel/intern/object.c4
-rw-r--r--source/blender/blenkernel/intern/packedFile.c12
-rw-r--r--source/blender/blenkernel/intern/particle.c4
-rw-r--r--source/blender/blenkernel/intern/particle_system.c4
-rw-r--r--source/blender/blenkernel/intern/property.c7
-rw-r--r--source/blender/blenkernel/intern/scene.c4
-rw-r--r--source/blender/blenkernel/intern/script.c6
-rw-r--r--source/blender/blenkernel/intern/seqcache.c2
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenkernel/intern/sketch.c1
-rw-r--r--source/blender/blenkernel/intern/smoke.c2
-rw-r--r--source/blender/blenkernel/intern/softbody.c3
-rw-r--r--source/blender/blenkernel/intern/sound.c9
-rw-r--r--source/blender/blenkernel/intern/speaker.c4
-rw-r--r--source/blender/blenkernel/intern/text.c4
-rw-r--r--source/blender/blenkernel/intern/texture.c4
-rw-r--r--source/blender/blenkernel/intern/world.c5
-rw-r--r--source/blender/blenkernel/intern/writeavi.c7
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c18
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c7
-rw-r--r--source/blender/blenlib/intern/path_util.c59
-rw-r--r--source/blender/blenlib/intern/winstuff.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c52
-rw-r--r--source/blender/editors/animation/anim_draw.c4
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c4
-rw-r--r--source/blender/editors/animation/keyframing.c53
-rw-r--r--source/blender/editors/armature/poseobject.c57
-rw-r--r--source/blender/editors/curve/editfont.c23
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c9
-rw-r--r--source/blender/editors/include/ED_keyframing.h5
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c255
-rw-r--r--source/blender/editors/interface/interface_layout.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c58
-rw-r--r--source/blender/editors/mesh/mesh_intern.h8
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c190
-rw-r--r--source/blender/editors/mesh/mesh_ops.c8
-rw-r--r--source/blender/editors/object/object_add.c8
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/object/object_modifier.c3
-rw-r--r--source/blender/editors/object/object_transform.c18
-rw-r--r--source/blender/editors/render/render_shading.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c170
-rw-r--r--source/blender/editors/sound/sound_ops.c9
-rw-r--r--source/blender/editors/space_action/action_edit.c38
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c2
-rw-r--r--source/blender/editors/space_file/filesel.c22
-rw-r--r--source/blender/editors/space_file/space_file.c4
-rw-r--r--source/blender/editors/space_image/image_ops.c10
-rw-r--r--source/blender/editors/space_info/space_info.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c15
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c28
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c46
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c26
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c20
-rw-r--r--source/blender/editors/transform/transform_generics.c6
-rw-r--r--source/blender/editors/transform/transform_input.c9
-rw-r--r--source/blender/editors/util/ed_util.c2
-rw-r--r--source/blender/gpu/intern/gpu_draw.c11
-rw-r--r--source/blender/imbuf/intern/anim_movie.c29
-rw-r--r--source/blender/imbuf/intern/indexer.c8
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp14
-rw-r--r--source/blender/makesdna/DNA_ID.h2
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h3
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h6
-rw-r--r--source/blender/makesdna/DNA_scene_types.h17
-rw-r--r--source/blender/makesrna/RNA_access.h2
-rw-r--r--source/blender/makesrna/intern/rna_ID.c10
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c4
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c14
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c17
-rw-r--r--source/blender/makesrna/intern/rna_object.c31
-rw-r--r--source/blender/makesrna/intern/rna_particle.c11
-rw-r--r--source/blender/makesrna/intern/rna_rna.c12
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c18
-rw-r--r--source/blender/makesrna/intern/rna_space.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c11
-rw-r--r--source/blender/makesrna/intern/rna_wm.c8
-rw-r--r--source/blender/modifiers/CMakeLists.txt1
-rw-r--r--source/blender/modifiers/intern/MOD_navmesh.c313
-rw-r--r--source/blender/modifiers/intern/MOD_util.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c2
-rw-r--r--source/blender/nodes/intern/node_common.c3
-rw-r--r--source/blender/nodes/intern/node_exec.c10
-rw-r--r--source/blender/python/generic/IDProp.c26
-rw-r--r--source/blender/python/generic/bgl.c16
-rw-r--r--source/blender/python/generic/bpy_internal_import.c42
-rw-r--r--source/blender/python/generic/noise_py_api.c58
-rw-r--r--source/blender/python/generic/py_capi_utils.c72
-rw-r--r--source/blender/python/intern/bpy.c20
-rw-r--r--source/blender/python/intern/bpy_app.c8
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c18
-rw-r--r--source/blender/python/intern/bpy_driver.c29
-rw-r--r--source/blender/python/intern/bpy_interface.c76
-rw-r--r--source/blender/python/intern/bpy_interface_atexit.c2
-rw-r--r--source/blender/python/intern/bpy_library.c36
-rw-r--r--source/blender/python/intern/bpy_operator.c79
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c7
-rw-r--r--source/blender/python/intern/bpy_props.c228
-rw-r--r--source/blender/python/intern/bpy_rna.c1072
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c52
-rw-r--r--source/blender/python/intern/bpy_rna_array.c56
-rw-r--r--source/blender/python/intern/bpy_traceback.c12
-rw-r--r--source/blender/python/intern/bpy_util.c12
-rw-r--r--source/blender/python/intern/gpu.c4
-rw-r--r--source/blender/python/mathutils/mathutils.c60
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c84
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c78
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c342
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c160
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c86
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c146
-rw-r--r--source/blender/quicktime/SConscript2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c15
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c1
-rw-r--r--source/creator/CMakeLists.txt10
-rw-r--r--source/gameengine/Converter/BlenderWorldInfo.h20
-rw-r--r--source/gameengine/Converter/KX_IpoConvert.cpp2
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h8
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.h2
-rw-r--r--source/gameengine/Ketsji/KX_Dome.h47
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ObstacleSimulation.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_OrientationInterpolator.h12
-rw-r--r--source/gameengine/Ketsji/KX_SteeringActuator.cpp64
-rw-r--r--source/gameengine/Ketsji/KX_SteeringActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp4
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_IRasterizer.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h2
-rw-r--r--source/gameengine/SceneGraph/SG_DList.h6
-rw-r--r--source/gameengine/VideoTexture/ImageRender.h46
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.h6
-rw-r--r--source/tests/CMakeLists.txt66
210 files changed, 3293 insertions, 2954 deletions
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 0a102884969..ec9501c06a6 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -94,6 +94,7 @@ static const char *locales[] = {
"greek", "el_GR",
"korean", "ko_KR",
"nepali", "ne_NP",
+ "persian", "fa_PE",
};
void BLF_lang_init(void)
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 67efb7752ea..7d3de68c005 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 44aebdf6205..da389c6f1d0 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index 98f9ee14c7e..bf619d76e68 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 8836999bc9b..a0660490baf 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_bullet.h b/source/blender/blenkernel/BKE_bullet.h
index 76358c4485b..2756ded3a08 100644
--- a/source/blender/blenkernel/BKE_bullet.h
+++ b/source/blender/blenkernel/BKE_bullet.h
@@ -1,5 +1,4 @@
/*
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 1edec2b69d9..07158f5f3fa 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -1,31 +1,31 @@
/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2006 Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): Ben Batt <benbatt@gmail.com>
-*
-* ***** END GPL LICENSE BLOCK *****
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Ben Batt <benbatt@gmail.com>
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file BKE_cdderivedmesh.h
* \ingroup bke
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 23e79fbd73a..ba3a838ef44 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -1,31 +1,31 @@
/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2006 Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): Ben Batt <benbatt@gmail.com>
-*
-* ***** END GPL LICENSE BLOCK *****
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Ben Batt <benbatt@gmail.com>
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
/** \file BKE_customdata.h
* \ingroup bke
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index b00db53a199..1eed0aaca00 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -1,5 +1,5 @@
/*
- $Id$
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index 2195b370a5f..e4e8805164a 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -46,6 +46,7 @@ struct Curve;
struct objfnt;
struct TmpFont;
struct CharInfo;
+struct Main;
struct chartrans {
float xof, yof;
@@ -77,10 +78,10 @@ void BKE_font_register_builtin(void *mem, int size);
void free_vfont(struct VFont *sc);
void free_ttfont(void);
struct VFont *get_builtin_font(void);
-struct VFont *load_vfont(const char *name);
+struct VFont *load_vfont(struct Main *bmain, const char *name);
struct TmpFont *vfont_find_tmpfont(struct VFont *vfont);
-struct chartrans *BKE_text_to_curve(struct Scene *scene, struct Object *ob, int mode);
+struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode);
int BKE_font_getselection(struct Object *ob, int *start, int *end);
diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h
index 3c12a5d615d..9f7d4aeb0d3 100644
--- a/source/blender/blenkernel/BKE_icons.h
+++ b/source/blender/blenkernel/BKE_icons.h
@@ -1,32 +1,31 @@
/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2006-2007 Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): none yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2006-2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
#ifndef BKE_ICONS_H
#define BKE_ICONS_H
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 95490b1aff6..347263bb290 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -1,6 +1,4 @@
/*
- * blenlib/BKE_mesh.h (mar-2001 nzc)
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -24,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): (mar-2001 nzc)
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -161,6 +159,8 @@ int BKE_mesh_validate_dm(struct DerivedMesh *dm);
void BKE_mesh_calc_edges(struct Mesh *mesh, int update);
+void BKE_mesh_ensure_navmesh(struct Mesh *me);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_navmesh_conversion.h b/source/blender/blenkernel/BKE_navmesh_conversion.h
index 01d32321c81..1880e1e6728 100644
--- a/source/blender/blenkernel/BKE_navmesh_conversion.h
+++ b/source/blender/blenkernel/BKE_navmesh_conversion.h
@@ -1,31 +1,31 @@
-/**
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): none yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*/
+/*
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
#ifndef BKE_NAVMESH_CONVERSION_H
#define BKE_NAVMESH_CONVERSION_H
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index 773c5ced1cb..49c1f8acd24 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index 541c581e762..556ff26e621 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -45,7 +45,7 @@ struct ReportList;
struct VFont;
/* pack */
-struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename);
+struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename, const char *relabase);
struct PackedFile *newPackedFileMemory(void *mem, int memlen);
void packAll(struct Main *bmain, struct ReportList *reports);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 2578a90808a..f8463bab55f 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index b7f60af38a6..9b102d7108f 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -1,30 +1,31 @@
/*
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2006 Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): Campbell Barton <ideasman42@gmail.com>
-*
-* ***** END GPL LICENSE BLOCK *****
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton <ideasman42@gmail.com>
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
#ifndef BKE_POINTCACHE_H
#define BKE_POINTCACHE_H
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index d1fef8b0ce1..9deb71a3474 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index a400c1e27b9..30142c12601 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/BKE_suggestions.h b/source/blender/blenkernel/BKE_suggestions.h
index e215cabd70f..c684271cbbf 100644
--- a/source/blender/blenkernel/BKE_suggestions.h
+++ b/source/blender/blenkernel/BKE_suggestions.h
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h
index 0a3e56c8cba..269941597b0 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -1,4 +1,5 @@
/*
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 2b10f1b246c..8345f0f5d2e 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/BKE_writeframeserver.h b/source/blender/blenkernel/BKE_writeframeserver.h
index 2117a23b938..8b2022076bb 100644
--- a/source/blender/blenkernel/BKE_writeframeserver.h
+++ b/source/blender/blenkernel/BKE_writeframeserver.h
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 50cec6fd55f..bccabd80ada 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -354,12 +354,14 @@ endif()
if(WITH_GAMEENGINE)
list(APPEND INC_SYS
- ../../../extern/recastnavigation
+ ../../../extern/recastnavigation
)
list(APPEND SRC
intern/navmesh_conversion.c
BKE_navmesh_conversion.h
)
+
+ add_definitions(-DWITH_GAMEENGINE)
endif()
## Warnings as errors, this is too strict!
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index a311ca15e5e..bf9acb224d5 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1,7 +1,8 @@
+/* $Id$ */
+
/** \file blender/blenkernel/intern/CCGSubSurf.c
* \ingroup bke
*/
-/* $Id$ */
#include <stdlib.h>
#include <string.h>
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h
index 363d1e01f98..1835e63727d 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf.h
@@ -1,7 +1,8 @@
+/* $Id$ */
+
/** \file blender/blenkernel/intern/CCGSubSurf.h
* \ingroup bke
*/
-/* $Id$ */
typedef void* CCGMeshHDL;
typedef void* CCGVertHDL;
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8f7bd532235..46b9f1425ad 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -62,6 +62,11 @@
#include "BKE_multires.h"
#include "BKE_armature.h"
+#ifdef WITH_GAMEENGINE
+#include "BKE_navmesh_conversion.h"
+static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
+#endif
+
#include "BLO_sys_types.h" // for intptr_t support
#include "GL/glew.h"
@@ -691,9 +696,11 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
else {
const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
if (shade_type != shade_prev) {
- glShadeModel((shade_prev= shade_type));
+ if(poly_prev != GL_ZERO) glEnd();
+ glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
+ glBegin((poly_prev= poly_type));
}
- if(poly_type != poly_prev) {
+ else if(poly_type != poly_prev) {
if(poly_prev != GL_ZERO) glEnd();
glBegin((poly_prev= poly_type));
}
@@ -756,9 +763,11 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
else {
const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
if (shade_type != shade_prev) {
- glShadeModel((shade_prev= shade_type));
+ if(poly_prev != GL_ZERO) glEnd();
+ glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
+ glBegin((poly_prev= poly_type));
}
- if(poly_type != poly_prev) {
+ else if(poly_type != poly_prev) {
if(poly_prev != GL_ZERO) glEnd();
glBegin((poly_prev= poly_type));
}
@@ -2110,6 +2119,18 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
add_orco_dm(ob, NULL, *deform_r, NULL, CD_ORCO);
}
+#ifdef WITH_GAMEENGINE
+ /* NavMesh - this is a hack but saves having a NavMesh modifier */
+ if ((ob->gameflag & OB_NAVMESH) && (finaldm->type == DM_TYPE_CDDM)) {
+ DerivedMesh *tdm;
+ tdm= navmesh_dm_createNavMeshForVisualization(finaldm);
+ if (finaldm != tdm) {
+ finaldm->release(finaldm);
+ finaldm= tdm;
+ }
+ }
+#endif /* WITH_GAMEENGINE */
+
*final_r = finaldm;
if(orcodm)
@@ -2944,3 +2965,170 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm)
boundbox_set_from_min_max(ob->bb, min, max);
}
+
+/* --- NAVMESH (begin) --- */
+#ifdef WITH_GAMEENGINE
+
+BM_INLINE int navmesh_bit(int a, int b)
+{
+ return (a & (1 << b)) >> b;
+}
+
+BM_INLINE void navmesh_intToCol(int i, float col[3])
+{
+ int r = navmesh_bit(i, 0) + navmesh_bit(i, 3) * 2 + 1;
+ int g = navmesh_bit(i, 1) + navmesh_bit(i, 4) * 2 + 1;
+ int b = navmesh_bit(i, 2) + navmesh_bit(i, 5) * 2 + 1;
+ col[0] = 1 - r*63.0f/255.0f;
+ col[1] = 1 - g*63.0f/255.0f;
+ col[2] = 1 - b*63.0f/255.0f;
+}
+
+static void navmesh_drawColored(DerivedMesh *dm)
+{
+ int a, glmode;
+ MVert *mvert = (MVert *)CustomData_get_layer(&dm->vertData, CD_MVERT);
+ MFace *mface = (MFace *)CustomData_get_layer(&dm->faceData, CD_MFACE);
+ int *polygonIdx = (int *)CustomData_get_layer(&dm->faceData, CD_RECAST);
+ float col[3];
+
+ if (!polygonIdx)
+ return;
+
+ /*
+ //UI_ThemeColor(TH_WIRE);
+ glDisable(GL_LIGHTING);
+ glLineWidth(2.0);
+ dm->drawEdges(dm, 0, 1);
+ glLineWidth(1.0);
+ glEnable(GL_LIGHTING);*/
+
+ glDisable(GL_LIGHTING);
+ /* if(GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
+ DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" );
+ //glShadeModel(GL_SMOOTH);
+ glBegin(glmode = GL_QUADS);
+ for(a = 0; a < dm->numFaceData; a++, mface++) {
+ int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
+ int pi = polygonIdx[a];
+ if (pi <= 0) {
+ zero_v3(col);
+ }
+ else {
+ navmesh_intToCol(pi, col);
+ }
+
+ if(new_glmode != glmode) {
+ glEnd();
+ glBegin(glmode = new_glmode);
+ }
+ glColor3fv(col);
+ glVertex3fv(mvert[mface->v1].co);
+ glVertex3fv(mvert[mface->v2].co);
+ glVertex3fv(mvert[mface->v3].co);
+ if(mface->v4) {
+ glVertex3fv(mvert[mface->v4].co);
+ }
+ }
+ glEnd();
+ }
+ glEnable(GL_LIGHTING);
+}
+
+static void navmesh_DM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr))
+{
+ (void) setDrawOptions;
+
+ navmesh_drawColored(dm);
+}
+
+static void navmesh_DM_drawFacesSolid(DerivedMesh *dm,
+ float (*partial_redraw_planes)[4],
+ int UNUSED(fast), int (*setMaterial)(int, void *attribs))
+{
+ (void) partial_redraw_planes;
+ (void) setMaterial;
+
+ //drawFacesSolid_original(dm, partial_redraw_planes, fast, setMaterial);
+ navmesh_drawColored(dm);
+}
+
+static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm)
+{
+ DerivedMesh *result;
+ int maxFaces = dm->getNumFaces(dm);
+ int *recastData;
+ int vertsPerPoly=0, nverts=0, ndtris=0, npolys=0;
+ float* verts=NULL;
+ unsigned short *dtris=NULL, *dmeshes=NULL, *polys=NULL;
+ int *dtrisToPolysMap=NULL, *dtrisToTrisMap=NULL, *trisToFacesMap=NULL;
+ int res;
+
+ result = CDDM_copy(dm);
+ if (!CustomData_has_layer(&result->faceData, CD_RECAST)) {
+ int *sourceRecastData = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST);
+ if (sourceRecastData) {
+ CustomData_add_layer_named(&result->faceData, CD_RECAST, CD_DUPLICATE,
+ sourceRecastData, maxFaces, "recastData");
+ }
+ }
+ recastData = (int*)CustomData_get_layer(&result->faceData, CD_RECAST);
+
+ /* note: This is not good design! - really should not be doing this */
+ result->drawFacesTex = navmesh_DM_drawFacesTex;
+ result->drawFacesSolid = navmesh_DM_drawFacesSolid;
+
+
+ /* process mesh */
+ res = buildNavMeshDataByDerivedMesh(dm, &vertsPerPoly, &nverts, &verts, &ndtris, &dtris,
+ &npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap,
+ &trisToFacesMap);
+ if (res) {
+ size_t polyIdx;
+
+ /* invalidate concave polygon */
+ for (polyIdx=0; polyIdx<(size_t)npolys; polyIdx++) {
+ unsigned short* poly = &polys[polyIdx*2*vertsPerPoly];
+ if (!polyIsConvex(poly, vertsPerPoly, verts)) {
+ /* set negative polygon idx to all faces */
+ unsigned short *dmesh = &dmeshes[4*polyIdx];
+ unsigned short tbase = dmesh[2];
+ unsigned short tnum = dmesh[3];
+ unsigned short ti;
+
+ for (ti=0; ti<tnum; ti++) {
+ unsigned short triidx = dtrisToTrisMap[tbase+ti];
+ unsigned short faceidx = trisToFacesMap[triidx];
+ if (recastData[faceidx] > 0) {
+ recastData[faceidx] = -recastData[faceidx];
+ }
+ }
+ }
+ }
+ }
+ else {
+ printf("Error during creation polygon infos\n");
+ }
+
+ /* clean up */
+ if (verts!=NULL)
+ MEM_freeN(verts);
+ if (dtris!=NULL)
+ MEM_freeN(dtris);
+ if (dmeshes!=NULL)
+ MEM_freeN(dmeshes);
+ if (polys!=NULL)
+ MEM_freeN(polys);
+ if (dtrisToPolysMap!=NULL)
+ MEM_freeN(dtrisToPolysMap);
+ if (dtrisToTrisMap!=NULL)
+ MEM_freeN(dtrisToTrisMap);
+ if (trisToFacesMap!=NULL)
+ MEM_freeN(trisToFacesMap);
+
+ return result;
+}
+
+#endif /* WITH_GAMEENGINE */
+
+/* --- NAVMESH (end) --- */
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 8d18a1c27e7..8b9f5ac98d3 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 824bbb8f70d..cd2c272a1c2 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1,4 +1,6 @@
-/*
+/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -1514,7 +1516,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
/* in par the family name is stored, use this to find the other objects */
- chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI);
+ chartransdata= BKE_text_to_curve(G.main, scene, par, FO_DUPLI);
if(chartransdata==NULL) return;
cu= par->data;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 13abf18e20c..3cf14fa45ab 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 1149d8eee25..fbbce58414e 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 1c729470da4..5358a26e660 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -1,7 +1,4 @@
-/* blender.c jan 94 MIXED MODEL
- *
- * common help functions and data
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index 6b1f313d88d..d73d7509644 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -1,8 +1,4 @@
/*
- * bmfont.c
- *
- * 04-10-2000 frank
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -26,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): 04-10-2000 frank.
*
* ***** END GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index f9f210fbae4..2a478d4ffe2 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -1,6 +1,4 @@
-/* boids.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c
index 72f5e907800..e4a02434cba 100644
--- a/source/blender/blenkernel/intern/bullet.c
+++ b/source/blender/blenkernel/intern/bullet.c
@@ -1,5 +1,4 @@
-/*
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 91238f20337..0f8aad00368 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -1,5 +1,4 @@
/*
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 055a1eb4eb0..49c715b88d9 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1,41 +1,41 @@
/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2006 Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): Ben Batt <benbatt@gmail.com>
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-* Implementation of CDDerivedMesh.
-*
-* BKE_cdderivedmesh.h contains the function prototypes for this file.
-*
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Ben Batt <benbatt@gmail.com>
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ * Implementation of CDDerivedMesh.
+ *
+ * BKE_cdderivedmesh.h contains the function prototypes for this file.
+ *
+ */
/** \file blender/blenkernel/intern/cdderivedmesh.c
* \ingroup bke
*/
-
+
#include "GL/glew.h"
#include "BLI_blenlib.h"
@@ -756,9 +756,10 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
unsigned char *colors = MEM_mallocN(dm->getNumFaces(dm)*4*3*sizeof(unsigned char), "cdDM_drawFacesTex_common");
for( i=0; i < dm->getNumFaces(dm); i++ ) {
for( j=0; j < 4; j++ ) {
- colors[i*12+j*3] = col[i*4+j].r;
+ /* bgr -> rgb is intentional (and stupid), but how its stored internally */
+ colors[i*12+j*3] = col[i*4+j].b;
colors[i*12+j*3+1] = col[i*4+j].g;
- colors[i*12+j*3+2] = col[i*4+j].b;
+ colors[i*12+j*3+2] = col[i*4+j].r;
}
}
GPU_color3_upload(dm,colors);
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 7747e4750b7..83003809a37 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -419,12 +419,10 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
}
if(bezt->h1==HD_VECT) { /* vector */
- mul_v2_fl(dvec_a, 1.0f/3.0f);
- sub_v2_v2v2(p2-3, p2, dvec_a);
+ madd_v2_v2v2fl(p2-3, p2, dvec_a, -1.0f/3.0f);
}
if(bezt->h2==HD_VECT) {
- mul_v2_fl(dvec_b, 1.0f/3.0f);
- sub_v2_v2v2(p2+3, p2, dvec_b);
+ madd_v2_v2v2fl(p2+3, p2, dvec_b, 1.0f/3.0f);
}
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 75e137bc9fb..591e0b6a8d2 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index b703c33f174..2e9ad11c6ca 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1,7 +1,4 @@
-
-/* curve.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -2595,12 +2592,10 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
}
if(bezt->h1==HD_VECT) { /* vector */
- mul_v3_fl(dvec_a, 1.0f/3.0f);
- sub_v3_v3v3(p2-3, p2, dvec_a);
+ madd_v3_v3v3fl(p2-3, p2, dvec_a, -1.0f/3.0f);
}
if(bezt->h2==HD_VECT) {
- mul_v3_fl(dvec_b, 1.0f/3.0f);
- sub_v3_v3v3(p2+3, p2, dvec_b);
+ madd_v3_v3v3fl(p2+3, p2, dvec_b, 1.0f/3.0f);
}
len_b= len_v3v3(p2, p2+3);
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index b0c52421dd9..81f57ea12ee 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1,36 +1,36 @@
/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2006 Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): Ben Batt <benbatt@gmail.com>
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-* Implementation of CustomData.
-*
-* BKE_customdata.h contains the function prototypes for this file.
-*
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Ben Batt <benbatt@gmail.com>
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ * Implementation of CustomData.
+ *
+ * BKE_customdata.h contains the function prototypes for this file.
+ *
+ */
/** \file blender/blenkernel/intern/customdata.c
* \ingroup bke
@@ -2402,10 +2402,8 @@ int CustomData_verify_versions(struct CustomData *data, int index)
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
{
- char *path = (id->lib)? id->lib->filepath: G.main->name;
-
BLI_strncpy(filename, external->filename, FILE_MAX);
- BLI_path_abs(filename, path);
+ BLI_path_abs(filename, ID_BLEND_PATH(G.main, id));
}
void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem)
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 11a0a5884ee..f18f533d460 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -1,9 +1,4 @@
-/* deform.c June 2001
- *
- * support for deformation groups
- *
- * Reevan McKay
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -27,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Reevan McKay
*
* ***** END GPL LICENSE BLOCK *****
*/
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index acc900d0b71..fb67c07cfe9 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1,6 +1,4 @@
-/* displist.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -1207,7 +1205,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if(cu->path) free_path(cu->path);
cu->path= NULL;
- if(ob->type==OB_FONT) BKE_text_to_curve(scene, ob, 0);
+ if(ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0);
if(!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 7fb9f96e0cf..5ce7b82a45f 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1,6 +1,4 @@
-/* effect.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 8ea80ae9296..e2326b005c1 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 95c0aa60991..d5c54893128 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 6898615c753..9c01b35b91a 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -1,6 +1,4 @@
-/* font.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -284,7 +282,7 @@ struct TmpFont *vfont_find_tmpfont(VFont *vfont)
return tmpfnt;
}
-static VFontData *vfont_get_data(VFont *vfont)
+static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
{
struct TmpFont *tmpfnt = NULL;
PackedFile *tpf;
@@ -319,11 +317,11 @@ static VFontData *vfont_get_data(VFont *vfont)
BLI_addtail(&ttfdata, tmpfnt);
}
} else {
- pf= newPackedFile(NULL, vfont->name);
+ pf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
if(!tmpfnt)
{
- tpf= newPackedFile(NULL, vfont->name);
+ tpf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
// Add temporary packed file to globals
tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
@@ -351,7 +349,7 @@ static VFontData *vfont_get_data(VFont *vfont)
return vfont->data;
}
-VFont *load_vfont(const char *name)
+VFont *load_vfont(Main *bmain, const char *name)
{
char filename[FILE_MAXFILE];
VFont *vfont= NULL;
@@ -371,8 +369,8 @@ VFont *load_vfont(const char *name)
BLI_strncpy(dir, name, sizeof(dir));
BLI_splitdirstring(dir, filename);
- pf= newPackedFile(NULL, name);
- tpf= newPackedFile(NULL, name);
+ pf= newPackedFile(NULL, name, bmain->name);
+ tpf= newPackedFile(NULL, name, bmain->name);
is_builtin= 0;
}
@@ -382,7 +380,7 @@ VFont *load_vfont(const char *name)
vfd= BLI_vfontdata_from_freetypefont(pf);
if (vfd) {
- vfont = alloc_libblock(&G.main->vfont, ID_VF, filename);
+ vfont = alloc_libblock(&bmain->vfont, ID_VF, filename);
vfont->data = vfd;
/* if there's a font name, use it for the ID name */
@@ -439,7 +437,7 @@ VFont *get_builtin_font(void)
if (strcmp(vf->name, FO_BUILTIN_NAME)==0)
return vf;
- return load_vfont(FO_BUILTIN_NAME);
+ return load_vfont(G.main, FO_BUILTIN_NAME);
}
static VChar *find_vfont_char(VFontData *vfd, intptr_t character)
@@ -500,7 +498,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
}
-static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx)
+static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx)
{
BezTriple *bezt1, *bezt2;
Nurb *nu1 = NULL, *nu2 = NULL;
@@ -509,7 +507,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float
VChar *che = NULL;
int i;
- vfd= vfont_get_data(which_vfont(cu, info));
+ vfd= vfont_get_data(bmain, which_vfont(cu, info));
if (!vfd) return;
/*
@@ -548,7 +546,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float
nu2->knotsu = nu2->knotsv = NULL;
nu2->flag= CU_SMOOTH;
nu2->charidx = charidx;
- if (info->mat_nr) {
+ if (info->mat_nr > 0) {
nu2->mat_nr= info->mat_nr-1;
}
else {
@@ -662,7 +660,7 @@ static float char_width(Curve *cu, VChar *che, CharInfo *info)
}
}
-struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
+struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int mode)
{
VFont *vfont, *oldvfont;
VFontData *vfd= NULL;
@@ -714,7 +712,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
if (cu->tb==NULL)
cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "TextBox compat");
- vfd= vfont_get_data(vfont);
+ vfd= vfont_get_data(bmain, vfont);
/* The VFont Data can not be found */
if(!vfd) {
@@ -792,7 +790,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
}
if (vfont != oldvfont) {
- vfd= vfont_get_data(vfont);
+ vfd= vfont_get_data(bmain, vfont);
oldvfont = vfont;
}
@@ -1157,7 +1155,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
}
// We do not want to see any character for \n or \r
if(cha != '\n' && cha != '\r')
- buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i);
+ buildchar(bmain, cu, cha, info, ct->xof, ct->yof, ct->rot, i);
if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) {
float ulwidth, uloverlap= 0.0f;
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c2e94cc97db..fa493315d4b 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -182,8 +184,8 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
gpl->thickness = 3;
/* auto-name */
- sprintf(gpl->info, "GP_Layer");
- BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info[0]), sizeof(gpl->info));
+ strcpy(gpl->info, "GP_Layer");
+ BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
/* make this one the active one */
gpencil_layer_setactive(gpd, gpl);
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 9effd25c142..07bb4666134 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -1,32 +1,32 @@
/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2006-2007 Blender Foundation.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): none yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2006-2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
/** \file blender/blenkernel/intern/icons.c
* \ingroup bke
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index d764826cd47..cf8f96c143a 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1,5 +1,4 @@
-/* image.c
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -1480,7 +1479,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
/* try to repack file */
if(ima->packedfile) {
PackedFile *pf;
- pf = newPackedFile(NULL, ima->name);
+ pf = newPackedFile(NULL, ima->name, ID_BLEND_PATH(G.main, &ima->id));
if (pf) {
freePackedFile(ima->packedfile);
ima->packedfile = pf;
@@ -1653,10 +1652,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
BLI_stringdec(name, head, tail, &numlen);
BLI_stringenc(name, head, tail, numlen, frame);
- if(ima->id.lib)
- BLI_path_abs(name, ima->id.lib->filepath);
- else
- BLI_path_abs(name, G.main->name);
+ BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id));
flag= IB_rect|IB_multilayer;
if(ima->flag & IMA_DO_PREMUL)
@@ -1768,11 +1764,8 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
char str[FILE_MAX];
BLI_strncpy(str, ima->name, FILE_MAX);
- if(ima->id.lib)
- BLI_path_abs(str, ima->id.lib->filepath);
- else
- BLI_path_abs(str, G.main->name);
-
+ BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
+
/* FIXME: make several stream accessible in image editor, too*/
ima->anim = openanim(str, IB_rect, 0);
@@ -1834,10 +1827,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
/* get the right string */
BLI_strncpy(str, ima->name, sizeof(str));
- if(ima->id.lib)
- BLI_path_abs(str, ima->id.lib->filepath);
- else
- BLI_path_abs(str, G.main->name);
+ BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
/* read ibuf */
ibuf = IMB_loadiffname(str, flag);
@@ -1860,7 +1850,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
/* make packed file for autopack */
if ((ima->packedfile == NULL) && (G.fileflags & G_AUTOPACK))
- ima->packedfile = newPackedFile(NULL, str);
+ ima->packedfile = newPackedFile(NULL, str, ID_BLEND_PATH(G.main, &ima->id));
}
}
else
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 5b237665290..f4d1ff4241d 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -1,5 +1,4 @@
-/* image_gen.c
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index b885e608b15..91f3c7a22ba 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1,4 +1,6 @@
-/*
+/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 656bb3ef853..9e48e691b87 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1,7 +1,4 @@
-
-/* key.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 094214858f9..cbff9c2337e 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -1,7 +1,4 @@
/*
- * lattice.c
- *
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 677a2922666..1dc53811fc0 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -941,9 +941,9 @@ static void get_flags_for_id(ID *id, char *buf)
isnode= ((Tex *)id)->use_nodes;
if (id->us<0)
- sprintf(buf, "-1W ");
+ strcpy(buf, "-1W ");
else if (!id->lib && !isfake && id->us && !isnode)
- sprintf(buf, " ");
+ strcpy(buf, " ");
else if(isnode)
sprintf(buf, "%c%cN%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' ');
else
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 6e1303e375e..ebd05ab9bf8 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1,7 +1,4 @@
-
-/* material.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -1108,8 +1105,17 @@ int object_remove_material_slot(Object *ob)
short *totcolp;
short a, actcol;
- if(ob==NULL || ob->totcol==0) return FALSE;
-
+ if (ob==NULL || ob->totcol==0) {
+ return FALSE;
+ }
+
+ /* this should never happen and used to crash */
+ if (ob->actcol <= 0) {
+ printf("%s: invalid material index %d, report a bug!\n", __func__, ob->actcol);
+ BLI_assert(0);
+ return FALSE;
+ }
+
/* take a mesh/curve/mball as starting point, remove 1 index,
* AND with all objects that share the ob->data
*
@@ -1122,10 +1128,8 @@ int object_remove_material_slot(Object *ob)
if(*matarar==NULL) return FALSE;
/* we delete the actcol */
- if(ob->totcol) {
- mao= (*matarar)[ob->actcol-1];
- if(mao) mao->id.us--;
- }
+ mao= (*matarar)[ob->actcol-1];
+ if(mao) mao->id.us--;
for(a=ob->actcol; a<ob->totcol; a++)
(*matarar)[a-1]= (*matarar)[a];
@@ -1995,6 +1999,11 @@ int do_version_tface(Main *main, int fileload)
}
}
}
+ /* material is not used by faces with texface
+ * set the default flag - do it only once */
+ else
+ if (fileload)
+ ma->game.flag = GEMAT_BACKCULL;
}
return nowarning;
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 555d35726bc..05d07ddf918 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1,11 +1,4 @@
-/* mball.c
- *
- * MetaBalls are created from a single Object (with a name without number in it),
- * here the DispList and BoundBox also is located.
- * All objects with the same name (but with a number in it) are added to this.
- *
- * texture coordinates are patched within the displist
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -30,13 +23,18 @@
* Contributor(s): Jiri Hnidek <jiri.hnidek@vslib.cz>.
*
* ***** END GPL LICENSE BLOCK *****
+ *
+ * MetaBalls are created from a single Object (with a name without number in it),
+ * here the DispList and BoundBox also is located.
+ * All objects with the same name (but with a number in it) are added to this.
+ *
+ * texture coordinates are patched within the displist
*/
/** \file blender/blenkernel/intern/mball.c
* \ingroup bke
*/
-
#include <stdio.h>
#include <string.h>
#include <math.h>
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 810e7c285e8..9574c886ccc 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1,8 +1,4 @@
-
-/* mesh.c
- *
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -1606,3 +1602,19 @@ void mesh_translate(Mesh *me, float offset[3], int do_keys)
}
}
}
+
+
+void BKE_mesh_ensure_navmesh(Mesh *me)
+{
+ if (!CustomData_has_layer(&me->fdata, CD_RECAST)) {
+ int i;
+ int numFaces = me->totface;
+ int* recastData;
+ CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
+ recastData = (int*)CustomData_get_layer(&me->fdata, CD_RECAST);
+ for (i=0; i<numFaces; i++) {
+ recastData[i] = i+1;
+ }
+ CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
+ }
+}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index fe26c0ccd2d..9de75a49998 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -1,38 +1,38 @@
/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2005 by the Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s): Daniel Dunbar
-* Ton Roosendaal,
-* Ben Batt,
-* Brecht Van Lommel,
-* Campbell Barton
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-* Modifier stack implementation.
-*
-* BKE_modifier.h contains the function prototypes for this file.
-*
-*/
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2005 by the Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Daniel Dunbar
+ * Ton Roosendaal,
+ * Ben Batt,
+ * Brecht Van Lommel,
+ * Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ * Modifier stack implementation.
+ *
+ * BKE_modifier.h contains the function prototypes for this file.
+ *
+ */
/** \file blender/blenkernel/intern/modifier.c
* \ingroup bke
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index 04f6ff19564..f670486484b 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -1,31 +1,35 @@
-/**
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): none yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*/
+/*
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/navmesh_conversion.c
+ * \ingroup bke
+ */
#include <math.h>
#include <stdlib.h>
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 6ce80342dd6..97347d85deb 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1,4 +1,6 @@
/*
+ * $Id$
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -1284,16 +1286,16 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
if (strip->name[0]==0) {
switch (strip->type) {
case NLASTRIP_TYPE_CLIP: /* act-clip */
- sprintf(strip->name, "%s", (strip->act)?(strip->act->id.name+2):("<No Action>"));
+ BLI_strncpy(strip->name, (strip->act)?(strip->act->id.name+2):("<No Action>"), sizeof(strip->name));
break;
case NLASTRIP_TYPE_TRANSITION: /* transition */
- sprintf(strip->name, "Transition");
+ BLI_strncpy(strip->name, "Transition", sizeof(strip->name));
break;
case NLASTRIP_TYPE_META: /* meta */
- sprintf(strip->name, "Meta");
+ BLI_strncpy(strip->name, "Meta", sizeof(strip->name));
break;
default:
- sprintf(strip->name, "NLA Strip");
+ BLI_strncpy(strip->name, "NLA Strip", sizeof(strip->name));
break;
}
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 81a31c83e95..2b6db72bd07 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1,6 +1,4 @@
-/* object.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index ed729d819b7..2c8975e9cb4 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -1,6 +1,4 @@
/*
- * blenkernel/packedFile.c - (cleaned up mar-01 nzc)
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -168,7 +166,7 @@ PackedFile *newPackedFileMemory(void *mem, int memlen)
return pf;
}
-PackedFile *newPackedFile(ReportList *reports, const char *filename)
+PackedFile *newPackedFile(ReportList *reports, const char *filename, const char *basepath)
{
PackedFile *pf = NULL;
int file, filelen;
@@ -185,7 +183,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename)
// convert relative filenames to absolute filenames
strcpy(name, filename);
- BLI_path_abs(name, G.main->name);
+ BLI_path_abs(name, basepath);
// open the file
// and create a PackedFile structure
@@ -224,7 +222,7 @@ void packAll(Main *bmain, ReportList *reports)
for(ima=bmain->image.first; ima; ima=ima->id.next) {
if(ima->packedfile == NULL && ima->id.lib==NULL) {
if(ima->source==IMA_SRC_FILE) {
- ima->packedfile = newPackedFile(reports, ima->name);
+ ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
}
else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2);
@@ -234,11 +232,11 @@ void packAll(Main *bmain, ReportList *reports)
for(vf=bmain->vfont.first; vf; vf=vf->id.next)
if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0)
- vf->packedfile = newPackedFile(reports, vf->name);
+ vf->packedfile = newPackedFile(reports, vf->name, bmain->name);
for(sound=bmain->sound.first; sound; sound=sound->id.next)
if(sound->packedfile == NULL && sound->id.lib==NULL)
- sound->packedfile = newPackedFile(reports, sound->name);
+ sound->packedfile = newPackedFile(reports, sound->name, bmain->name);
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 124ea3680b1..61dd36fc34d 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1,6 +1,4 @@
-/* particle.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index c0f1e3dd697..6b601ed4b1a 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -1,6 +1,4 @@
-/* particle_system.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index d0e4832889b..cdf2e39a4dd 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -1,7 +1,4 @@
-
-/* property.c june 2000
- *
- * ton roosendaal
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -25,7 +22,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): ton roosendaal
*
* ***** END GPL LICENSE BLOCK *****
*/
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 1a72405ad5e..5ea635d8c30 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1,6 +1,4 @@
-/* scene.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c
index 77153fc37ba..77a79a6c8a4 100644
--- a/source/blender/blenkernel/intern/script.c
+++ b/source/blender/blenkernel/intern/script.c
@@ -1,10 +1,6 @@
-/* blenkernel/script.c
- *
- *
+/*
* $Id$
*
- * Function(s) related to struct script management.
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index 00f88fb6202..88e9d9209d4 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -1,5 +1,5 @@
/*
-* $Id$
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 08848c35add..5a2c53f5b9b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1,5 +1,5 @@
/*
-* $Id$
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c
index 432dc9ec609..a5afc0afda1 100644
--- a/source/blender/blenkernel/intern/sketch.c
+++ b/source/blender/blenkernel/intern/sketch.c
@@ -1,5 +1,4 @@
/*
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 6ab1574ca80..85140841f15 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1,6 +1,4 @@
/*
- * smoke.c
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 784c67d6d77..88f72c33802 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -1,5 +1,4 @@
-/* softbody.c
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 73d0d70778f..f2d92154c66 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -340,20 +340,13 @@ void sound_load(struct Main *bmain, struct bSound* sound)
#endif
{
char fullpath[FILE_MAX];
- char *path;
/* load sound */
PackedFile* pf = sound->packedfile;
/* dont modify soundact->sound->name, only change a copy */
BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
-
- if(sound->id.lib)
- path = sound->id.lib->filepath;
- else
- path = bmain->name;
-
- BLI_path_abs(fullpath, path);
+ BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
/* but we need a packed file then */
if (pf)
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index 200dbd41899..ae29230423f 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -1,6 +1,4 @@
-/* speaker.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 02cffcec249..b5fc76a8551 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -1,6 +1,4 @@
-/* text.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index ea6f6eb702b..d344f79bb6c 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1,6 +1,4 @@
-/* texture.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index d413177873f..7d278f37cfb 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -1,7 +1,4 @@
-
-/* world.c
- *
- *
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 769a3f9b11e..b989d44c391 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -1,7 +1,4 @@
/*
- * Functions for writing avi-format files.
- * Added interface for generic movie support (ton)
- *
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -28,7 +25,9 @@
* Contributor(s): Robert Wenzlaff
*
* ***** END GPL LICENSE BLOCK *****
- *
+ *
+ * Functions for writing avi-format files.
+ * Added interface for generic movie support (ton)
*/
/** \file blender/blenkernel/intern/writeavi.c
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 6010770e1ee..58a2f45e876 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1,6 +1,3 @@
-/** \file blender/blenkernel/intern/writeffmpeg.c
- * \ingroup bke
- */
/*
* $Id$
*
@@ -20,6 +17,10 @@
*
*/
+/** \file blender/blenkernel/intern/writeffmpeg.c
+ * \ingroup bke
+ */
+
#ifdef WITH_FFMPEG
#include <string.h>
#include <stdio.h>
@@ -571,6 +572,11 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
return NULL;
}
+ /* need to prevent floating point exception when using vorbis audio codec,
+ initialize this value in the same way as it's done in FFmpeg iteslf (sergey) */
+ st->codec->time_base.num= 1;
+ st->codec->time_base.den= st->codec->sample_rate;
+
audio_outbuf_size = FF_MIN_BUFFER_SIZE;
if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
@@ -743,7 +749,11 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
}
}
- av_write_header(of);
+ if (av_write_header(of) < 0) {
+ BKE_report(reports, RPT_ERROR, "Could not initialize streams. Probably unsupported codec combination.");
+ return 0;
+ }
+
outfile = of;
av_dump_format(of, 0, name, 1);
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index 15cb3b66db7..d42b952617f 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -1,6 +1,3 @@
-/** \file blender/blenkernel/intern/writeframeserver.c
- * \ingroup bke
- */
/*
* $Id$
*
@@ -22,6 +19,10 @@
*
*/
+/** \file blender/blenkernel/intern/writeframeserver.c
+ * \ingroup bke
+ */
+
#ifdef WITH_FRAMESERVER
#include <string.h>
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 8adede3337c..ab7d082c432 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1430,21 +1430,40 @@ void BLI_split_dirfile(const char *string, char *dir, char *file)
}
/* simple appending of filename to dir, does not check for valid path! */
-void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file)
+void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const char *file)
{
- int sl_dir;
-
- if(string != dir) /* compare pointers */
- BLI_strncpy(string, dir, maxlen);
+ size_t dirlen= BLI_strnlen(dir, maxlen);
+
+ if (dst != dir) {
+ if(dirlen == maxlen) {
+ memcpy(dst, dir, dirlen);
+ dst[dirlen - 1]= '\0';
+ return; /* dir fills the path */
+ }
+ else {
+ memcpy(dst, dir, dirlen + 1);
+ }
+ }
+
+ if (dirlen + 1 >= maxlen) {
+ return; /* fills the path */
+ }
+
+ /* inline BLI_add_slash */
+ if (dst[dirlen - 1] != SEP) {
+ dst[dirlen++]= SEP;
+ dst[dirlen ]= '\0';
+ }
+
+ if (dirlen >= maxlen) {
+ return; /* fills the path */
+ }
- if (!file)
+ if (file == NULL) {
return;
-
- sl_dir= BLI_add_slash(string);
-
- if (sl_dir <FILE_MAX) {
- BLI_strncpy(string + sl_dir, file, maxlen - sl_dir);
}
+
+ BLI_strncpy(dst + dirlen, file, maxlen - dirlen);
}
/* like pythons os.path.basename( ) */
@@ -1584,19 +1603,11 @@ char *BLI_last_slash(const char *string)
int BLI_add_slash(char *string)
{
int len = strlen(string);
-#ifdef WIN32
- if (len==0 || string[len-1]!='\\') {
- string[len] = '\\';
- string[len+1] = '\0';
- return len+1;
- }
-#else
- if (len==0 || string[len-1]!='/') {
- string[len] = '/';
+ if (len==0 || string[len-1] != SEP) {
+ string[len] = SEP;
string[len+1] = '\0';
return len+1;
}
-#endif
return len;
}
@@ -1605,11 +1616,7 @@ void BLI_del_slash(char *string)
{
int len = strlen(string);
while (len) {
-#ifdef WIN32
- if (string[len-1]=='\\') {
-#else
- if (string[len-1]=='/') {
-#endif
+ if (string[len-1] == SEP) {
string[len-1] = '\0';
len--;
} else {
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index bf816a91fb3..3b14abb0bee 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -109,7 +109,7 @@ void RegisterBlendExtension(void) {
lresult = RegCreateKeyEx(root, "blendfile", 0,
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
- sprintf(buffer,"%s","Blender File");
+ strcpy(buffer,"Blender File");
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
RegCloseKey(hkey);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index edc96aa9ef6..a3b60b18c39 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4532,7 +4532,9 @@ static void lib_link_scene(FileData *fd, Main *main)
seq->scene_sound = NULL;
if(seq->scene) {
seq->scene= newlibadr(fd, sce->id.lib, seq->scene);
- seq->scene_sound = sound_scene_add_scene_sound(sce, seq, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
+ if(seq->scene) {
+ seq->scene_sound = sound_scene_add_scene_sound(sce, seq, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs);
+ }
}
if(seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera);
if(seq->sound) {
@@ -7104,6 +7106,19 @@ void convert_tface_mt(FileData *fd, Main *main)
}
}
+static void do_versions_nodetree_image_default_alpha_output(bNodeTree *ntree)
+{
+ bNode *node;
+ bNodeSocket *sock;
+ for (node=ntree->nodes.first; node; node=node->next) {
+ if (ELEM(node->type, CMP_NODE_IMAGE, CMP_NODE_R_LAYERS)) {
+ /* default Image output value should have 0 alpha */
+ sock = node->outputs.first;
+ ((bNodeSocketValueRGBA*)sock->default_value)->value[3] = 0.0f;
+ }
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -10422,7 +10437,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma->mode |= MA_TRANSP;
}
else {
- ma->mode |= MA_ZTRANSP;
+ /* ma->mode |= MA_ZTRANSP; */ /* leave ztransp as is even if its not used [#28113] */
ma->mode &= ~MA_TRANSP;
}
@@ -11793,7 +11808,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(!mat->mtex[tex_nr]) continue;
if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
}
-
+
+ /* weak! material alpha could be animated */
if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){
mat->mode |= MA_TRANSP;
mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
@@ -12158,9 +12174,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(mtex) {
if((mtex->texflag&MTEX_BUMP_FLIPPED)==0) {
- if((mtex->mapto&MAP_NORM) && mtex->texflag&(MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) {
- mtex->norfac= -mtex->norfac;
- mtex->texflag|= MTEX_BUMP_FLIPPED;
+ if((mtex->mapto&MAP_DISPLACE)==0) {
+ if((mtex->mapto&MAP_NORM) && mtex->texflag&(MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) {
+ Tex *tex= newlibadr(fd, lib, mtex->tex);
+
+ if(!tex || (tex->imaflag&TEX_NORMALMAP)==0) {
+ mtex->norfac= -mtex->norfac;
+ mtex->texflag|= MTEX_BUMP_FLIPPED;
+ }
+ }
}
}
}
@@ -12174,6 +12196,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */
{
+ {
+ /* set default alpha value of Image outputs in image and render layer nodes to 0 */
+ Scene *sce;
+ bNodeTree *ntree;
+
+ for (sce=main->scene.first; sce; sce=sce->id.next) {
+ /* there are files with invalid audio_channels value, the real cause
+ is unknown, but we fix it here anyway to avoid crashes */
+ if(sce->r.ffcodecdata.audio_channels == 0)
+ sce->r.ffcodecdata.audio_channels = 2;
+
+ if (sce->nodetree)
+ do_versions_nodetree_image_default_alpha_output(sce->nodetree);
+ }
+
+ for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+ do_versions_nodetree_image_default_alpha_output(ntree);
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index d2b1fcc4abd..2774bd2cda4 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -71,12 +71,12 @@ void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short
if (timecodes) {
int hours=0, minutes=0, seconds=0, frames=0;
float raw_seconds= cfra;
- char neg[2]= "";
+ char neg[2]= {'\0'};
/* get cframes */
if (cfra < 0) {
/* correction for negative cfraues */
- sprintf(neg, "-");
+ neg[0]= '-';
cfra = -cfra;
}
if (cfra >= 3600) {
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 9c43671cdf4..383e0bac796 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -63,9 +63,9 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
return icon;
else if ELEM3(NULL, id, fcu, fcu->rna_path) {
if (fcu == NULL)
- sprintf(name, "<invalid>");
+ strcpy(name, "<invalid>");
else if (fcu->rna_path == NULL)
- sprintf(name, "<no path>");
+ strcpy(name, "<no path>");
else /* id == NULL */
BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index);
}
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index b52550832c3..fb34245d338 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1748,3 +1748,56 @@ short id_frame_has_keyframe (ID *id, float frame, short filter)
}
/* ************************************************** */
+
+int ED_autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks)
+{
+ /* auto keyframing */
+ if (autokeyframe_cfra_can_key(scene, &ob->id)) {
+ ListBase dsources = {NULL, NULL};
+
+ /* now insert the keyframe(s) using the Keying Set
+ * 1) add datasource override for the Object
+ * 2) insert keyframes
+ * 3) free the extra info
+ */
+ ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL);
+ ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
+ BLI_freelistN(&dsources);
+
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+int ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
+{
+ if (autokeyframe_cfra_can_key(scene, &ob->id)) {
+ ListBase dsources = {NULL, NULL};
+
+ /* now insert the keyframe(s) using the Keying Set
+ * 1) add datasource override for the PoseChannel
+ * 2) insert keyframes
+ * 3) free the extra info
+ */
+ ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan);
+ ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
+ BLI_freelistN(&dsources);
+
+ /* clear any unkeyed tags */
+ if (pchan->bone) {
+ pchan->bone->flag &= ~BONE_UNKEYED;
+ }
+
+ return TRUE;
+ }
+ else {
+ /* add unkeyed tags */
+ if (pchan->bone) {
+ pchan->bone->flag |= BONE_UNKEYED;
+ }
+
+ return FALSE;
+ }
+}
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 43122ea08d3..61935aa72ca 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -1149,7 +1149,10 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
bPoseChannel *chan;
int flip= RNA_boolean_get(op->ptr, "flipped");
int selOnly= RNA_boolean_get(op->ptr, "selected_mask");
-
+
+ /* get KeyingSet to use */
+ KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "LocRotScale");
+
/* sanity checks */
if ELEM(NULL, ob, ob->pose)
return OPERATOR_CANCELLED;
@@ -1166,7 +1169,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
if (CTX_DATA_COUNT(C, selected_pose_bones) == 0)
selOnly = 0;
}
-
+
/* Safely merge all of the channels in the buffer pose into any existing pose */
for (chan= g_posebuf->chanbase.first; chan; chan=chan->next) {
if (chan->flag & POSE_KEY) {
@@ -1175,30 +1178,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
if (pchan) {
/* keyframing tagging for successful paste */
- if (autokeyframe_cfra_can_key(scene, &ob->id)) {
- ListBase dsources = {NULL, NULL};
-
- /* get KeyingSet to use */
- KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "LocRotScale");
-
- /* now insert the keyframe(s) using the Keying Set
- * 1) add datasource override for the PoseChannel
- * 2) insert keyframes
- * 3) free the extra info
- */
- ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan);
- ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
- BLI_freelistN(&dsources);
-
- /* clear any unkeyed tags */
- if (chan->bone)
- chan->bone->flag &= ~BONE_UNKEYED;
- }
- else {
- /* add unkeyed tags */
- if (chan->bone)
- chan->bone->flag |= BONE_UNKEYED;
- }
+ ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
}
}
}
@@ -2194,29 +2174,8 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
if (pchan->rotmode == ROT_MODE_QUAT) {
/* quaternions have 720 degree range */
negate_v4(pchan->quat);
-
- /* tagging */
- if (autokeyframe_cfra_can_key(scene, &ob->id)) {
- ListBase dsources = {NULL, NULL};
-
- /* now insert the keyframe(s) using the Keying Set
- * 1) add datasource override for the PoseChannel
- * 2) insert keyframes
- * 3) free the extra info
- */
- ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan);
- ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
- BLI_freelistN(&dsources);
-
- /* clear any unkeyed tags */
- if (pchan->bone)
- pchan->bone->flag &= ~BONE_UNKEYED;
- }
- else {
- /* add unkeyed tags */
- if (pchan->bone)
- pchan->bone->flag |= BONE_UNKEYED;
- }
+
+ ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
}
}
CTX_DATA_END;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index fcac070f84e..1f2ef79e091 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -259,17 +259,25 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int recalc, int mode)
{
+ struct Main *bmain= CTX_data_main(C);
Curve *cu= obedit->data;
EditFont *ef= cu->editfont;
cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0];
- if(obedit->totcol>0)
+ if(obedit->totcol > 0) {
obedit->actcol= ef->textbufinfo[cu->pos?cu->pos-1:0].mat_nr;
+ /* since this array is calloc'd, it can be 0 even though we try ensure
+ * (mat_nr > 0) almost everywhere */
+ if (obedit->actcol < 1) {
+ obedit->actcol= 1;
+ }
+ }
+
if(mode == FO_EDIT)
update_string(cu);
- BKE_text_to_curve(scene, obedit, mode);
+ BKE_text_to_curve(bmain, scene, obedit, mode);
if(recalc)
DAG_id_tag_update(obedit->data, 0);
@@ -928,9 +936,10 @@ static int move_cursor(bContext *C, int type, int select)
if(select == 0) {
if(cu->selstart) {
+ struct Main *bmain= CTX_data_main(C);
cu->selstart = cu->selend = 0;
update_string(cu);
- BKE_text_to_curve(scene, obedit, FO_SELCHANGE);
+ BKE_text_to_curve(bmain, scene, obedit, FO_SELCHANGE);
}
}
@@ -1644,13 +1653,14 @@ static int open_cancel(bContext *UNUSED(C), wmOperator *op)
static int open_exec(bContext *C, wmOperator *op)
{
+ struct Main *bmain= CTX_data_main(C);
VFont *font;
PropertyPointerRNA *pprop;
PointerRNA idptr;
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
- font= load_vfont(filepath);
+ font= load_vfont(bmain, filepath);
if(!font) {
if(op->customdata) MEM_freeN(op->customdata);
@@ -1697,10 +1707,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
}
path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir;
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
+
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index cfa9585868e..8e83b01fc2f 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -114,12 +114,14 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
/* don't draw stroke at all! */
}
else {
- float oldpressure = 0.0f;
+ float oldpressure = points[0].pressure;
/* draw stroke curve */
if (G.f & G_DEBUG) setlinestyle(2);
-
+
+ glLineWidth(oldpressure * thickness);
glBegin(GL_LINE_STRIP);
+
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
/* if there was a significant pressure change, stop the curve, change the thickness of the stroke,
* and continue drawing again (since line-width cannot change in middle of GL_LINE_STRIP)
@@ -144,6 +146,9 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
glVertex2f(pt->x, pt->y);
}
glEnd();
+
+ /* reset for predictable OpenGL context */
+ glLineWidth(1.0f);
if (G.f & G_DEBUG) setlinestyle(0);
}
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index cda3c4f3e71..8dd543d8f63 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -313,6 +313,11 @@ typedef enum eAnimFilterFlags {
ANIMFILTER_KEYS_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */
} eAnimFilterFlags;
+/* utility funcs for auto keyframe */
+int ED_autokeyframe_object(struct bContext *C, struct Scene *scene, struct Object *ob, struct KeyingSet *ks);
+int ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct KeyingSet *ks);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index a5781ab7267..a06497889d9 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -749,6 +749,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex);
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
+void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
void uiTemplateList(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *activeptr, const char *activeprop, int rows, int maxrows, int type);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 5ebdf78e611..a816c1612a1 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2519,7 +2519,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->pos= -1; /* cursor invisible */
if(ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) { /* add a space to name */
- slen= strlen(but->str);
+ /* slen remains unchanged from previous assignment, ensure this stays true */
if(slen>0 && slen<UI_MAX_NAME_STR-2) {
if(but->str[slen-1]!=' ') {
but->str[slen]= ' ';
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index b4970d5933c..9af9b2f55ad 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1307,12 +1307,12 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
}
/* mouse inside the widget */
else if (x >= startx) {
- float aspect= (but->block->aspect);
+ const float aspect_sqrt= sqrtf(but->block->aspect);
but->pos= strlen(origstr)-but->ofs;
/* XXX does not take zoom level into account */
- while (startx + aspect*BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) {
+ while (startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) {
if (but->pos <= 0) break;
but->pos--;
origstr[but->pos+but->ofs] = 0;
@@ -1368,144 +1368,125 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc
return changed;
}
-static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump)
+static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump, int jump_all)
{
- char *str;
- int len;
-
- str= data->str;
- len= strlen(str);
+ const char *str= data->str;
+ const int len= strlen(str);
+ const int pos_prev= but->pos;
+ const int has_sel= (but->selend - but->selsta) > 0;
- if(direction) { /* right*/
- /* if there's a selection */
- if ((but->selend - but->selsta) > 0) {
- /* extend the selection based on the first direction taken */
- if(select) {
- if (!data->selextend) {
- data->selextend = EXTEND_RIGHT;
- }
- if (data->selextend == EXTEND_RIGHT) {
- but->selend++;
- if (but->selend > len) but->selend = len;
- } else if (data->selextend == EXTEND_LEFT) {
- but->selsta++;
- /* if the selection start has gone past the end,
- * flip them so they're in sync again */
- if (but->selsta == but->selend) {
- but->pos = but->selsta;
- data->selextend = EXTEND_RIGHT;
- }
- }
- } else {
+ /* special case, quit selection and set cursor */
+ if (has_sel && !select) {
+ if (jump_all) {
+ but->selsta = but->selend= but->pos = direction ? len : 0;
+ }
+ else {
+ if (direction) {
but->selsta = but->pos = but->selend;
- data->selextend = 0;
}
- } else {
- if(select) {
- /* make a selection, starting from the cursor position */
- int tlen;
- but->selsta = but->pos;
-
- but->pos++;
- if(but->pos > (tlen= strlen(str))) but->pos= tlen;
-
- but->selend = but->pos;
- } else if(jump) {
- /* jump betweenn special characters (/,\,_,-, etc.),
+ else {
+ but->pos = but->selend = but->selsta;
+ }
+ }
+ data->selextend = 0;
+ }
+ else {
+ if(direction) { /* right*/
+ if(jump) {
+ /* jump between special characters (/,\,_,-, etc.),
* look at function test_special_char() for complete
* list of special character, ctr -> */
while(but->pos < len) {
but->pos++;
- if(test_special_char(str[but->pos])) break;
+ if(!jump_all && test_special_char(str[but->pos])) break;
}
- } else {
- int tlen;
+ }
+ else {
but->pos++;
- if(but->pos > (tlen= strlen(str))) but->pos= tlen;
+ if(but->pos > len) but->pos= len;
}
}
- }
- else { /* left */
- /* if there's a selection */
- if ((but->selend - but->selsta) > 0) {
- /* extend the selection based on the first direction taken */
- if(select) {
- if (!data->selextend) {
- data->selextend = EXTEND_LEFT;
- }
- if (data->selextend == EXTEND_LEFT) {
- but->selsta--;
- if (but->selsta < 0) but->selsta = 0;
- } else if (data->selextend == EXTEND_RIGHT) {
- but->selend--;
- /* if the selection start has gone past the end,
- * flip them so they're in sync again */
- if (but->selsta == but->selend) {
- but->pos = but->selsta;
- data->selextend = EXTEND_LEFT;
- }
+ else { /* left */
+ if(jump) {
+
+ /* left only: compensate for index/change in direction */
+ if(but->pos > 0) {
+ but->pos--;
}
- } else {
- but->pos = but->selend = but->selsta;
- data->selextend = 0;
- }
- } else {
- if(select) {
- /* make a selection, starting from the cursor position */
- but->selend = but->pos;
-
- but->pos--;
- if(but->pos<0) but->pos= 0;
-
- but->selsta = but->pos;
- } else if(jump) {
- /* jump betweenn special characters (/,\,_,-, etc.),
+
+ /* jump between special characters (/,\,_,-, etc.),
* look at function test_special_char() for complete
* list of special character, ctr -> */
while(but->pos > 0){
but->pos--;
- if(test_special_char(str[but->pos])) break;
+ if(!jump_all && test_special_char(str[but->pos])) break;
}
- } else {
+
+ /* left only: compensate for index/change in direction */
+ if((but->pos != 0) && ABS(pos_prev - but->pos) > 1) {
+ but->pos++;
+ }
+
+ }
+ else {
if(but->pos>0) but->pos--;
}
}
- }
-}
-
-static void ui_textedit_move_end(uiBut *but, uiHandleButtonData *data, int direction, int select)
-{
- char *str;
- str= data->str;
- if(direction) { /* right */
if(select) {
- but->selsta = but->pos;
- but->selend = strlen(str);
- data->selextend = EXTEND_RIGHT;
- } else {
- but->selsta = but->selend = but->pos= strlen(str);
- }
- }
- else { /* left */
- if(select) {
- but->selend = but->pos;
- but->selsta = 0;
- data->selextend = EXTEND_LEFT;
- } else {
- but->selsta = but->selend = but->pos= 0;
+ /* existing selection */
+ if (has_sel) {
+
+ if(data->selextend == 0) {
+ data->selextend= EXTEND_RIGHT;
+ }
+
+ if (direction) {
+ if (data->selextend == EXTEND_RIGHT) {
+ but->selend= but->pos;
+ }
+ else {
+ but->selsta= but->pos;
+ }
+ }
+ else {
+ if (data->selextend == EXTEND_LEFT) {
+ but->selsta= but->pos;
+ }
+ else {
+ but->selend= but->pos;
+ }
+ }
+
+ if (but->selend < but->selsta) {
+ SWAP(short, but->selsta, but->selend);
+ data->selextend= (data->selextend == EXTEND_RIGHT) ? EXTEND_LEFT : EXTEND_RIGHT;
+ }
+
+ } /* new selection */
+ else {
+ if (direction) {
+ data->selextend= EXTEND_RIGHT;
+ but->selend= but->pos;
+ but->selsta= pos_prev;
+ }
+ else {
+ data->selextend= EXTEND_LEFT;
+ but->selend= pos_prev;
+ but->selsta= but->pos;
+ }
+ }
}
}
}
-static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, int all)
+static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, const int all, const int jump)
{
- char *str;
- int len, x, changed= 0;
+ char *str= data->str;
+ const int len= strlen(str);
- str= data->str;
- len= strlen(str);
+ int x, changed= 0;
if(all) {
if(len) changed=1;
@@ -1517,9 +1498,24 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
changed= ui_textedit_delete_selection(but, data);
}
else if(but->pos>=0 && but->pos<len) {
+ int step;
+
+ if (jump) {
+ x = but->pos;
+ step= 0;
+ while(x < len) {
+ x++;
+ step++;
+ if(test_special_char(str[x])) break;
+ }
+ }
+ else {
+ step= 1;
+ }
+
for(x=but->pos; x<len; x++)
- str[x]= str[x+1];
- str[len-1]='\0';
+ str[x]= str[x+step];
+ str[len-step]='\0';
changed= 1;
}
}
@@ -1529,11 +1525,26 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
changed= ui_textedit_delete_selection(but, data);
}
else if(but->pos>0) {
+ int step;
+
+ if (jump) {
+ x = but->pos;
+ step= 0;
+ while(x > 0) {
+ x--;
+ step++;
+ if((step > 1) && test_special_char(str[x])) break;
+ }
+ }
+ else {
+ step= 1;
+ }
+
for(x=but->pos; x<len; x++)
- str[x-1]= str[x];
- str[len-1]='\0';
+ str[x-step]= str[x];
+ str[len-step]='\0';
- but->pos--;
+ but->pos -= step;
changed= 1;
}
}
@@ -1831,11 +1842,11 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
break;
case RIGHTARROWKEY:
- ui_textedit_move(but, data, 1, event->shift, event->ctrl);
+ ui_textedit_move(but, data, 1, event->shift, event->ctrl, FALSE);
retval= WM_UI_HANDLER_BREAK;
break;
case LEFTARROWKEY:
- ui_textedit_move(but, data, 0, event->shift, event->ctrl);
+ ui_textedit_move(but, data, 0, event->shift, event->ctrl, FALSE);
retval= WM_UI_HANDLER_BREAK;
break;
case DOWNARROWKEY:
@@ -1845,7 +1856,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* pass on purposedly */
case ENDKEY:
- ui_textedit_move_end(but, data, 1, event->shift);
+ ui_textedit_move(but, data, 1, event->shift, TRUE, TRUE);
retval= WM_UI_HANDLER_BREAK;
break;
case UPARROWKEY:
@@ -1855,7 +1866,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* pass on purposedly */
case HOMEKEY:
- ui_textedit_move_end(but, data, 0, event->shift);
+ ui_textedit_move(but, data, 0, event->shift, TRUE, TRUE);
retval= WM_UI_HANDLER_BREAK;
break;
case PADENTER:
@@ -1864,12 +1875,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
retval= WM_UI_HANDLER_BREAK;
break;
case DELKEY:
- changed= ui_textedit_delete(but, data, 1, 0);
+ changed= ui_textedit_delete(but, data, 1, 0, event->ctrl);
retval= WM_UI_HANDLER_BREAK;
break;
case BACKSPACEKEY:
- changed= ui_textedit_delete(but, data, 0, event->shift);
+ changed= ui_textedit_delete(but, data, 0, event->shift, event->ctrl);
retval= WM_UI_HANDLER_BREAK;
break;
@@ -4418,7 +4429,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
/* check prevval because of modal operators [#24016],
* modifier check is to allow Ctrl+C for copy.
* if this causes other problems, remove this check and suffer the bug :) - campbell */
- (event->prevval != KM_PRESS || ISKEYMODIFIER(event->prevtype))
+ ((event->prevval != KM_PRESS) || (ISKEYMODIFIER(event->prevtype)) || (event->type == EVT_DROP))
) {
/* handle copy-paste */
if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 2f10ebf1d73..ba612fc8727 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -768,7 +768,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
if(properties) {
PointerRNA tptr;
- WM_operator_properties_create(&tptr, opname);
+ WM_operator_properties_create_ptr(&tptr, ot);
if(tptr.data) {
IDP_FreeProperty(tptr.data);
MEM_freeN(tptr.data);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 05e87f90ba5..104ed068200 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2569,3 +2569,61 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
}
+/********************************* Keymap *************************************/
+
+static void keymap_item_modified(bContext *UNUSED(C), void *kmi_p, void *UNUSED(unused))
+{
+ wmKeyMapItem *kmi= (wmKeyMapItem*)kmi_p;
+ WM_keyconfig_update_tag(NULL, kmi);
+}
+
+static void template_keymap_item_properties(uiLayout *layout, const char *title, PointerRNA *ptr)
+{
+ uiLayout *flow;
+
+ uiItemS(layout);
+
+ if(title)
+ uiItemL(layout, title, ICON_NONE);
+
+ flow= uiLayoutColumnFlow(layout, 2, 0);
+
+ RNA_STRUCT_BEGIN(ptr, prop) {
+ int flag= RNA_property_flag(prop);
+
+ if(flag & PROP_HIDDEN)
+ continue;
+
+ /* recurse for nested properties */
+ if(RNA_property_type(prop) == PROP_POINTER) {
+ PointerRNA propptr= RNA_property_pointer_get(ptr, prop);
+ const char *name= RNA_property_ui_name(prop);
+
+ if(propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) {
+ template_keymap_item_properties(layout, name, &propptr);
+ continue;
+ }
+ }
+
+ /* add property */
+ uiItemR(flow, ptr, RNA_property_identifier(prop), 0, NULL, ICON_NONE);
+ }
+ RNA_STRUCT_END;
+}
+
+void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
+{
+ PointerRNA propptr= RNA_pointer_get(ptr, "properties");
+
+ if(propptr.data) {
+ uiBut *but= uiLayoutGetBlock(layout)->buttons.last;
+
+ template_keymap_item_properties(layout, NULL, &propptr);
+
+ /* attach callbacks to compensate for missing properties update,
+ we don't know which keymap (item) is being modified there */
+ for(; but; but=but->next)
+ uiButSetFunc(but, keymap_item_modified, ptr->data, NULL);
+ }
+}
+
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 6dce92bf07b..9e6b4e84e54 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -258,9 +258,11 @@ void MESH_OT_edgering_select(struct wmOperatorType *ot);
void MESH_OT_loopcut(struct wmOperatorType *ot);
/* ******************* mesh_navmesh.c */
-void MESH_OT_create_navmesh(struct wmOperatorType *ot);
-void MESH_OT_assign_navpolygon(struct wmOperatorType *ot);
-void MESH_OT_assign_new_navpolygon(struct wmOperatorType *ot);
+void MESH_OT_navmesh_make(struct wmOperatorType *ot);
+void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot);
+void MESH_OT_navmesh_face_add(struct wmOperatorType *ot);
+void MESH_OT_navmesh_reset(struct wmOperatorType *ot);
+void MESH_OT_navmesh_clear(struct wmOperatorType *ot);
#endif // MESH_INTERN_H
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index e4b884744e1..b8ace26991e 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -47,6 +47,7 @@
#include "BKE_scene.h"
#include "BKE_DerivedMesh.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_report.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
@@ -296,7 +297,6 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
int i,j, k;
unsigned short* v;
int face[3];
- Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Object* obedit;
int createob= base==NULL;
@@ -305,7 +305,6 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
unsigned int *meshes;
float bmin[3], cs, ch, *dverts;
unsigned char *tris;
- ModifierData *md;
zero_v3(co);
zero_v3(rot);
@@ -419,53 +418,63 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
obedit->body_type= OB_BODY_TYPE_NAVMESH;
rename_id((ID *)obedit, "Navmesh");
}
-
- md= modifiers_findByType(obedit, eModifierType_NavMesh);
- if(!md) {
- ED_object_modifier_add(NULL, bmain, scene, obedit, NULL, eModifierType_NavMesh);
- }
+
+ BKE_mesh_ensure_navmesh(obedit->data);
return obedit;
}
-static int create_navmesh_exec(bContext *C, wmOperator *UNUSED(op))
+static int create_navmesh_exec(bContext *C, wmOperator *op)
{
Scene* scene= CTX_data_scene(C);
- int nverts= 0, ntris= 0;
- float *verts= NULL;
- int *tris= 0;
- struct recast_polyMesh *pmesh= NULL;
- struct recast_polyMeshDetail *dmesh= NULL;
LinkNode* obs= NULL;
Base* navmeshBase= NULL;
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- if(base->object->body_type==OB_BODY_TYPE_NAVMESH) {
- if(!navmeshBase || base==CTX_data_active_base(C))
- navmeshBase= base;
+ if (base->object->type == OB_MESH) {
+ if (base->object->body_type==OB_BODY_TYPE_NAVMESH) {
+ if (!navmeshBase || base == scene->basact) {
+ navmeshBase= base;
+ }
+ }
+ else {
+ BLI_linklist_append(&obs, (void*)base->object);
+ }
}
- else
- BLI_linklist_append(&obs, (void*)base->object);
}
CTX_DATA_END;
- createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris);
- BLI_linklist_free(obs, NULL);
- buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh);
- createRepresentation(C, pmesh, dmesh, navmeshBase);
+ if (obs) {
+ struct recast_polyMesh *pmesh= NULL;
+ struct recast_polyMeshDetail *dmesh= NULL;
- MEM_freeN(verts);
- MEM_freeN(tris);
+ int nverts= 0, ntris= 0;
+ int *tris= 0;
+ float *verts= NULL;
- return OPERATOR_FINISHED;
+ createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris);
+ BLI_linklist_free(obs, NULL);
+ buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh);
+ createRepresentation(C, pmesh, dmesh, navmeshBase);
+
+ MEM_freeN(verts);
+ MEM_freeN(tris);
+
+ return OPERATOR_FINISHED;
+ }
+ else {
+ BKE_report(op->reports, RPT_ERROR, "No mesh objects found");
+
+ return OPERATOR_CANCELLED;
+ }
}
-void MESH_OT_create_navmesh(wmOperatorType *ot)
+void MESH_OT_navmesh_make(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Create navigation mesh";
ot->description= "Create navigation mesh for selected objects";
- ot->idname= "MESH_OT_create_navmesh";
+ ot->idname= "MESH_OT_navmesh_make";
/* api callbacks */
ot->exec= create_navmesh_exec;
@@ -474,35 +483,35 @@ void MESH_OT_create_navmesh(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(op))
+static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
/* do work here */
- int targetPolyIdx= -1;
- EditFace *ef, *efa;
- efa= EM_get_actFace(em, 0);
+ EditFace *efa_act= EM_get_actFace(em, 0);
- if(efa) {
+ if(efa_act) {
if(CustomData_has_layer(&em->fdata, CD_RECAST)) {
- targetPolyIdx= *(int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST);
+ EditFace *efa;
+ int targetPolyIdx= *(int*)CustomData_em_get(&em->fdata, efa_act->data, CD_RECAST);
targetPolyIdx= targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx;
- if(targetPolyIdx>0) {
+ if(targetPolyIdx > 0) {
/* set target poly idx to other selected faces */
- ef= (EditFace*)em->faces.last;
- while(ef) {
- if((ef->f & SELECT )&& ef!=efa) {
- int* recastDataBlock= (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST);
+ for (efa= (EditFace *)em->faces.first; efa; efa= efa->next) {
+ if((efa->f & SELECT) && efa != efa_act) {
+ int* recastDataBlock= (int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST);
*recastDataBlock= targetPolyIdx;
}
- ef= ef->prev;
}
}
- }
+ else {
+ BKE_report(op->reports, RPT_ERROR, "Active face has no index set");
+ }
+ }
}
-
+
DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -511,16 +520,16 @@ static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void MESH_OT_assign_navpolygon(struct wmOperatorType *ot)
+void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Assign polygon index";
- ot->description= "Assign polygon index to face by active face";
- ot->idname= "MESH_OT_assign_navpolygon";
+ ot->name= "NavMesh Copy Face Index";
+ ot->description= "Copy the index from the active face";
+ ot->idname= "MESH_OT_navmesh_face_copy";
/* api callbacks */
ot->poll= ED_operator_editmesh;
- ot->exec= assign_navpolygon_exec;
+ ot->exec= navmesh_face_copy_exec;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -561,7 +570,7 @@ static int findFreeNavPolyIndex(EditMesh* em)
return freeIdx;
}
-static int assign_new_navpolygon_exec(bContext *C, wmOperator *UNUSED(op))
+static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -590,16 +599,93 @@ static int assign_new_navpolygon_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void MESH_OT_assign_new_navpolygon(struct wmOperatorType *ot)
+void MESH_OT_navmesh_face_add(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Assign new polygon index";
- ot->description= "Assign new polygon index to face";
- ot->idname= "MESH_OT_assign_new_navpolygon";
+ ot->name= "NavMesh New Face Index";
+ ot->description= "Add a new index and assign it to selected faces";
+ ot->idname= "MESH_OT_navmesh_face_add";
/* api callbacks */
ot->poll= ED_operator_editmesh;
- ot->exec= assign_new_navpolygon_exec;
+ ot->exec= navmesh_face_add_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int navmesh_obmode_data_poll(bContext *C)
+{
+ Object *ob = ED_object_active_context(C);
+ if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
+ Mesh *me= ob->data;
+ return CustomData_has_layer(&me->fdata, CD_RECAST);
+ }
+ return FALSE;
+}
+
+static int navmesh_obmode_poll(bContext *C)
+{
+ Object *ob = ED_object_active_context(C);
+ if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Object *ob = ED_object_active_context(C);
+ Mesh *me= ob->data;
+
+ CustomData_free_layers(&me->fdata, CD_RECAST, me->totface);
+
+ BKE_mesh_ensure_navmesh(me);
+
+ DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, &me->id);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_navmesh_reset(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "NavMesh Reset Index Values";
+ ot->description= "Assign a new index to every face";
+ ot->idname= "MESH_OT_navmesh_reset";
+
+ /* api callbacks */
+ ot->poll= navmesh_obmode_poll;
+ ot->exec= navmesh_reset_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Object *ob = ED_object_active_context(C);
+ Mesh *me= ob->data;
+
+ CustomData_free_layers(&me->fdata, CD_RECAST, me->totface);
+
+ DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, &me->id);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_navmesh_clear(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "NavMesh Clear Data";
+ ot->description= "Remove navmesh data from this mesh";
+ ot->idname= "MESH_OT_navmesh_clear";
+
+ /* api callbacks */
+ ot->poll= navmesh_obmode_data_poll;
+ ot->exec= navmesh_clear_exec;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index f44f7fbb8d5..b1f0daeaddc 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -153,9 +153,11 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_select_nth);
#ifdef WITH_GAMEENGINE
- WM_operatortype_append(MESH_OT_create_navmesh);
- WM_operatortype_append(MESH_OT_assign_navpolygon);
- WM_operatortype_append(MESH_OT_assign_new_navpolygon);
+ WM_operatortype_append(MESH_OT_navmesh_make);
+ WM_operatortype_append(MESH_OT_navmesh_face_copy);
+ WM_operatortype_append(MESH_OT_navmesh_face_add);
+ WM_operatortype_append(MESH_OT_navmesh_reset);
+ WM_operatortype_append(MESH_OT_navmesh_clear);
#endif
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 0292977f816..5d8781e0a6d 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -175,12 +175,18 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl
/********************* Add Object Operator ********************/
+void view_align_update(struct Main *UNUSED(main), struct Scene *UNUSED(scene), struct PointerRNA *ptr)
+{
+ RNA_struct_idprops_unset(ptr, "rotation");
+}
+
void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
{
PropertyRNA *prop;
/* note: this property gets hidden for add-camera operator */
- RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view");
+ prop= RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view");
+ RNA_def_property_update_runtime(prop, view_align_update);
if(do_editmode) {
prop= RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", "Enter editmode when adding this object");
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index a50dd00ef16..76cbfdc88e7 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1221,7 +1221,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
cu1->vfontbi= cu->vfontbi;
id_us_plus((ID *)cu1->vfontbi);
- BKE_text_to_curve(scene, base->object, 0); /* needed? */
+ BKE_text_to_curve(bmain, scene, base->object, 0); /* needed? */
BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family));
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index ebbc4137628..20ca50581bf 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1163,9 +1163,6 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
if(CustomData_external_test(&me->fdata, CD_MDISPS))
return OPERATOR_CANCELLED;
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return multires_external_save_exec(C, op);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 4c29490b0f0..4ca7d272503 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -230,21 +230,9 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) {
/* run provided clearing function */
clear_func(ob);
-
- /* auto keyframing */
- if (autokeyframe_cfra_can_key(scene, &ob->id)) {
- ListBase dsources = {NULL, NULL};
-
- /* now insert the keyframe(s) using the Keying Set
- * 1) add datasource override for the Object
- * 2) insert keyframes
- * 3) free the extra info
- */
- ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL);
- ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
- BLI_freelistN(&dsources);
- }
-
+
+ ED_autokeyframe_object(C, scene, ob, ks);
+
/* tag for updates */
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 72cc4ec2afa..faf0baa1aca 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -712,9 +712,6 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
{
//Scene *scene= CTX_data_scene(C);
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return envmap_save_exec(C, op);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 0c2cb2ee36d..cf90c43f3e1 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -290,7 +290,7 @@ static void make_vertexcol(Object *ob) /* single ob */
}
/* mirror_vgroup is set to -1 when invalid */
-static void wpaint_mirror_vgroup_ensure(Object *ob, int *vgroup_mirror)
+static int wpaint_mirror_vgroup_ensure(Object *ob)
{
bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef - 1);
@@ -317,13 +317,12 @@ static void wpaint_mirror_vgroup_ensure(Object *ob, int *vgroup_mirror)
/* curdef should never be NULL unless this is
* a lamp and ED_vgroup_add_name fails */
if(curdef) {
- *vgroup_mirror= mirrdef;
- return;
+ return mirrdef;
}
}
}
- *vgroup_mirror= -1;
+ return -1;
}
static void copy_vpaint_prev(VPaint *vp, unsigned int *mcol, int tot)
@@ -424,9 +423,9 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
vgroup= ob->actdef-1;
- /* if mirror painting, find the other group */
+ /* if mirror painting, find the other group */
if(me->editflag & ME_EDIT_MIRROR_X) {
- wpaint_mirror_vgroup_ensure(ob, &vgroup_mirror);
+ vgroup_mirror= wpaint_mirror_vgroup_ensure(ob);
}
copy_wpaint_prev(wp, me->dvert, me->totvert);
@@ -1114,31 +1113,33 @@ static void do_weight_paint_auto_normalize(MDeformVert *dvert,
#endif
/* the active group should be involved in auto normalize */
-static void do_weight_paint_auto_normalize_all_groups(MDeformVert *dvert, char *map, char do_auto_normalize)
+static void do_weight_paint_auto_normalize_all_groups(MDeformVert *dvert, const char *vgroup_validmap, char do_auto_normalize)
{
-// MDeformWeight *dw = dvert->dw;
- float sum=0.0f, fac=0.0f;
- int i, tot=0;
-
- if (do_auto_normalize == FALSE)
+ if (do_auto_normalize == FALSE) {
return;
+ }
+ else {
+ float sum= 0.0f, fac;
+ unsigned int i, tot=0;
+ MDeformWeight *dw;
+
+ for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ if (vgroup_validmap[dw->def_nr]) {
+ tot++;
+ sum += dw->weight;
+ }
+ }
- for (i=0; i<dvert->totweight; i++) {
- if (map[dvert->dw[i].def_nr]) {
- tot += 1;
- sum += dvert->dw[i].weight;
+ if ((tot == 0) || (sum == 1.0f) || (sum == 0.0f)) {
+ return;
}
- }
-
- if (!tot || sum == 1.0f)
- return;
- fac = sum;
- fac = fac==0.0f ? 1.0f : 1.0f / fac;
+ fac= 1.0f / sum;
- for (i=0; i<dvert->totweight; i++) {
- if (map[dvert->dw[i].def_nr]) {
- dvert->dw[i].weight *= fac;
+ for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+ if (vgroup_validmap[dw->def_nr]) {
+ dw->weight *= fac;
+ }
}
}
}
@@ -1580,43 +1581,49 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
)
{
Mesh *me= ob->data;
+ MDeformVert *dv= &me->dvert[index];
MDeformWeight *dw, *uw;
int vgroup= ob->actdef-1;
if(wp->flag & VP_ONLYVGROUP) {
- dw= defvert_find_index(&me->dvert[index], vgroup);
+ dw= defvert_find_index(dv, vgroup);
uw= defvert_find_index(wp->wpaint_prev+index, vgroup);
}
else {
- dw= defvert_verify_index(&me->dvert[index], vgroup);
+ dw= defvert_verify_index(dv, vgroup);
uw= defvert_verify_index(wp->wpaint_prev+index, vgroup);
}
- if(dw==NULL || uw==NULL)
+
+ if(dw==NULL || uw==NULL) {
return;
+ }
/* TODO: De-duplicate the simple weight paint - jason */
/* ... or not, since its <10 SLOC - campbell */
/* If there are no locks or multipaint,
* then there is no need to run the more complicated checks */
- if( (wpi->do_multipaint == FALSE || wpi->defbase_tot_sel <= 1) &&
- (wpi->lock_flags == NULL || has_locked_group(&me->dvert[index], wpi->lock_flags) == FALSE))
+ if( (wpi->do_multipaint == FALSE || wpi->defbase_tot_sel <= 1) &&
+ (wpi->lock_flags == NULL || has_locked_group(dv, wpi->lock_flags) == FALSE))
{
wpaint_blend(wp, dw, uw, alpha, paintweight, wpi->do_flip, FALSE);
- do_weight_paint_auto_normalize_all_groups(&me->dvert[index], wpi->vgroup_validmap, wpi->do_auto_normalize);
if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
- int j= mesh_get_x_mirror_vert(ob, index);
- if(j>=0) {
+ int index_mirr= mesh_get_x_mirror_vert(ob, index);
+ if(index_mirr != -1) {
+ MDeformVert *dv_mirr= &me->dvert[index_mirr];
/* copy, not paint again */
- uw= defvert_verify_index(me->dvert+j, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup);
-
+ uw= defvert_verify_index(dv_mirr, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup);
uw->weight= dw->weight;
-
- do_weight_paint_auto_normalize_all_groups(me->dvert+j, wpi->vgroup_validmap, wpi->do_auto_normalize);
}
}
+
+ /* important to normalize after mirror, otherwise mirror gets wight
+ * which has already been scaled down in relation to other weights,
+ * then scales a second time [#26193]. Tricky multi-paint code doesn't
+ * suffer from this problem - campbell */
+ do_weight_paint_auto_normalize_all_groups(dv, wpi->vgroup_validmap, wpi->do_auto_normalize);
}
else {
/* use locks and/or multipaint */
@@ -1627,7 +1634,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
float oldChange = 0;
int i;
MDeformWeight *tdw = NULL, *tuw;
- MDeformVert dv= {NULL};
+ MDeformVert dv_copy= {NULL};
oldw = dw->weight;
wpaint_blend(wp, dw, uw, alpha, paintweight, wpi->do_flip, wpi->do_multipaint && wpi->defbase_tot_sel >1);
@@ -1636,17 +1643,17 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
/* setup multi-paint */
if(wpi->defbase_tot_sel > 1 && wpi->do_multipaint) {
- dv.dw= MEM_dupallocN(me->dvert[index].dw);
- dv.flag = me->dvert[index].flag;
- dv.totweight = me->dvert[index].totweight;
+ dv_copy.dw= MEM_dupallocN(dv->dw);
+ dv_copy.flag = dv->flag;
+ dv_copy.totweight = dv->totweight;
tdw = dw;
tuw = uw;
change = get_mp_change(wp->wpaint_prev+index, wpi->defbase_sel, neww - oldw);
if(change) {
if(!tdw->weight) {
- i = get_first_selected_nonzero_weight(&me->dvert[index], wpi->defbase_sel);
+ i = get_first_selected_nonzero_weight(dv, wpi->defbase_sel);
if(i>=0) {
- tdw = &(me->dvert[index].dw[i]);
+ tdw = &(dv->dw[i]);
tuw = defvert_verify_index(wp->wpaint_prev+index, tdw->def_nr);
}
else {
@@ -1660,7 +1667,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
if( testw > tuw->weight ) {
if(change > oldChange) {
/* reset the weights and use the new change */
- reset_to_prev(wp->wpaint_prev+index, &me->dvert[index]);
+ reset_to_prev(wp->wpaint_prev+index, dv);
}
else {
/* the old change was more significant, so set
@@ -1670,7 +1677,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
}
else {
if(change < oldChange) {
- reset_to_prev(wp->wpaint_prev+index, &me->dvert[index]);
+ reset_to_prev(wp->wpaint_prev+index, dv);
}
else {
change = 0;
@@ -1685,25 +1692,24 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
}
if(apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) {
- reset_to_prev(&dv, &me->dvert[index]);
+ reset_to_prev(&dv_copy, dv);
change = 0;
oldChange = 0;
}
- if(dv.dw) {
- MEM_freeN(dv.dw);
+ if(dv_copy.dw) {
+ MEM_freeN(dv_copy.dw);
}
- /* dvert may have been altered greatly */
- dw = defvert_find_index(&me->dvert[index], vgroup);
+ /* dv may have been altered greatly */
+ dw = defvert_find_index(dv, vgroup);
if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
- int j= mesh_get_x_mirror_vert(ob, index);
- if(j>=0) {
+ int index_mirr= mesh_get_x_mirror_vert(ob, index);
+ if(index_mirr != -1) {
+ MDeformVert *dv_mirr= &me->dvert[index_mirr];
/* copy, not paint again */
- uw= defvert_verify_index(me->dvert+j, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup);
-
+ uw= defvert_verify_index(dv_mirr, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup);
//uw->weight= dw->weight;
-
- apply_mp_locks_normalize(me, wpi, j, uw, tdw, change, oldChange, oldw, neww);
+ apply_mp_locks_normalize(me, wpi, index_mirr, uw, tdw, change, oldChange, oldw, neww);
}
}
}
@@ -1799,7 +1805,6 @@ struct WPaintData {
float wpimat[3][3];
/*variables for auto normalize*/
- int auto_normalize;
char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/
char *lock_flags;
int defbase_tot;
@@ -1810,26 +1815,26 @@ static char *wpaint_make_validmap(Object *ob)
bDeformGroup *dg;
ModifierData *md;
char *vgroup_validmap;
- GHash *gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
- int i = 0, step1=1;
+ GHash *gh;
+ int i, step1=1;
- /*add all names to a hash table*/
- for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
- BLI_ghash_insert(gh, dg->name, NULL);
+ if(ob->defbase.first == NULL) {
+ return NULL;
}
- if (!i)
- return NULL;
+ gh= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
- vgroup_validmap= MEM_callocN(i, "wpaint valid map");
+ /*add all names to a hash table*/
+ for (dg=ob->defbase.first; dg; dg=dg->next) {
+ BLI_ghash_insert(gh, dg->name, NULL);
+ }
/*now loop through the armature modifiers and identify deform bones*/
for (md = ob->modifiers.first; md; md= !md->next && step1 ? (step1=0), modifiers_getVirtualModifierList(ob) : md->next) {
if (!(md->mode & (eModifierMode_Realtime|eModifierMode_Virtual)))
continue;
- if (md->type == eModifierType_Armature)
- {
+ if (md->type == eModifierType_Armature) {
ArmatureModifierData *amd= (ArmatureModifierData*) md;
if(amd->object && amd->object->pose) {
@@ -1848,12 +1853,12 @@ static char *wpaint_make_validmap(Object *ob)
}
}
}
-
+
+ vgroup_validmap= MEM_mallocN(BLI_ghash_size(gh), "wpaint valid map");
+
/*add all names to a hash table*/
for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
- if (BLI_ghash_lookup(gh, dg->name) != NULL) {
- vgroup_validmap[i] = TRUE;
- }
+ vgroup_validmap[i]= (BLI_ghash_lookup(gh, dg->name) != NULL);
}
BLI_ghash_free(gh, NULL, NULL);
@@ -1891,21 +1896,12 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
/*set up auto-normalize, and generate map for detecting which
vgroups affect deform bones*/
- wpd->auto_normalize = ts->auto_normalize;
wpd->defbase_tot = BLI_countlist(&ob->defbase);
wpd->lock_flags = gen_lock_flags(ob, wpd->defbase_tot);
- if (wpd->auto_normalize || ts->multipaint || wpd->lock_flags)
+ if (ts->auto_normalize || ts->multipaint || wpd->lock_flags) {
wpd->vgroup_validmap = wpaint_make_validmap(ob);
-
- // if(qual & LR_CTRLKEY) {
- // sample_wpaint(scene, ar, v3d, 0);
- // return;
- // }
- // if(qual & LR_SHIFTKEY) {
- // sample_wpaint(scene, ar, v3d, 1);
- // return;
- // }
-
+ }
+
/* ALLOCATIONS! no return after this line */
/* painting on subsurfs should give correct points too, this returns me->totvert amount */
wpd->vertexcosnos= mesh_get_mapped_verts_nors(scene, ob);
@@ -1933,9 +1929,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
if(ob->defbase.first==NULL) {
ED_vgroup_add(ob);
}
-
- // if(ob->lay & v3d->lay); else error("Active object is not in this layer");
-
+
/* imat for normals */
mul_m4_m4m4(mat, ob->obmat, wpd->vc.rv3d->viewmat);
invert_m4_m4(imat, mat);
@@ -1943,7 +1937,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
/* if mirror painting, find the other group */
if(me->editflag & ME_EDIT_MIRROR_X) {
- wpaint_mirror_vgroup_ensure(ob, &wpd->vgroup_mirror);
+ wpd->vgroup_mirror= wpaint_mirror_vgroup_ensure(ob);
}
return 1;
@@ -2006,7 +2000,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
wpi.vgroup_validmap= wpd->vgroup_validmap;
wpi.do_flip= RNA_boolean_get(itemptr, "pen_flip");
wpi.do_multipaint= (ts->multipaint != 0);
- wpi.do_auto_normalize= (ts->auto_normalize != 0);
+ wpi.do_auto_normalize= ((ts->auto_normalize != 0) && (wpi.vgroup_validmap != NULL));
/* *** done setting up WeightPaintInfo *** */
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 5b72e87f95a..50dda49bead 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -164,9 +164,6 @@ static int open_exec(bContext *UNUSED(C), wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
@@ -264,9 +261,6 @@ static int mixdown_exec(bContext *C, wmOperator *op)
static int mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return mixdown_exec(C, op);
@@ -519,6 +513,7 @@ static int sound_poll(bContext *C)
static int pack_exec(bContext *C, wmOperator *op)
{
+ Main *bmain= CTX_data_main(C);
Editing* ed = CTX_data_scene(C)->ed;
bSound* sound;
@@ -530,7 +525,7 @@ static int pack_exec(bContext *C, wmOperator *op)
if(!sound || sound->packedfile)
return OPERATOR_CANCELLED;
- sound->packedfile= newPackedFile(op->reports, sound->name);
+ sound->packedfile= newPackedFile(op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
sound_load(CTX_data_main(C), sound);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a05053a2d9d..7bf0f98b471 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -246,20 +246,32 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max, cons
/* go through channels, finding max extents */
for (ale= anim_data.first; ale; ale= ale->next) {
AnimData *adt= ANIM_nla_mapping_get(ac, ale);
- FCurve *fcu= (FCurve *)ale->key_data;
- float tmin, tmax;
-
- /* get range and apply necessary scaling before processing */
- calc_fcurve_range(fcu, &tmin, &tmax, onlySel);
-
- if (adt) {
- tmin= BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP);
- tmax= BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP);
+ if (ale->datatype == ALE_GPFRAME) {
+ bGPDlayer *gpl= ale->data;
+ bGPDframe *gpf;
+
+ /* find gp-frame which is less than or equal to cframe */
+ for (gpf= gpl->frames.first; gpf; gpf= gpf->next) {
+ *min= MIN2(*min, gpf->framenum);
+ *max= MAX2(*max, gpf->framenum);
+ }
+ }
+ else {
+ FCurve *fcu= (FCurve *)ale->key_data;
+ float tmin, tmax;
+
+ /* get range and apply necessary scaling before processing */
+ calc_fcurve_range(fcu, &tmin, &tmax, onlySel);
+
+ if (adt) {
+ tmin= BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP);
+ tmax= BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP);
+ }
+
+ /* try to set cur using these values, if they're more extreme than previously set values */
+ *min= MIN2(*min, tmin);
+ *max= MAX2(*max, tmax);
}
-
- /* try to set cur using these values, if they're more extreme than previously set values */
- *min= MIN2(*min, tmin);
- *max= MAX2(*max, tmax);
}
/* free memory */
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 99e5c6d693e..75b3eb950a5 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -201,6 +201,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_string_set(op->ptr, path_prop, str);
MEM_freeN(str);
+ /* normally ED_fileselect_get_params would handle this but we need to because of stupid
+ * user-prefs exception - campbell */
if(RNA_struct_find_property(op->ptr, "relative_path")) {
if(!RNA_property_is_set(op->ptr, "relative_path")) {
/* annoying exception!, if were dealign with the user prefs, default relative to be off */
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index c265c4ec1a7..0955d264ca8 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1178,7 +1178,7 @@ static int file_directory_poll(bContext *C)
{
/* sfile->files can be NULL on file load */
SpaceFile *sfile= CTX_wm_space_file(C);
- return ED_operator_file_active(C) && sfile->files && filelist_lib(sfile->files);
+ return ED_operator_file_active(C) && (sfile->files==NULL || filelist_lib(sfile->files)==NULL);
}
void FILE_OT_directory(struct wmOperatorType *ot)
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 1e113abfcd2..6cc42b2a751 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -125,6 +125,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
const short is_filepath= (RNA_struct_find_property(op->ptr, "filepath") != NULL);
const short is_filename= (RNA_struct_find_property(op->ptr, "filename") != NULL);
const short is_directory= (RNA_struct_find_property(op->ptr, "directory") != NULL);
+ const short is_relative_path= (RNA_struct_find_property(op->ptr, "relative_path") != NULL);
BLI_strncpy(params->title, op->type->name, sizeof(params->title));
@@ -228,6 +229,11 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->display= FILE_SHORTDISPLAY;
}
+ if (is_relative_path) {
+ if (!RNA_property_is_set(op->ptr, "relative_path")) {
+ RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
+ }
+ }
}
else {
/* default values, if no operator */
@@ -246,6 +252,11 @@ short ED_fileselect_set_params(SpaceFile *sfile)
sfile->folders_prev = folderlist_new();
folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
+ /* switching thumbnails needs to recalc layout [#28809] */
+ if (sfile->layout) {
+ sfile->layout->dirty= TRUE;
+ }
+
return 1;
}
@@ -466,12 +477,13 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
int maxlen = 0;
int numfiles;
int textheight;
+
if (sfile->layout == NULL) {
sfile->layout = MEM_callocN(sizeof(struct FileLayout), "file_layout");
- sfile->layout->dirty = 1;
- }
-
- if (!sfile->layout->dirty) return;
+ sfile->layout->dirty = TRUE;
+ } else if (sfile->layout->dirty == FALSE) {
+ return;
+ }
numfiles = filelist_numfiles(sfile->files);
textheight = (int)file_font_pointsize();
@@ -538,7 +550,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
layout->width = sfile->layout->columns * (layout->tile_w + 2*layout->tile_border_x) + layout->tile_border_x*2;
layout->flag = FILE_LAYOUT_HOR;
}
- layout->dirty= 0;
+ layout->dirty= FALSE;
}
FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar)
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index f4adc471f70..7a70ed9c0a0 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -154,7 +154,7 @@ static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
//printf("file_init\n");
- if(sfile->layout) sfile->layout->dirty= 1;
+ if(sfile->layout) sfile->layout->dirty= TRUE;
}
@@ -242,7 +242,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
BLI_strncpy(sfile->params->renameedit, sfile->params->renamefile, sizeof(sfile->params->renameedit));
params->renamefile[0] = '\0';
}
- if (sfile->layout) sfile->layout->dirty= 1;
+ if (sfile->layout) sfile->layout->dirty= TRUE;
}
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 45bd1d58a53..725b5f5c02d 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -843,10 +843,6 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
if(ima)
path= ima->name;
-
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
@@ -1167,9 +1163,6 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
Scene *scene= CTX_data_scene(C);
SaveImageOptions simopts;
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return save_as_exec(C, op);
@@ -1567,6 +1560,7 @@ static int pack_test(bContext *C, wmOperator *op)
static int pack_exec(bContext *C, wmOperator *op)
{
+ struct Main *bmain= CTX_data_main(C);
Image *ima= CTX_data_edit_image(C);
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
int as_png= RNA_boolean_get(op->ptr, "as_png");
@@ -1582,7 +1576,7 @@ static int pack_exec(bContext *C, wmOperator *op)
if(as_png)
BKE_image_memorypack(ima);
else
- ima->packedfile= newPackedFile(op->reports, ima->name);
+ ima->packedfile= newPackedFile(op->reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 75e13b24ede..9157df6960f 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -290,7 +290,7 @@ static void recent_files_menu_register(void)
mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
strcpy(mt->idname, "INFO_MT_file_open_recent");
- strcpy(mt->label, "Open Recent...");
+ strcpy(mt->label, _("Open Recent..."));
mt->draw= recent_files_menu_draw;
WM_menutype_add(mt);
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 5f443509801..150847ce825 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1939,7 +1939,7 @@ static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), Poin
/* only once called */
static void node_texture_set_butfunc(bNodeType *ntype)
{
- ntype->uifuncbut = NULL;
+ ntype->uifuncbut = NULL;
if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
ntype->uifunc = node_texture_buts_proc;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index b390b7dbdb5..1c4b0130897 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -380,9 +380,6 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent
sequencer_generic_invoke_xy__internal(C, op, event, 0);
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -434,10 +431,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent
}
sequencer_generic_invoke_xy__internal(C, op, event, 0);
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
+
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -543,9 +537,6 @@ static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent
}
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -721,10 +712,6 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
sequencer_generic_invoke_xy__internal(C, op, event, prop_flag);
if (is_type_set && type==SEQ_PLUGIN) {
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
/* only plugins need the file selector */
return WM_operator_filesel(C, op, event);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 0f5398f24a7..8f1ea6fe254 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -187,6 +187,9 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
if(!seq->sound->waveform)
sound_read_waveform(seq->sound);
+ if(!seq->sound->waveform)
+ return; /* zero length sound */
+
waveform = seq->sound->waveform;
startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
@@ -508,47 +511,48 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
char str[32 + FILE_MAXDIR+FILE_MAXFILE];
const char *name= seq->name+2;
char col[4];
-
+
+ /* note, all strings should include 'name' */
if(name[0]=='\0')
name= give_seqname(seq);
if(seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
- sprintf(str, "%d | %s", seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
else if(seq->type == SEQ_SCENE) {
if(seq->scene) {
if(seq->scene_camera) {
- sprintf(str, "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2);
+ BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2);
} else {
- sprintf(str, "%d | %s: %s", seq->len, name, seq->scene->id.name+2);
+ BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->scene->id.name+2);
}
}
else {
- sprintf(str, "%d | %s", seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
}
else if(seq->type == SEQ_MULTICAM) {
- sprintf(str, "Cam: %d", seq->multicam_source);
+ BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source);
}
else if(seq->type == SEQ_IMAGE) {
- sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
}
else if(seq->type & SEQ_EFFECT) {
int can_float = (seq->type != SEQ_PLUGIN)
|| (seq->plugin && seq->plugin->version >= 4);
if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
- sprintf(str, "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!");
+ BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!");
else if (seq->seq1 && seq->seq2)
- sprintf(str, "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
+ BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
else
- sprintf(str, "%d | %s", seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
else if (seq->type == SEQ_SOUND) {
- sprintf(str, "%d | %s", seq->len, seq->sound->name);
+ BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name);
}
else if (seq->type == SEQ_MOVIE) {
- sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
}
if(seq->flag & SELECT){
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bd93a1270f6..da785430d43 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2961,9 +2961,11 @@ void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
static int sequencer_change_path_exec(bContext *C, wmOperator *op)
{
+ Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq= seq_active_get(scene);
+ const int is_relative_path= RNA_boolean_get(op->ptr, "relative_path");
if(seq->type == SEQ_IMAGE) {
char directory[FILE_MAX];
@@ -2974,6 +2976,12 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "directory", directory);
+ if (is_relative_path) {
+ /* TODO, shouldnt this already be relative from the filesel?
+ * (as the 'filepath' is) for now just make relative here,
+ * but look into changing after 2.60 - campbell */
+ BLI_path_rel(directory, bmain->name);
+ }
BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
if(seq->strip->stripdata) {
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 45dd08e3ece..7e718dc176a 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -1048,7 +1048,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
}
SEQ_END;
- seq->tmp= SET_INT_IN_POINTER(TRUE);
+ actseq->tmp= SET_INT_IN_POINTER(TRUE);
for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {
seq = iter.seq;
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 3f45e32937d..83a695ba72a 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -438,39 +438,39 @@ static void draw_bonevert_solid(void)
}
static float bone_octahedral_verts[6][3]= {
- { 0.0f, 0.0f, 0.0f},
- { 0.1f, 0.1f, 0.1f},
- { 0.1f, 0.1f, -0.1f},
- {-0.1f, 0.1f, -0.1f},
- {-0.1f, 0.1f, 0.1f},
- { 0.0f, 1.0f, 0.0f}
+ { 0.0f, 0.0f, 0.0f},
+ { 0.1f, 0.1f, 0.1f},
+ { 0.1f, 0.1f, -0.1f},
+ {-0.1f, 0.1f, -0.1f},
+ {-0.1f, 0.1f, 0.1f},
+ { 0.0f, 1.0f, 0.0f}
};
static unsigned int bone_octahedral_wire_sides[8]= {0, 1, 5, 3, 0, 4, 5, 2};
static unsigned int bone_octahedral_wire_square[8]= {1, 2, 3, 4, 1};
static unsigned int bone_octahedral_solid_tris[8][3]= {
- {2, 1, 0}, /* bottom */
- {3, 2, 0},
- {4, 3, 0},
- {1, 4, 0},
-
- {5, 1, 2}, /* top */
- {5, 2, 3},
- {5, 3, 4},
- {5, 4, 1}
+ {2, 1, 0}, /* bottom */
+ {3, 2, 0},
+ {4, 3, 0},
+ {1, 4, 0},
+
+ {5, 1, 2}, /* top */
+ {5, 2, 3},
+ {5, 3, 4},
+ {5, 4, 1}
};
/* aligned with bone_octahedral_solid_tris */
static float bone_octahedral_solid_normals[8][3]= {
- { 0.70710683f, -0.70710683f, 0.00000000f},
- {-0.00000000f, -0.70710683f, -0.70710683f},
- {-0.70710683f, -0.70710683f, 0.00000000f},
- { 0.00000000f, -0.70710683f, 0.70710683f},
- { 0.99388373f, 0.11043154f, -0.00000000f},
- { 0.00000000f, 0.11043154f, -0.99388373f},
- {-0.99388373f, 0.11043154f, 0.00000000f},
- { 0.00000000f, 0.11043154f, 0.99388373f}
+ { 0.70710683f, -0.70710683f, 0.00000000f},
+ {-0.00000000f, -0.70710683f, -0.70710683f},
+ {-0.70710683f, -0.70710683f, 0.00000000f},
+ { 0.00000000f, -0.70710683f, 0.70710683f},
+ { 0.99388373f, 0.11043154f, -0.00000000f},
+ { 0.00000000f, 0.11043154f, -0.99388373f},
+ {-0.99388373f, 0.11043154f, 0.00000000f},
+ { 0.00000000f, 0.11043154f, 0.99388373f}
};
static void draw_bone_octahedral(void)
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 581105e963c..63b7d0b4353 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -309,16 +309,24 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
{
unsigned char obcol[4];
- int istex, solidtex= 0;
+ int istex, solidtex;
// XXX scene->obedit warning
- if(v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) {
+
+ /* texture draw is abused for mask selection mode, do this so wire draw
+ * with face selection in weight paint is not lit. */
+ if((v3d->drawtype <= OB_WIRE) && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
+ solidtex= FALSE;
+ Gtexdraw.islit= 0;
+ }
+ else if(v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) {
/* draw with default lights in solid draw mode and edit mode */
- solidtex= 1;
+ solidtex= TRUE;
Gtexdraw.islit= -1;
}
else {
/* draw with lights in the scene otherwise */
+ solidtex= FALSE;
Gtexdraw.islit= GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp);
}
@@ -449,9 +457,9 @@ static void add_tface_color_layer(DerivedMesh *dm)
}
} else if (tface && tface->mode&TF_OBCOL) {
for(j=0;j<4;j++) {
- finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[0]);
+ finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]);
finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]);
- finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[2]);
+ finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[2]);
}
} else if (!mcol) {
if (tface) {
@@ -470,9 +478,9 @@ static void add_tface_color_layer(DerivedMesh *dm)
else copy_v3_v3(col, &ma->r);
for(j=0;j<4;j++) {
- finalCol[i*4+j].b = FTOCHAR(col[2]);
+ finalCol[i*4+j].b = FTOCHAR(col[0]);
finalCol[i*4+j].g = FTOCHAR(col[1]);
- finalCol[i*4+j].r = FTOCHAR(col[0]);
+ finalCol[i*4+j].r = FTOCHAR(col[2]);
}
}
else
@@ -484,9 +492,9 @@ static void add_tface_color_layer(DerivedMesh *dm)
}
} else {
for(j=0;j<4;j++) {
- finalCol[i*4+j].b = mcol[i*4+j].r;
+ finalCol[i*4+j].r = mcol[i*4+j].r;
finalCol[i*4+j].g = mcol[i*4+j].g;
- finalCol[i*4+j].r = mcol[i*4+j].b;
+ finalCol[i*4+j].b = mcol[i*4+j].b;
}
}
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 03752b87b16..4db8563d7e5 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1776,7 +1776,9 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *ce
if (efa && efa->h==0 && efa->fgonf!=EM_FGON) {
view3d_project_short_clip(data->vc.ar, cent, s, 1);
- data->func(data->userData, efa, s[0], s[1], index);
+ if (s[0] != IS_CLIPPED) {
+ data->func(data->userData, efa, s[0], s[1], index);
+ }
}
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 44d85af858c..fd27dc65a0e 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -530,7 +530,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
row= uiLayoutRow(layout, 1);
uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+
+ /* pose/object only however we want to allow in weight paint mode too
+ * so dont be totally strict and just check not-editmode for now */
+ if (obedit == NULL) {
+ uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+ }
/* Transform widget / manipulators */
row= uiLayoutRow(layout, 1);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 1c98397c7f6..4f5e98a24ce 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1946,7 +1946,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
/* much like facesel_face_pick()*/
/* returns 0 if not found, otherwise 1 */
-static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, short rect)
+static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, int size)
{
ViewContext vc;
view3d_set_viewcontext(C, &vc);
@@ -1954,12 +1954,12 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un
if (!me || me->totvert==0)
return 0;
- if (rect) {
+ if (size > 0) {
/* sample rect to increase changes of selecting, so that when clicking
on an face in the backbuf, we can still select a vert */
int dist;
- *index = view3d_sample_backbuf_rect(&vc, mval, 3, 1, me->totvert+1, &dist,0,NULL, NULL);
+ *index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert+1, &dist,0,NULL, NULL);
}
else {
/* sample only on the exact position */
@@ -1981,7 +1981,8 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
Mesh* me= obact->data; /* already checked for NULL */
unsigned int index = 0;
MVert *mv;
- if(vertsel_vert_pick(C, me, mval, &index, 1)) {
+
+ if(vertsel_vert_pick(C, me, mval, &index, 50)) {
mv = me->mvert+index;
if(extend) {
mv->flag ^= SELECT;
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 1ed65f7875f..fa3007d2fb7 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -65,6 +65,7 @@
#include "ED_armature.h"
#include "ED_mesh.h"
+#include "ED_keyframing.h"
#include "ED_screen.h"
#include "ED_curve.h" /* for curve_editnurbs */
@@ -494,6 +495,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
}
else {
+ struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location");
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
if(ob->mode & OB_MODE_POSE) {
@@ -522,6 +524,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
pchan->loc[0]= vecN[1];
if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
pchan->loc[0]= vecN[2];
+
+ /* auto-keyframing */
+ ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
}
/* if the bone has a parent and is connected to the parent,
* don't do anything - will break chain unless we do auto-ik.
@@ -531,8 +536,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
}
ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
- /* auto-keyframing */
-// XXX autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
@@ -556,7 +559,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
ob->loc[2]+= vec[2];
/* auto-keyframing */
-// XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION);
+ ED_autokeyframe_object(C, scene, ob, ks);
}
}
CTX_DATA_END;
@@ -622,6 +625,8 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
}
else {
+ struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location");
+
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
if(ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
@@ -648,6 +653,9 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
pchan->loc[1]= curspn[1];
if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
pchan->loc[2]= curspn[2];
+
+ /* auto-keyframing */
+ ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
}
/* if the bone has a parent and is connected to the parent,
* don't do anything - will break chain unless we do auto-ik.
@@ -657,8 +665,6 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
}
ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
- /* auto-keyframing */
-// XXX autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
@@ -680,9 +686,9 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
ob->loc[1]+= vec[1];
if ((ob->protectflag & OB_LOCK_LOCZ)==0)
ob->loc[2]+= vec[2];
-
+
/* auto-keyframing */
-// XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION);
+ ED_autokeyframe_object(C, scene, ob, ks);
}
}
CTX_DATA_END;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index b6651ebd1ff..b5f622b747b 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1187,6 +1187,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->options |= CTX_NO_PET;
}
+ // Mirror is not supported with PET, turn it off.
+ if (t->flag & T_PROP_EDIT)
+ {
+ t->flag &= ~T_MIRROR;
+ }
+
setTransformViewMatrices(t);
initNumInput(&t->num);
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index a1e1c0e0b1d..1c3241237f5 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -312,6 +312,15 @@ static void calcSpringFactor(MouseInput *mi)
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
{
+ /* may have been allocated previously */
+ /* TODO, holding R-key can cause mem leak, but this causes [#28903]
+ * disable for now. */
+#if 0
+ if(mi->data) {
+ MEM_freeN(mi->data);
+ mi->data= NULL;
+ }
+#endif
switch(mode)
{
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 3dd7514429e..d46f4b0ed30 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -171,7 +171,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
pup= uiPupMenuBegin(C, "Unpack file", ICON_NONE);
layout= uiPupMenuLayout(pup);
- sprintf(line, "Remove Pack");
+ strcpy(line, "Remove Pack");
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_REMOVE);
RNA_string_set(&props_ptr, "id", id_name);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 120c203e7bd..c5d62559056 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1136,6 +1136,9 @@ int GPU_enable_material(int nr, void *attribs)
GMS.lastretval = !GMS.lastretval;
if(GMS.lastretval) {
+ /* for alpha pass, use alpha blend */
+ alphablend = (GMS.alphapass)? GPU_BLEND_ALPHA: GPU_BLEND_SOLID;
+
if(gattribs && GMS.gmatbuf[nr]) {
/* bind glsl material and get attributes */
Material *mat = GMS.gmatbuf[nr];
@@ -1145,7 +1148,11 @@ int GPU_enable_material(int nr, void *attribs)
GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT));
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col);
GMS.gboundmat= mat;
- alphablend= mat->game.alpha_blend;
+
+ /* for glsl use alpha blend mode, unless it's set to solid and
+ we are already drawing in an alpha pass */
+ if(mat->game.alpha_blend != GPU_BLEND_SOLID)
+ alphablend= mat->game.alpha_blend;
if(GMS.alphapass) glDepthMask(1);
}
@@ -1154,11 +1161,9 @@ int GPU_enable_material(int nr, void *attribs)
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, GMS.matbuf[nr].diff);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, GMS.matbuf[nr].spec);
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, GMS.matbuf[nr].hard);
- alphablend= GPU_BLEND_SOLID;
}
/* set (alpha) blending mode */
- if(!GMS.alphapass) alphablend= GPU_BLEND_SOLID;
GPU_set_material_alpha_blend(alphablend);
}
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index b9500c2f798..c1ef8c4792b 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -745,9 +745,9 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
" FRAME DONE: "
"next_pts=%lld pkt_pts=%lld\n",
(anim->pFrame->pts == AV_NOPTS_VALUE) ?
- -1 : anim->pFrame->pts,
+ -1 : (long long int)anim->pFrame->pts,
(anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ?
- -1 : anim->pFrame->pkt_pts);
+ -1 : (long long int)anim->pFrame->pkt_pts);
anim->next_pts =
av_get_pts_from_frame(anim->pFormatCtx,
anim->pFrame);
@@ -767,9 +767,9 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
anim->next_packet.stream_index,
anim->videoStream,
(anim->next_packet.dts == AV_NOPTS_VALUE) ? -1:
- anim->next_packet.dts,
+ (long long int)anim->next_packet.dts,
(anim->next_packet.pts == AV_NOPTS_VALUE) ? -1:
- anim->next_packet.pts,
+ (long long int)anim->next_packet.pts,
(anim->next_packet.flags & AV_PKT_FLAG_KEY) ?
" KEY" : "");
if (anim->next_packet.stream_index == anim->videoStream) {
@@ -796,11 +796,11 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
" FRAME DONE: next_pts=%lld "
"pkt_pts=%lld, guessed_pts=%lld\n",
(anim->pFrame->pts == AV_NOPTS_VALUE) ?
- -1 : anim->pFrame->pts,
+ -1 : (long long int)anim->pFrame->pts,
(anim->pFrame->pkt_pts
== AV_NOPTS_VALUE) ?
- -1 : anim->pFrame->pkt_pts,
- anim->next_pts);
+ -1 : (long long int)anim->pFrame->pkt_pts,
+ (long long int)anim->next_pts);
}
}
av_free_packet(&anim->next_packet);
@@ -824,13 +824,13 @@ static void ffmpeg_decode_video_frame_scan(
av_log(anim->pFormatCtx,
AV_LOG_DEBUG,
"SCAN start: considering pts=%lld in search of %lld\n",
- anim->next_pts, pts_to_search);
+ (long long int)anim->next_pts, (long long int)pts_to_search);
while (count > 0 && anim->next_pts < pts_to_search) {
av_log(anim->pFormatCtx,
AV_LOG_DEBUG,
" WHILE: pts=%lld in search of %lld\n",
- anim->next_pts, pts_to_search);
+ (long long int)anim->next_pts, (long long int)pts_to_search);
if (!ffmpeg_decode_video_frame(anim)) {
break;
}
@@ -841,7 +841,7 @@ static void ffmpeg_decode_video_frame_scan(
AV_LOG_ERROR,
"SCAN failed: completely lost in stream, "
"bailing out at PTS=%lld, searching for PTS=%lld\n",
- anim->next_pts, pts_to_search);
+ (long long int)anim->next_pts, (long long int)pts_to_search);
}
if (anim->next_pts == pts_to_search) {
av_log(anim->pFormatCtx,
@@ -938,13 +938,13 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"FETCH: looking for PTS=%lld "
"(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n",
- pts_to_search, pts_time_base, frame_rate, st_time);
+ (long long int)pts_to_search, pts_time_base, frame_rate, st_time);
if (anim->last_frame &&
anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search){
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"FETCH: frame repeat: last: %lld next: %lld\n",
- anim->last_pts, anim->next_pts);
+ (long long int)anim->last_pts, (long long int)anim->next_pts);
IMB_refImBuf(anim->last_frame);
anim->curposition = position;
return anim->last_frame;
@@ -957,7 +957,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
av_log(anim->pFormatCtx, AV_LOG_DEBUG,
"FETCH: no seek necessary: "
"next: %lld next undecoded: %lld\n",
- anim->next_pts, anim->next_undecoded_pts);
+ (long long int)anim->next_pts,
+ (long long int)anim->next_undecoded_pts);
/* we are already done :) */
@@ -1031,7 +1032,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
"FETCH: "
"error while seeking to DTS = %lld "
"(frameno = %d, PTS = %lld): errcode = %d\n",
- pos, position, pts_to_search, ret);
+ pos, position, (long long int)pts_to_search, ret);
}
avcodec_flush_buffers(anim->pCodecCtx);
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index d79e881e5a2..635813d856e 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -87,7 +87,7 @@ anim_index_builder * IMB_index_builder_create(const char * name)
BLI_make_existing_file(rv->temp_name);
- rv->fp = fopen(rv->temp_name, "w");
+ rv->fp = fopen(rv->temp_name, "wb");
if (!rv->fp) {
fprintf(stderr, "Couldn't open index target: %s! "
@@ -797,7 +797,7 @@ static int index_rebuild_ffmpeg(struct anim * anim,
while(av_read_frame(iFormatCtx, &next_packet) >= 0) {
int frame_finished = 0;
- float next_progress = ((int)floor(((double) next_packet.pos) * 100 /
+ float next_progress = (float)((int)floor(((double) next_packet.pos) * 100 /
((double) stream_size)+0.5)) / 100;
if (*progress != next_progress) {
@@ -840,8 +840,8 @@ static int index_rebuild_ffmpeg(struct anim * anim,
start_pts_set = TRUE;
}
- frameno = (pts - start_pts)
- * pts_time_base * frame_rate;
+ frameno = floor((pts - start_pts)
+ * pts_time_base * frame_rate + 0.5f);
/* decoding starts *always* on I-Frames,
so: P-Frames won't work, even if all the
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 88f6508d356..e064d7f760d 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -98,7 +98,7 @@ class Mem_IStream: public IStream
public:
Mem_IStream (unsigned char *exrbuf, size_t exrsize):
- IStream("dummy"), _exrpos (0), _exrsize(exrsize) { _exrbuf = exrbuf; }
+ IStream("dummy"), _exrpos (0), _exrsize(exrsize) { _exrbuf = exrbuf; }
virtual bool read (char c[], int n);
virtual Int64 tellg ();
@@ -107,8 +107,8 @@ public:
//virtual ~Mem_IStream() {}; // unused
private:
-
- Int64 _exrpos;
+
+ Int64 _exrpos;
Int64 _exrsize;
unsigned char *_exrbuf;
};
@@ -116,11 +116,11 @@ private:
bool Mem_IStream::read (char c[], int n)
{
if (n + _exrpos <= _exrsize)
- {
+ {
memcpy(c, (void *)(&_exrbuf[_exrpos]), n);
_exrpos += n;
return true;
- }
+ }
else
return false;
}
@@ -308,7 +308,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
delete [] pixels;
}
catch (const std::exception &exc)
- {
+ {
printf("OpenEXR-save: ERROR: %s\n", exc.what());
if (ibuf) IMB_freeImBuf(ibuf);
@@ -365,7 +365,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
delete file;
}
catch (const std::exception &exc)
- {
+ {
printf("OpenEXR-save: ERROR: %s\n", exc.what());
if (ibuf) IMB_freeImBuf(ibuf);
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index f81a05f5625..9c8a0231907 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -206,6 +206,8 @@ typedef struct PreviewImage {
#define ID_CHECK_UNDO(id) ((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM))
+#define ID_BLEND_PATH(_bmain, _id) ((_id)->lib ? (_id)->lib->filepath : (_bmain)->name)
+
#ifdef GS
#undef GS
#endif
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index b259d592864..a4d0b3685e3 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -99,7 +99,8 @@ typedef struct bGPDlayer {
float color[4]; /* color that should be used to draw all the strokes in this layer */
- char info[128]; /* optional reference info about this layer (i.e. "director's comments, 12/3") */
+ char info[128]; /* optional reference info about this layer (i.e. "director's comments, 12/3")
+ * this is used for the name of the layer too and kept unique. */
} bGPDlayer;
/* bGPDlayer->flag */
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 47b70afab46..f6cfc94d09e 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -74,7 +74,7 @@ typedef enum ModifierType {
eModifierType_WeightVGEdit,
eModifierType_WeightVGMix,
eModifierType_WeightVGProximity,
- eModifierType_NavMesh,
+ eModifierType_EmptySlot, /* keep so DynamicPaint keep loading, can re-use later */
eModifierType_DynamicPaint, /* reserve slot */
NUM_MODIFIER_TYPES
} ModifierType;
@@ -751,10 +751,6 @@ typedef struct ScrewModifierData {
#define MOD_SCREW_OBJECT_OFFSET (1<<2)
// #define MOD_SCREW_OBJECT_ANGLE (1<<4)
-typedef struct NavMeshModifierData {
- ModifierData modifier;
-} NavMeshModifierData;
-
typedef struct WarpModifierData {
ModifierData modifier;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index f0f346fb759..cb70a8274bd 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -426,8 +426,7 @@ typedef struct GameFraming {
#define SCE_GAMEFRAMING_EXTEND 1
#define SCE_GAMEFRAMING_SCALE 2
-typedef struct RecastData
-{
+typedef struct RecastData {
float cellsize;
float cellheight;
float agentmaxslope;
@@ -441,6 +440,7 @@ typedef struct RecastData
int vertsperpoly;
float detailsampledist;
float detailsamplemaxerror;
+ short pad1, pad2;
} RecastData;
typedef struct GameData {
@@ -453,8 +453,7 @@ typedef struct GameData {
/* stereo/dome mode */
struct GameDome dome;
short stereoflag, stereomode;
- short pad2, pad3;
- float eyeseparation, pad1;
+ float eyeseparation;
RecastData recastData;
@@ -470,11 +469,13 @@ typedef struct GameData {
* bit 3: (gameengine): Activity culling is enabled.
* bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling
*/
- short mode, flag, matmode, pad[2];
+ int flag;
+ short mode, matmode;
short occlusionRes; /* resolution of occlusion Z buffer in pixel */
short physicsEngine;
+ short pad[2];
short ticrate, maxlogicstep, physubstep, maxphystep;
- short obstacleSimulation;
+ short obstacleSimulation, pad1;
float levelHeight;
} GameData;
@@ -520,9 +521,9 @@ typedef struct GameData {
#define GAME_IGNORE_DEPRECATION_WARNINGS (1 << 12)
#define GAME_ENABLE_ANIMATION_RECORD (1 << 13)
#define GAME_SHOW_MOUSE (1 << 14)
-#define GAME_SHOW_OBSTACLE_SIMULATION (1 << 15)
#define GAME_GLSL_NO_COLOR_MANAGEMENT (1 << 15)
-/* Note: GameData.flag is a short (max 16 flags). To add more flags, GameData.flag needs to be an int */
+#define GAME_SHOW_OBSTACLE_SIMULATION (1 << 16)
+/* Note: GameData.flag is now an int (max 32 flags). A short could only take 16 flags */
/* GameData.matmode */
#define GAME_MAT_TEXFACE 0
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 25834465de8..dc08e95acb3 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -354,7 +354,7 @@ extern StructRNA RNA_OperatorFileListElement;
extern StructRNA RNA_OperatorMousePath;
extern StructRNA RNA_OperatorProperties;
extern StructRNA RNA_OperatorStrokeElement;
-extern StructRNA RNA_OperatorTypeMacro;
+extern StructRNA RNA_OperatorMacro;
extern StructRNA RNA_OrController;
extern StructRNA RNA_OutflowFluidSettings;
extern StructRNA RNA_PackedFile;
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index ddd0fcc1007..b366a23c19a 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -317,9 +317,15 @@ static int rna_IDPArray_length(PointerRNA *ptr)
int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr)
{
ID *id= ptr->id.data;
+ short *totcol= give_totcolp_id(id);
Material *mat_id= assign_ptr->id.data;
- assign_material_id(id, mat_id, key + 1);
- return 1;
+ if(totcol && (key >= 0 && key < *totcol)) {
+ assign_material_id(id, mat_id, key + 1);
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
#else
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index 82911ebb3be..ba90aca47a3 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -141,12 +141,12 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
psys->part= part;
psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
psys->flag |= PSYS_ENABLED;
- sprintf(psys->name, "FluidParticles");
+ BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
BLI_addtail(&ob->particlesystem,psys);
/* add modifier */
psmd= (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem);
- sprintf(psmd->modifier.name, "FluidParticleSystem" );
+ BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name));
psmd->psys= psys;
BLI_addtail(&ob->modifiers, psmd);
modifier_unique_name(&ob->modifiers, (ModifierData *)psmd);
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 810db9f3634..371c387e871 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -40,6 +40,8 @@
#ifdef RNA_RUNTIME
+#include "BLI_path_util.h"
+
static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr)
{
bGPDlayer *gpl= (bGPDlayer *)ptr->data;
@@ -90,6 +92,17 @@ static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value)
}
}
+void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value)
+{
+ bGPdata *gpd= ptr->id.data;
+ bGPDlayer *gpl= ptr->data;
+
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info));
+
+ BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
+}
+
#else
static void rna_def_gpencil_stroke_point(BlenderRNA *brna)
@@ -176,6 +189,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
/* Name */
prop= RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Info", "Layer name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_info_set");
RNA_def_struct_name_property(srna, prop);
/* Frames */
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index b7827989a94..50ce816d7a1 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -142,7 +142,7 @@ static void rna_Image_pack(Image *image, ReportList *reports, int as_png)
BKE_image_memorypack(image);
}
else {
- image->packedfile= newPackedFile(reports, image->name);
+ image->packedfile= newPackedFile(reports, image->name, ID_BLEND_PATH(G.main, &image->id));
}
}
}
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 54bae59ae93..7b26a8cb783 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -344,12 +344,12 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall
mb->id.name+2, ID_REAL_USERS(mb));
}
-VFont *rna_Main_fonts_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
+VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
{
VFont *font;
errno= 0;
- font= load_vfont(filepath);
+ font= load_vfont(bmain, filepath);
if(!font)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index c77e21ab8fa..b82cbafc3c5 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -92,7 +92,6 @@ EnumPropertyItem modifier_type_items[] ={
{eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
{eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
{eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
- {eModifierType_NavMesh, "NAVMESH", ICON_MOD_PHYSICS, "Navigation mesh", ""},
{eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLES, "Particle Instance", ""},
{eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""},
{eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
@@ -191,8 +190,6 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
return &RNA_ScrewModifier;
case eModifierType_Warp:
return &RNA_WarpModifier;
- case eModifierType_NavMesh:
- return &RNA_NavMeshModifier;
case eModifierType_WeightVGEdit:
return &RNA_VertexWeightEditModifier;
case eModifierType_WeightVGMix:
@@ -279,7 +276,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
part->end = 250.0f;
part->ren_as = PART_DRAW_NOT;
part->draw_as = PART_DRAW_DOT;
- sprintf(psys->name, "SmokeParticles");
+ BLI_strncpy(psys->name, "SmokeParticles", sizeof(psys->name));
psys->recalc |= (PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
}
@@ -2519,17 +2516,6 @@ static void rna_def_modifier_screw(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");*/
}
-static void rna_def_modifier_navmesh(BlenderRNA *brna)
-{
- StructRNA *srna;
- /* PropertyRNA *prop; */ /* UNUSED */
-
- srna= RNA_def_struct(brna, "NavMeshModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "NavMesh Modifier", "NavMesh modifier");
- RNA_def_struct_sdna(srna, "NavMeshModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
-}
-
static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
{
static EnumPropertyItem weightvg_mask_tex_map_items[] = {
@@ -2922,7 +2908,6 @@ void RNA_def_modifier(BlenderRNA *brna)
rna_def_modifier_smoke(brna);
rna_def_modifier_solidify(brna);
rna_def_modifier_screw(brna);
- rna_def_modifier_navmesh(brna);
rna_def_modifier_weightvgedit(brna);
rna_def_modifier_weightvgmix(brna);
rna_def_modifier_weightvgproximity(brna);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 3141369fcd4..428599af977 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -250,16 +250,20 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
- DAG_scene_sort(bmain, scene);
+ if (scene) {
+ DAG_scene_sort(bmain, scene);
+ }
WM_main_add_notifier(NC_OBJECT|ND_PARENT, ptr->id.data);
}
/* when changing the selection flag the scene needs updating */
static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
- Object *ob= (Object*)ptr->id.data;
- short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
- ED_base_object_select(object_in_scene(ob, scene), mode);
+ if (scene) {
+ Object *ob= (Object*)ptr->id.data;
+ short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
+ ED_base_object_select(object_in_scene(ob, scene), mode);
+ }
}
static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -886,6 +890,7 @@ static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
{
Object *ob= (Object*)ptr->id.data;
+ const int was_navmesh= (ob->gameflag & OB_NAVMESH);
ob->body_type= value;
switch (ob->body_type) {
@@ -901,6 +906,12 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
case OB_BODY_TYPE_NAVMESH:
ob->gameflag |= OB_NAVMESH;
ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_OCCLUDER);
+
+ if (ob->type == OB_MESH) {
+ /* could be moved into mesh UI but for now ensure mesh data layer */
+ BKE_mesh_ensure_navmesh(ob->data);
+ }
+
break;
case OB_BODY_TYPE_NO_COLLISION:
ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_OCCLUDER|OB_DYNAMIC|OB_NAVMESH);
@@ -932,6 +943,15 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
ob->bsoft = bsbNew();
break;
}
+
+ if (was_navmesh != (ob->gameflag & OB_NAVMESH)) {
+ if (ob->type == OB_MESH) {
+ /* this is needed to refresh the derived meshes draw func */
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data);
+ }
+ }
+
}
static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
@@ -1405,8 +1425,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "body_type");
RNA_def_property_enum_items(prop, body_type_items);
- RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get",
- "rna_GameObjectSettings_physics_type_set", NULL);
+ RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL);
RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation");
RNA_def_property_update(prop, NC_LOGIC, NULL);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 8eb25290b18..f0f782fede2 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -691,14 +691,13 @@ static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int
}
}
+static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str);
+
static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
{
- ParticleDupliWeight *dw= ptr->data;
-
- if(dw->ob)
- return strlen(dw->ob->id.name+2) + 7;
- else
- return 9 + 7;
+ char tstr[32];
+ rna_ParticleDupliWeight_name_get(ptr, tstr);
+ return strlen(tstr);
}
static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 454fd6275d9..376b0c529d0 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -506,6 +506,13 @@ static int rna_Property_readonly_get(PointerRNA *ptr)
return prop->flag & PROP_EDITABLE ? 0:1;
}
+static int rna_Property_animatable_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+
+ return (prop->flag & PROP_ANIMATABLE) != 0;
+}
+
static int rna_Property_use_output_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -1066,6 +1073,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
+ prop= RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", NULL);
+ RNA_def_property_ui_text(prop, "Animatable", "Property is animatable through RNA");
+
prop= RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 86f77629ec7..0eaacc62f33 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1739,13 +1739,13 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent");
RNA_def_property_update(prop, NC_SCENE, NULL);
- prop= RNA_def_property(srna, "max_climb", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
RNA_def_property_update(prop, NC_SCENE, NULL);
- prop= RNA_def_property(srna, "max_slope", PROP_FLOAT, PROP_ANGLE);
+ prop= RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
RNA_def_property_range(prop, 0, M_PI/2);
RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees");
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index b350956047c..28b96f3b08b 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -131,13 +131,23 @@ static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UN
{
Scene *scene= CTX_data_scene(C);
Object *ob= (scene->basact)? scene->basact->object: NULL;
+#if 0
PTCacheEdit *edit = PE_get_current(scene, ob);
-
- if(edit && edit->psys) {
- if(edit->psys->flag & PSYS_GLOBAL_HAIR)
+ ParticleSystem *psys= edit ? edit->psys : NULL;
+#else
+ /* use this rather than PE_get_current() - because the editing cache is
+ * dependant on the cache being updated which can happen after this UI
+ * draws causing a glitch [#28883] */
+ ParticleSystem *psys= psys_get_current(ob);
+#endif
+
+ if(psys) {
+ if(psys->flag & PSYS_GLOBAL_HAIR) {
return particle_edit_disconnected_hair_brush_items;
- else
+ }
+ else {
return particle_edit_hair_brush_items;
+ }
}
return particle_edit_cache_brush_items;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index b1de44da0ac..bbebe52cd3d 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1365,7 +1365,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ALIGN);
- RNA_def_property_ui_text(prop, "Align", "Manipulate object centers only");
+ RNA_def_property_ui_text(prop, "Align", "Manipulate center points (object and pose mode only)");
RNA_def_property_ui_icon(prop, ICON_ALIGN, 0);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 85ad6b231aa..9e9e64a480d 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -428,6 +428,10 @@ void RNA_api_ui_layout(StructRNA *srna)
func= RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ func= RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
+ parm= RNA_def_pointer(func, "item", "KeyMapItem", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
+
func= RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
parm= RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 5d2f24e8324..11157e67741 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2532,11 +2532,14 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{18, "UKRAINIAN", 0, N_("Ukrainian (Український)"), "uk_UA"},
{19, "POLISH", 0, N_("Polish (Polski)"), "pl_PL"},
{20, "ROMANIAN", 0, N_("Romanian (Român)"), "ro_RO"},
- {21, "ARABIC", 0, N_("Arabic (العربية)"), "ar_EG"},
+ /* using the utf8 flipped form of Arabic (العربية) */
+ {21, "ARABIC", 0, N_("Arabic (ﺔﻴﺑﺮﻌﻟﺍ)"), "ar_EG"},
{22, "BULGARIAN", 0, N_("Bulgarian (Български)"), "bg_BG"},
{23, "GREEK", 0, N_("Greek (Ελληνικά)"), "el_GR"},
{24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"},
- /*{25, "Nepali", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/
+ /*{25, "NEPALI", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/
+ /* using the utf8 flipped form of Persian (فارسی) */
+ {26, "PERSIAN", 0, N_("Persian (ﺱﺭﺎﻓ)"), "fa_PE"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
@@ -2661,8 +2664,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO);
- RNA_def_property_ui_text(prop, "VBOs",
- "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering");
+ RNA_def_property_ui_text(prop, "VBOs", "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering");
+ RNA_def_property_update(prop, NC_WINDOW, NULL); /* this isnt essential but nice to check if VBO draws any differently */
prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 8fa780de498..e9df79acd4a 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -451,7 +451,7 @@ static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties);
}
-static PointerRNA rna_OperatorTypeMacro_properties_get(PointerRNA *ptr)
+static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
{
wmOperatorTypeMacro *otmacro= (wmOperatorTypeMacro*)ptr->data;
wmOperatorType *ot = WM_operatortype_find(otmacro->idname, TRUE);
@@ -1277,8 +1277,8 @@ static void rna_def_operator_type_macro(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna= RNA_def_struct(brna, "OperatorTypeMacro", NULL);
- RNA_def_struct_ui_text(srna, "OperatorTypeMacro", "Storage of a sub operator in a macro after it has been added");
+ srna= RNA_def_struct(brna, "OperatorMacro", NULL);
+ RNA_def_struct_ui_text(srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added");
RNA_def_struct_sdna(srna, "wmOperatorTypeMacro");
// prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
@@ -1291,7 +1291,7 @@ static void rna_def_operator_type_macro(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "OperatorProperties");
RNA_def_property_ui_text(prop, "Properties", "");
- RNA_def_property_pointer_funcs(prop, "rna_OperatorTypeMacro_properties_get", NULL, NULL, NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_OperatorMacro_properties_get", NULL, NULL, NULL);
}
static void rna_def_operator_utils(BlenderRNA *brna)
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index a1f834f4362..735437a0785 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -66,7 +66,6 @@ set(SRC
intern/MOD_meshdeform.c
intern/MOD_mirror.c
intern/MOD_multires.c
- intern/MOD_navmesh.c
intern/MOD_none.c
intern/MOD_particleinstance.c
intern/MOD_particlesystem.c
diff --git a/source/blender/modifiers/intern/MOD_navmesh.c b/source/blender/modifiers/intern/MOD_navmesh.c
deleted file mode 100644
index c259239a003..00000000000
--- a/source/blender/modifiers/intern/MOD_navmesh.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
-* $Id$
-*
-* ***** 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.
-*
-* The Original Code is Copyright (C) 2005 by the Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s):
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
-
-/** \file blender/modifiers/intern/MOD_navmesh.c
- * \ingroup modifiers
- */
-
-
-#include <math.h>
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-
-#ifdef WITH_GAMEENGINE
-# include "recast-capi.h"
-# include "BKE_navmesh_conversion.h"
-# include "GL/glew.h"
-# include "GPU_buffers.h"
-# include "GPU_draw.h"
-#endif
-
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_cdderivedmesh.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_customdata.h"
-#include "MEM_guardedalloc.h"
-
-BM_INLINE int bit(int a, int b)
-{
- return (a & (1 << b)) >> b;
-}
-
-BM_INLINE void intToCol(int i, float* col)
-{
- int r = bit(i, 0) + bit(i, 3) * 2 + 1;
- int g = bit(i, 1) + bit(i, 4) * 2 + 1;
- int b = bit(i, 2) + bit(i, 5) * 2 + 1;
- col[0] = 1 - r*63.0f/255.0f;
- col[1] = 1 - g*63.0f/255.0f;
- col[2] = 1 - b*63.0f/255.0f;
-}
-
-
-static void initData(ModifierData *UNUSED(md))
-{
- /* NavMeshModifierData *nmmd = (NavMeshModifierData*) md; */ /* UNUSED */
-}
-
-static void copyData(ModifierData *UNUSED(md), ModifierData *UNUSED(target))
-{
- /* NavMeshModifierData *nmmd = (NavMeshModifierData*) md; */
- /* NavMeshModifierData *tnmmd = (NavMeshModifierData*) target; */
-
- //.todo - deep copy
-}
-
-/*
-static void (*drawFacesSolid_original)(DerivedMesh *dm, float (*partial_redraw_planes)[4],
- int fast, int (*setMaterial)(int, void *attribs)) = NULL;*/
-
-#ifdef WITH_GAMEENGINE
-
-static void drawNavMeshColored(DerivedMesh *dm)
-{
- int a, glmode;
- MVert *mvert = (MVert *)CustomData_get_layer(&dm->vertData, CD_MVERT);
- MFace *mface = (MFace *)CustomData_get_layer(&dm->faceData, CD_MFACE);
- int* polygonIdx = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST);
- const float BLACK_COLOR[3] = {0.f, 0.f, 0.f};
- float col[3];
-
- if (!polygonIdx)
- return;
-
- /*
- //UI_ThemeColor(TH_WIRE);
- glDisable(GL_LIGHTING);
- glLineWidth(2.0);
- dm->drawEdges(dm, 0, 1);
- glLineWidth(1.0);
- glEnable(GL_LIGHTING);*/
-
- glDisable(GL_LIGHTING);
- if(GPU_buffer_legacy(dm) ) {
- DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" );
- //glShadeModel(GL_SMOOTH);
- glBegin(glmode = GL_QUADS);
- for(a = 0; a < dm->numFaceData; a++, mface++) {
- int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
- int polygonIdx = *(int*)CustomData_get(&dm->faceData, a, CD_RECAST);
- if (polygonIdx<=0)
- memcpy(col, BLACK_COLOR, 3*sizeof(float));
- else
- intToCol(polygonIdx, col);
-
- if(new_glmode != glmode) {
- glEnd();
- glBegin(glmode = new_glmode);
- }
- glColor3fv(col);
- glVertex3fv(mvert[mface->v1].co);
- glVertex3fv(mvert[mface->v2].co);
- glVertex3fv(mvert[mface->v3].co);
- if(mface->v4) {
- glVertex3fv(mvert[mface->v4].co);
- }
- }
- glEnd();
- }
- glEnable(GL_LIGHTING);
-}
-
-static void navDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr))
-{
- (void) setDrawOptions;
-
- drawNavMeshColored(dm);
-}
-
-static void navDM_drawFacesSolid(DerivedMesh *dm,
- float (*partial_redraw_planes)[4],
- int UNUSED(fast), int (*setMaterial)(int, void *attribs))
-{
- (void) partial_redraw_planes;
- (void) setMaterial;
-
- //drawFacesSolid_original(dm, partial_redraw_planes, fast, setMaterial);
- drawNavMeshColored(dm);
-}
-#endif /* WITH_GAMEENGINE */
-
-static DerivedMesh *createNavMeshForVisualization(NavMeshModifierData *UNUSED(mmd), DerivedMesh *dm)
-{
-#ifdef WITH_GAMEENGINE
- DerivedMesh *result;
- int maxFaces = dm->getNumFaces(dm);
- int *recastData;
- int vertsPerPoly=0, nverts=0, ndtris=0, npolys=0;
- float* verts=NULL;
- unsigned short *dtris=NULL, *dmeshes=NULL, *polys=NULL;
- int *dtrisToPolysMap=NULL, *dtrisToTrisMap=NULL, *trisToFacesMap=NULL;
- int res;
-
- result = CDDM_copy(dm);
- if (!CustomData_has_layer(&result->faceData, CD_RECAST))
- {
- int *sourceRecastData = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST);
- CustomData_add_layer_named(&result->faceData, CD_RECAST, CD_DUPLICATE,
- sourceRecastData, maxFaces, "recastData");
- }
- recastData = (int*)CustomData_get_layer(&result->faceData, CD_RECAST);
- result->drawFacesTex = navDM_drawFacesTex;
- result->drawFacesSolid = navDM_drawFacesSolid;
-
-
- //process mesh
- res = buildNavMeshDataByDerivedMesh(dm, &vertsPerPoly, &nverts, &verts, &ndtris, &dtris,
- &npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap,
- &trisToFacesMap);
- if (res)
- {
- size_t polyIdx;
-
- //invalidate concave polygon
- for (polyIdx=0; polyIdx<(size_t)npolys; polyIdx++)
- {
- unsigned short* poly = &polys[polyIdx*2*vertsPerPoly];
- if (!polyIsConvex(poly, vertsPerPoly, verts))
- {
- //set negative polygon idx to all faces
- unsigned short *dmesh = &dmeshes[4*polyIdx];
- unsigned short tbase = dmesh[2];
- unsigned short tnum = dmesh[3];
- unsigned short ti;
-
- for (ti=0; ti<tnum; ti++)
- {
- unsigned short triidx = dtrisToTrisMap[tbase+ti];
- unsigned short faceidx = trisToFacesMap[triidx];
- if (recastData[faceidx]>0)
- recastData[faceidx] = -recastData[faceidx];
- }
- }
- }
-
- }
- else
- {
- printf("Error during creation polygon infos\n");
- }
-
- //clean up
- if (verts!=NULL)
- MEM_freeN(verts);
- if (dtris!=NULL)
- MEM_freeN(dtris);
- if (dmeshes!=NULL)
- MEM_freeN(dmeshes);
- if (polys!=NULL)
- MEM_freeN(polys);
- if (dtrisToPolysMap!=NULL)
- MEM_freeN(dtrisToPolysMap);
- if (dtrisToTrisMap!=NULL)
- MEM_freeN(dtrisToTrisMap);
- if (trisToFacesMap!=NULL)
- MEM_freeN(trisToFacesMap);
-
- return result;
-#else // WITH_GAMEENGINE
- return dm;
-#endif // WITH_GAMEENGINE
-}
-
-/*
-static int isDisabled(ModifierData *md, int useRenderParams)
-{
- NavMeshModifierData *amd = (NavMeshModifierData*) md;
- return false;
-}*/
-
-
-
-static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *derivedData,
- int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
-{
- DerivedMesh *result = NULL;
- NavMeshModifierData *nmmd = (NavMeshModifierData*) md;
- int hasRecastData = CustomData_has_layer(&derivedData->faceData, CD_RECAST)>0;
- if (ob->body_type!=OB_BODY_TYPE_NAVMESH || !hasRecastData )
- {
- //convert to nav mesh object:
- //1)set physics type
- ob->gameflag &= ~OB_COLLISION;
- ob->gameflag |= OB_NAVMESH;
- ob->body_type = OB_BODY_TYPE_NAVMESH;
- //2)add and init recast data layer
- if (!hasRecastData)
- {
- Mesh* obmesh = (Mesh *)ob->data;
- if (obmesh)
- {
- int i;
- int numFaces = obmesh->totface;
- int* recastData;
- CustomData_add_layer_named(&obmesh->fdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
- recastData = (int*)CustomData_get_layer(&obmesh->fdata, CD_RECAST);
- for (i=0; i<numFaces; i++)
- {
- recastData[i] = i+1;
- }
- CustomData_add_layer_named(&derivedData->faceData, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
- }
- }
- }
-
- result = createNavMeshForVisualization(nmmd, derivedData);
-
- return result;
-}
-
-
-ModifierTypeInfo modifierType_NavMesh = {
- /* name */ "NavMesh",
- /* structName */ "NavMeshModifierData",
- /* structSize */ sizeof(NavMeshModifierData),
- /* type */ eModifierTypeType_Constructive,
- /* flags */ (ModifierTypeFlag) (eModifierTypeFlag_AcceptsMesh
- | eModifierTypeFlag_Single),
- /* copyData */ copyData,
- /* deformVerts */ 0,
- /* deformMatrices */ 0,
- /* deformVertsEM */ 0,
- /* deformMatricesEM */ 0,
- /* applyModifier */ applyModifier,
- /* applyModifierEM */ 0,
- /* initData */ initData,
- /* requiredDataMask */ 0,
- /* freeData */ 0,
- /* isDisabled */ 0,
- /* updateDepgraph */ 0,
- /* dependsOnTime */ 0,
- /* foreachObjectLink */ 0,
- /* foreachIDLink */ 0,
-};
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index 45720126535..ed63b38588b 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -276,7 +276,6 @@ void modifier_type_init(ModifierTypeInfo *types[])
INIT_TYPE(Solidify);
INIT_TYPE(Screw);
INIT_TYPE(Warp);
- INIT_TYPE(NavMesh);
INIT_TYPE(WeightVGEdit);
INIT_TYPE(WeightVGMix);
INIT_TYPE(WeightVGProximity);
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index c18a35fdd98..5e32800fe45 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -38,7 +38,7 @@
/* **************** IMAGE (and RenderResult, multilayer image) ******************** */
static bNodeSocketTemplate cmp_node_rlayers_out[]= {
- { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index fa5a3c727c2..56f80840112 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -199,6 +199,9 @@ bNode *node_group_make_from_selected(bNodeTree *ntree)
}
}
+ /* node groups don't use internal cached data */
+ ntreeFreeCache(ngroup);
+
/* make group node */
ntemp.type = NODE_GROUP;
ntemp.ngroup = ngroup;
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 608347bc258..53bbb27f9b0 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -174,11 +174,13 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
exec->stacksize = index;
exec->stack = MEM_callocN(exec->stacksize * sizeof(bNodeStack), "bNodeStack");
+ /* all non-const results are considered inputs */
+ for (n=0; n < exec->stacksize; ++n)
+ exec->stack[n].hasinput = 1;
+
/* prepare group tree inputs */
for (sock=ntree->inputs.first; sock; sock=sock->next) {
ns = setup_stack(exec->stack, sock);
- if (ns->hasoutput)
- ns->hasinput = 1;
}
/* prepare all internal nodes for execution */
for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
@@ -191,14 +193,12 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
node->need_exec= 0;
ns = setup_stack(exec->stack, sock);
- if (ns->hasoutput)
- ns->hasinput = 1;
+ ns->hasoutput = 1;
}
/* tag all outputs */
for (sock=node->outputs.first; sock; sock=sock->next) {
ns = setup_stack(exec->stack, sock);
- ns->hasoutput = 1;
}
if(node->typeinfo->initexecfunc)
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index e6883eb30af..1524812086b 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -254,7 +254,7 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
idprop= IDP_GetPropertyFromGroup(self->prop, name);
- if(idprop==NULL) {
+ if (idprop==NULL) {
PyErr_SetString(PyExc_KeyError, "key not in subgroup dict");
return NULL;
}
@@ -273,20 +273,20 @@ static int idp_sequence_type(PyObject *seq)
for (i=0; i < len; i++) {
item = PySequence_GetItem(seq, i);
if (PyFloat_Check(item)) {
- if(type == IDP_IDPARRAY) { /* mixed dict/int */
+ if (type == IDP_IDPARRAY) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
type= IDP_DOUBLE;
}
else if (PyLong_Check(item)) {
- if(type == IDP_IDPARRAY) { /* mixed dict/int */
+ if (type == IDP_IDPARRAY) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
}
else if (PyMapping_Check(item)) {
- if(i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */
+ if (i != 0 && (type != IDP_IDPARRAY)) { /* mixed dict/int */
Py_DECREF(item);
return -1;
}
@@ -309,7 +309,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
IDProperty *prop = NULL;
IDPropertyTemplate val = {0};
- if(strlen(name) >= sizeof(group->name))
+ if (strlen(name) >= sizeof(group->name))
return "the length of IDProperty names is limited to 31 characters";
if (PyFloat_Check(ob)) {
@@ -335,7 +335,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
PyObject *item;
int i;
- if((val.array.type= idp_sequence_type(ob)) == -1)
+ if ((val.array.type= idp_sequence_type(ob)) == -1)
return "only floats, ints and dicts are allowed in ID property arrays";
/*validate sequence and derive type.
@@ -369,7 +369,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
error= BPy_IDProperty_Map_ValidateAndCreate("", prop, item);
Py_DECREF(item);
- if(error)
+ if (error)
return error;
}
break;
@@ -415,7 +415,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
}
else return "invalid property value";
- if(group->type==IDP_IDPARRAY) {
+ if (group->type==IDP_IDPARRAY) {
IDP_AppendArray(group, prop);
// IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
MEM_freeN(prop);
@@ -598,7 +598,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
idprop= IDP_GetPropertyFromGroup(self->prop, name);
- if(idprop) {
+ if (idprop) {
pyform = BPy_IDGroup_MapDataToPy(idprop);
if (!pyform) {
@@ -1050,7 +1050,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
case IDP_FLOAT:
{
float *array= (float*)IDP_Array(prop);
- for(count = begin; count < end; count++) {
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
}
break;
@@ -1058,7 +1058,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
case IDP_DOUBLE:
{
double *array= (double*)IDP_Array(prop);
- for(count = begin; count < end; count++) {
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
}
break;
@@ -1066,7 +1066,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
case IDP_INT:
{
int *array= (int*)IDP_Array(prop);
- for(count = begin; count < end; count++) {
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count]));
}
break;
@@ -1094,7 +1094,7 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject
alloc_len= size * elem_size;
vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
- if(PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
+ if (PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
MEM_freeN(vec);
return -1;
}
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 35c211d5424..e8dd0274568 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -95,7 +95,7 @@ static PyObject *Buffer_to_list_recursive(Buffer *self)
{
PyObject *list;
- if(self->ndimensions > 1) {
+ if (self->ndimensions > 1) {
int i, len= self->dimensions[0];
list= PyList_New(len);
@@ -213,7 +213,7 @@ PyTypeObject BGL_bufferType = {
static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
arg_def##nargs arg_list; \
ret_def_##ret; \
- if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
+ if (!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
ret_set_##ret gl##funcname (arg_var##nargs arg_list);\
ret_ret_##ret; \
}
@@ -222,7 +222,7 @@ static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
arg_def##nargs arg_list; \
ret_def_##ret; \
- if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
+ if (!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
ret_set_##ret glu##funcname (arg_var##nargs arg_list);\
ret_ret_##ret; \
}
@@ -289,7 +289,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
int type;
Py_ssize_t i, ndimensions = 0;
- if(kwds && PyDict_Size(kwds)) {
+ if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
"bgl.Buffer(): takes no keyword args");
return NULL;
@@ -307,7 +307,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
if (PyLong_Check(length_ob)) {
ndimensions= 1;
- if(((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
+ if (((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
PyErr_SetString(PyExc_AttributeError,
"dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
return NULL;
@@ -332,7 +332,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
else dimensions[i]= PyLong_AsLong(ob);
Py_DECREF(ob);
- if(dimensions[i] < 1) {
+ if (dimensions[i] < 1) {
PyErr_SetString(PyExc_AttributeError,
"dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
return NULL;
@@ -490,7 +490,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
for (count= begin; count < end; count++) {
item= PySequence_GetItem(seq, count - begin);
- if(item) {
+ if (item) {
err= Buffer_ass_item(self, count, item);
Py_DECREF(item);
}
@@ -1293,7 +1293,7 @@ PyObject *BPyInit_bgl(void)
submodule= PyModule_Create(&BGL_module_def);
dict= PyModule_GetDict(submodule);
- if(PyType_Ready(&BGL_bufferType) < 0)
+ if (PyType_Ready(&BGL_bufferType) < 0)
return NULL; /* should never happen */
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 90260100c83..0346c421f68 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -62,7 +62,7 @@ void bpy_import_init(PyObject *builtins)
/* move reload here
* XXX, use import hooks */
mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
- if(mod) {
+ if (mod) {
PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
Py_DECREF(mod);
}
@@ -74,7 +74,7 @@ void bpy_import_init(PyObject *builtins)
static void free_compiled_text(Text *text)
{
- if(text->compiled) {
+ if (text->compiled) {
Py_DECREF((PyObject *)text->compiled);
}
text->compiled= NULL;
@@ -93,7 +93,7 @@ void bpy_import_main_set(struct 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", text->id.lib ? text->id.lib->filepath : bpy_import_main->name, 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)
@@ -102,7 +102,7 @@ PyObject *bpy_text_import(Text *text)
char modulename[24];
int len;
- if(!text->compiled) {
+ if (!text->compiled) {
char fn_dummy[256];
bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
@@ -110,7 +110,7 @@ PyObject *bpy_text_import(Text *text)
text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
MEM_freeN(buf);
- if(PyErr_Occurred()) {
+ if (PyErr_Occurred()) {
PyErr_Print();
PyErr_Clear();
PySys_SetObject("last_traceback", NULL);
@@ -135,7 +135,7 @@ PyObject *bpy_text_import_name(char *name, int *found)
*found= 0;
- if(!maggie) {
+ if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL;
}
@@ -147,7 +147,7 @@ PyObject *bpy_text_import_name(char *name, int *found)
text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
- if(!text)
+ if (!text)
return NULL;
else
*found= 1;
@@ -169,7 +169,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
Main *maggie= bpy_import_main;
- if(!maggie) {
+ if (!maggie) {
printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n");
return NULL;
}
@@ -177,24 +177,24 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
*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);
/* uh-oh.... didn't find it */
- if(!text)
+ if (!text)
return NULL;
else
*found= 1;
/* if previously compiled, free the object */
/* (can't see how could be NULL, but check just in case) */
- if(text->compiled){
+ if (text->compiled) {
Py_DECREF((PyObject *)text->compiled);
}
@@ -204,7 +204,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
MEM_freeN(buf);
/* if compile failed.... return this error */
- if(PyErr_Occurred()) {
+ if (PyErr_Occurred()) {
PyErr_Print();
PyErr_Clear();
PySys_SetObject("last_traceback", NULL);
@@ -229,14 +229,14 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
//PyObject_Print(args, stderr, 0);
static const char *kwlist[]= {"name", "globals", "locals", "fromlist", "level", NULL};
- if(!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist,
&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);
- if(newmodule)
+ if (newmodule)
return newmodule;
PyErr_Fetch(&exception, &err, &tb); /* get the python error incase we cant import as blender text either */
@@ -244,7 +244,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
/* importing from existing modules failed, see if we have this module as blender text */
newmodule= bpy_text_import_name(name, &found);
- if(newmodule) {/* found module as blender text, ignore above exception */
+ if (newmodule) {/* found module as blender text, ignore above exception */
PyErr_Clear();
Py_XDECREF(exception);
Py_XDECREF(err);
@@ -278,14 +278,14 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
/* try reimporting from file */
newmodule= PyImport_ReloadModule(module);
- if(newmodule)
+ 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);
- if(newmodule) {/* found module as blender text, ignore above exception */
+ if (newmodule) {/* found module as blender text, ignore above exception */
PyErr_Clear();
Py_XDECREF(exception);
Py_XDECREF(err);
@@ -359,10 +359,10 @@ void bpy_text_clear_modules(int clear_all)
*/
while (PyDict_Next(modules, &pos, &key, &value)) {
fname= PyModule_GetFilename(value);
- if(fname) {
+ if (fname) {
if (clear_all || ((strstr(fname, SEPSTR))==0)) { /* no path ? */
file_extension= strstr(fname, ".py");
- if(file_extension && (*(file_extension + 3) == '\0' || *(file_extension + 4) == '\0')) { /* .py or pyc extension? */
+ if (file_extension && (*(file_extension + 3) == '\0' || *(file_extension + 4) == '\0')) { /* .py or pyc extension? */
/* now we can be fairly sure its a python import from the blendfile */
PyList_Append(list, key); /* free'd with the list */
}
@@ -374,7 +374,7 @@ void bpy_text_clear_modules(int clear_all)
}
/* remove all our modules */
- for(pos=0; pos < PyList_GET_SIZE(list); pos++) {
+ for (pos=0; pos < PyList_GET_SIZE(list); pos++) {
/* PyObject_Print(key, stderr, 0); */
key= PyList_GET_ITEM(list, pos);
PyDict_DelItem(modules, key);
diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c
index 7be0998c0a1..2171f1f7f39 100644
--- a/source/blender/python/generic/noise_py_api.c
+++ b/source/blender/python/generic/noise_py_api.c
@@ -136,7 +136,7 @@ static void init_genrand(unsigned long s)
{
int j;
state[0] = s & 0xffffffffUL;
- for(j = 1; j < N; j++) {
+ for (j = 1; j < N; j++) {
state[j] =
(1812433253UL *
(state[j - 1] ^ (state[j - 1] >> 30)) + j);
@@ -157,16 +157,16 @@ static void next_state(void)
/* if init_genrand() has not been called, */
/* a default initial seed is used */
- if(initf == 0)
+ if (initf == 0)
init_genrand(5489UL);
left = N;
next = state;
- for(j = N - M + 1; --j; p++)
+ for (j = N - M + 1; --j; p++)
*p = p[M] ^ TWIST(p[0], p[1]);
- for(j = M; --j; p++)
+ for (j = M; --j; p++)
*p = p[M - N] ^ TWIST(p[0], p[1]);
*p = p[M - N] ^ TWIST(p[0], state[0]);
@@ -176,7 +176,7 @@ static void next_state(void)
static void setRndSeed(int seed)
{
- if(seed == 0)
+ if (seed == 0)
init_genrand(time(NULL));
else
init_genrand(seed);
@@ -187,7 +187,7 @@ static float frand(void)
{
unsigned long y;
- if(--left == 0)
+ if (--left == 0)
next_state();
y = *next++;
@@ -207,7 +207,7 @@ static void randuvec(float v[3])
{
float r;
v[2] = 2.f * frand() - 1.f;
- if((r = 1.f - v[2] * v[2]) > 0.f) {
+ if ((r = 1.f - v[2] * v[2]) > 0.f) {
float a = (float)(6.283185307f * frand());
r = (float)sqrt(r);
v[0] = (float)(r * cosf(a));
@@ -237,7 +237,7 @@ static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self))
static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args)
{
int s;
- if(!PyArg_ParseTuple(args, "i:seed_set", &s))
+ if (!PyArg_ParseTuple(args, "i:seed_set", &s))
return NULL;
setRndSeed(s);
Py_RETURN_NONE;
@@ -251,7 +251,7 @@ static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
int nb = 1;
- if(!PyArg_ParseTuple(args, "(fff)|i:noise", &x, &y, &z, &nb))
+ if (!PyArg_ParseTuple(args, "(fff)|i:noise", &x, &y, &z, &nb))
return NULL;
return PyFloat_FromDouble((2.0f * BLI_gNoise(1.0f, x, y, z, 0, nb) - 1.0f));
@@ -275,7 +275,7 @@ static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, v[3];
int nb = 1;
- if(!PyArg_ParseTuple(args, "(fff)|i:vector", &x, &y, &z, &nb))
+ if (!PyArg_ParseTuple(args, "(fff)|i:vector", &x, &y, &z, &nb))
return NULL;
noise_vector(x, y, z, nb, v);
return Py_BuildValue("[fff]", v[0], v[1], v[2]);
@@ -292,15 +292,15 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
int i;
amp = 1.f;
out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f);
- if(hard)
+ if (hard)
out = (float)fabs(out);
- for(i = 1; i < oct; i++) {
+ for (i = 1; i < oct; i++) {
amp *= ampscale;
x *= freqscale;
y *= freqscale;
z *= freqscale;
t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f));
- if(hard)
+ if (hard)
t = (float)fabs(t);
out += t;
}
@@ -312,7 +312,7 @@ static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args)
float x, y, z;
int oct, hd, nb = 1;
float as = 0.5, fs = 2.0;
- if(!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence", &x, &y, &z, &oct, &hd, &nb, &as, &fs))
+ if (!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence", &x, &y, &z, &oct, &hd, &nb, &as, &fs))
return NULL;
return PyFloat_FromDouble(turb(x, y, z, oct, hd, nb, as, fs));
@@ -329,18 +329,18 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb,
int i;
amp = 1.f;
noise_vector(x, y, z, nb, v);
- if(hard) {
+ if (hard) {
v[0] = (float)fabs(v[0]);
v[1] = (float)fabs(v[1]);
v[2] = (float)fabs(v[2]);
}
- for(i = 1; i < oct; i++) {
+ for (i = 1; i < oct; i++) {
amp *= ampscale;
x *= freqscale;
y *= freqscale;
z *= freqscale;
noise_vector(x, y, z, nb, t);
- if(hard) {
+ if (hard) {
t[0] = (float)fabs(t[0]);
t[1] = (float)fabs(t[1]);
t[2] = (float)fabs(t[2]);
@@ -356,7 +356,7 @@ static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args)
float x, y, z, v[3];
int oct, hd, nb = 1;
float as = 0.5, fs = 2.0;
- if(!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence_vector", &x, &y, &z, &oct, &hd, &nb, &as, &fs))
+ if (!PyArg_ParseTuple(args, "(fff)ii|iff:turbulence_vector", &x, &y, &z, &oct, &hd, &nb, &as, &fs))
return NULL;
vTurb(x, y, z, oct, hd, nb, as, fs, v);
return Py_BuildValue("[fff]", v[0], v[1], v[2]);
@@ -370,7 +370,7 @@ static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct;
int nb = 1;
- if(!PyArg_ParseTuple(args, "(fff)fff|i:fractal", &x, &y, &z, &H, &lac, &oct, &nb))
+ if (!PyArg_ParseTuple(args, "(fff)fff|i:fractal", &x, &y, &z, &H, &lac, &oct, &nb))
return NULL;
return PyFloat_FromDouble(mg_fBm(x, y, z, H, lac, oct, nb));
}
@@ -381,7 +381,7 @@ static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct;
int nb = 1;
- if(!PyArg_ParseTuple(args, "(fff)fff|i:multi_fractal", &x, &y, &z, &H, &lac, &oct, &nb))
+ if (!PyArg_ParseTuple(args, "(fff)fff|i:multi_fractal", &x, &y, &z, &H, &lac, &oct, &nb))
return NULL;
return PyFloat_FromDouble(mg_MultiFractal(x, y, z, H, lac, oct, nb));
@@ -393,7 +393,7 @@ static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, d;
int nt1 = 1, nt2 = 1;
- if(!PyArg_ParseTuple(args, "(fff)f|ii:vl_vector", &x, &y, &z, &d, &nt1, &nt2))
+ if (!PyArg_ParseTuple(args, "(fff)f|ii:vl_vector", &x, &y, &z, &d, &nt1, &nt2))
return NULL;
return PyFloat_FromDouble(mg_VLNoise(x, y, z, d, nt1, nt2));
}
@@ -404,7 +404,7 @@ static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct, ofs;
int nb = 1;
- if(!PyArg_ParseTuple(args, "(fff)ffff|i:hetero_terrain", &x, &y, &z, &H, &lac, &oct, &ofs, &nb))
+ if (!PyArg_ParseTuple(args, "(fff)ffff|i:hetero_terrain", &x, &y, &z, &H, &lac, &oct, &ofs, &nb))
return NULL;
return PyFloat_FromDouble(mg_HeteroTerrain(x, y, z, H, lac, oct, ofs, nb));
@@ -416,7 +416,7 @@ static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *ar
{
float x, y, z, H, lac, oct, ofs, gn;
int nb = 1;
- if(!PyArg_ParseTuple(args, "(fff)fffff|i:hybrid_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb))
+ if (!PyArg_ParseTuple(args, "(fff)fffff|i:hybrid_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb))
return NULL;
return PyFloat_FromDouble(mg_HybridMultiFractal(x, y, z, H, lac, oct, ofs, gn, nb));
@@ -428,7 +428,7 @@ static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *ar
{
float x, y, z, H, lac, oct, ofs, gn;
int nb = 1;
- if(!PyArg_ParseTuple(args, "(fff)fffff|i:ridged_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb))
+ if (!PyArg_ParseTuple(args, "(fff)fffff|i:ridged_multi_fractal", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb))
return NULL;
return PyFloat_FromDouble(mg_RidgedMultiFractal(x, y, z, H, lac, oct, ofs, gn, nb));
}
@@ -440,7 +440,7 @@ static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
float x, y, z, da[4], pa[12];
int dtype = 0;
float me = 2.5; /* default minkovsky exponent */
- if(!PyArg_ParseTuple(args, "(fff)|if:voronoi", &x, &y, &z, &dtype, &me))
+ if (!PyArg_ParseTuple(args, "(fff)|if:voronoi", &x, &y, &z, &dtype, &me))
return NULL;
voronoi(x, y, z, da, pa, me, dtype);
return Py_BuildValue("[[ffff][[fff][fff][fff][fff]]]",
@@ -455,7 +455,7 @@ static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
- if(!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z))
+ if (!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z))
return NULL;
return PyFloat_FromDouble(cellNoise(x, y, z));
@@ -466,7 +466,7 @@ static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args)
static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, ca[3];
- if(!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z))
+ if (!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z))
return NULL;
cellNoiseV(x, y, z, ca);
return Py_BuildValue("[fff]", ca[0], ca[1], ca[2]);
@@ -698,7 +698,7 @@ PyObject *BPyInit_noise(void)
setRndSeed(0);
/* Constant noisetype dictionary */
- if(submodule) {
+ if (submodule) {
static PyStructSequence_Field noise_types_fields[] = {
{(char *)"BLENDER", NULL},
{(char *)"STDPERLIN", NULL},
@@ -747,7 +747,7 @@ PyObject *BPyInit_noise(void)
PyModule_AddObject(submodule, "types", noise_types);
}
- if(submodule) {
+ if (submodule) {
static PyStructSequence_Field distance_metrics_fields[] = {
{(char *)"DISTANCE", NULL},
{(char *)"DISTANCE_SQUARED", NULL},
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index bf14102bb0d..1bccc8a24c4 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -43,13 +43,13 @@ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObje
int value_len;
int i;
- if(!(value_fast=PySequence_Fast(value, error_prefix))) {
+ if (!(value_fast=PySequence_Fast(value, error_prefix))) {
return -1;
}
value_len= PySequence_Fast_GET_SIZE(value_fast);
- if(value_len != length) {
+ if (value_len != length) {
Py_DECREF(value);
PyErr_Format(PyExc_TypeError,
"%.200s: invalid sequence length. expected %d, got %d",
@@ -58,30 +58,30 @@ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObje
}
/* for each type */
- if(type == &PyFloat_Type) {
- if(is_double) {
+ if (type == &PyFloat_Type) {
+ if (is_double) {
double *array_double= array;
- for(i=0; i<length; i++) {
+ for (i=0; i<length; i++) {
array_double[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else {
float *array_float= array;
- for(i=0; i<length; i++) {
+ for (i=0; i<length; i++) {
array_float[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
}
- else if(type == &PyLong_Type) {
+ else if (type == &PyLong_Type) {
/* could use is_double for 'long int' but no use now */
int *array_int= array;
- for(i=0; i<length; i++) {
+ for (i=0; i<length; i++) {
array_int[i]= PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
- else if(type == &PyBool_Type) {
+ else if (type == &PyBool_Type) {
int *array_bool= array;
- for(i=0; i<length; i++) {
+ for (i=0; i<length; i++) {
array_bool[i]= (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
@@ -95,7 +95,7 @@ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObje
Py_DECREF(value_fast);
- if(PyErr_Occurred()) {
+ if (PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError,
"%s: one or more items could not be used as a %s",
error_prefix, type->tp_name);
@@ -119,7 +119,7 @@ void PyC_ObSpit(const char *name, PyObject *var)
fprintf(stderr, " ptr:%p", (void *)var);
fprintf(stderr, " type:");
- if(Py_TYPE(var))
+ if (Py_TYPE(var))
fprintf(stderr, "%s", Py_TYPE(var)->tp_name);
else
fprintf(stderr, "<NIL>");
@@ -134,7 +134,7 @@ void PyC_LineSpit(void)
int lineno;
/* Note, allow calling from outside python (RNA) */
- if(!PYC_INTERPRETER_ACTIVE) {
+ if (!PYC_INTERPRETER_ACTIVE) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
}
@@ -162,18 +162,18 @@ void PyC_FileAndNum(const char **filename, int *lineno)
}
/* when executing a module */
- if(filename && *filename == NULL) {
+ if (filename && *filename == NULL) {
/* try an alternative method to get the filename - module based
* references below are all borrowed (double checked) */
PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
- if(mod_name) {
+ if (mod_name) {
PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
- if(mod) {
+ if (mod) {
*filename= PyModule_GetFilename(mod);
}
/* unlikely, fallback */
- if(*filename == NULL) {
+ if (*filename == NULL) {
*filename= _PyUnicode_AsString(mod_name);
}
}
@@ -225,7 +225,7 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
va_end(args);
- if(PyErr_Occurred()) {
+ if (PyErr_Occurred()) {
PyObject *error_type, *error_value, *error_traceback;
PyErr_Fetch(&error_type, &error_value, &error_traceback);
PyErr_Format(exception_type_prefix,
@@ -259,7 +259,7 @@ PyObject *PyC_ExceptionBuffer(void)
PyObject *format_tb_func= NULL;
PyObject *ret= NULL;
- if(! (traceback_mod= PyImport_ImportModule("traceback")) ) {
+ if (! (traceback_mod= PyImport_ImportModule("traceback")) ) {
goto error_cleanup;
}
else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) {
@@ -268,7 +268,7 @@ PyObject *PyC_ExceptionBuffer(void)
ret= PyObject_CallObject(format_tb_func, NULL);
- if(ret == Py_None) {
+ if (ret == Py_None) {
Py_DECREF(ret);
ret= NULL;
}
@@ -303,7 +303,7 @@ PyObject *PyC_ExceptionBuffer(void)
* string_io = io.StringIO()
*/
- if(! (string_io_mod= PyImport_ImportModule("io")) ) {
+ if (! (string_io_mod= PyImport_ImportModule("io")) ) {
goto error_cleanup;
}
else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
@@ -360,7 +360,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
result= _PyUnicode_AsString(py_str);
- if(result) {
+ if (result) {
/* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */
return result;
@@ -368,7 +368,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
else {
PyErr_Clear();
- if(PyBytes_Check(py_str)) {
+ if (PyBytes_Check(py_str)) {
return PyBytes_AS_STRING(py_str);
}
else {
@@ -380,7 +380,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
PyObject *PyC_UnicodeFromByte(const char *str)
{
PyObject *result= PyUnicode_FromString(str);
- if(result) {
+ if (result) {
/* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */
return result;
@@ -412,7 +412,7 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
PyDict_SetItemString(interp->modules, "__main__", mod_main);
Py_DECREF(mod_main); /* sys.modules owns now */
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
- if(filename)
+ if (filename)
PyModule_AddStringConstant(mod_main, "__file__", filename); /* __file__ only for nice UI'ness */
PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
Py_INCREF(interp->builtins); /* AddObject steals a reference */
@@ -437,7 +437,7 @@ void PyC_MainModule_Restore(PyObject *main_mod)
/* must be called before Py_Initialize, expects output of BLI_get_folder(BLENDER_PYTHON, NULL) */
void PyC_SetHomePath(const char *py_path_bundle)
{
- if(py_path_bundle==NULL) {
+ if (py_path_bundle==NULL) {
/* Common enough to have bundled *nix python but complain on OSX/Win */
#if defined(__APPLE__) || defined(_WIN32)
fprintf(stderr, "Warning! bundled python not found and is expected on this platform. (if you built with CMake: 'install' target may have not been built)\n");
@@ -450,7 +450,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
#ifdef __APPLE__
/* OSX allow file/directory names to contain : character (represented as / in the Finder)
but current Python lib (release 3.1.1) doesn't handle these correctly */
- if(strchr(py_path_bundle, ':'))
+ if (strchr(py_path_bundle, ':'))
printf("Warning : Blender application is located in a path containing : or / chars\
\nThis may make python import function fail\n");
#endif
@@ -481,7 +481,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
{
FILE *fp= fopen(filepath, "r");
- if(fp) {
+ if (fp) {
PyGILState_STATE gilstate= PyGILState_Ensure();
va_list vargs;
@@ -508,13 +508,13 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
ret= PyObject_CallFunction(calcsize, (char *)"s", format);
- if(ret) {
+ if (ret) {
sizes[i]= PyLong_AsSsize_t(ret);
Py_DECREF(ret);
ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
}
- if(ret == NULL) {
+ if (ret == NULL) {
printf("PyC_InlineRun error, line:%d\n", __LINE__);
PyErr_Print();
PyErr_Clear();
@@ -525,7 +525,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
sizes[i]= 0;
}
else {
- if(PyTuple_GET_SIZE(ret) == 1) {
+ if (PyTuple_GET_SIZE(ret) == 1) {
/* convenience, convert single tuples into single values */
PyObject *tmp= PyTuple_GET_ITEM(ret, 0);
Py_INCREF(tmp);
@@ -545,13 +545,13 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
fclose(fp);
- if(py_result) {
+ if (py_result) {
/* we could skip this but then only slice assignment would work
* better not be so strict */
values= PyDict_GetItemString(py_dict, "values");
- if(values && PyList_Check(values)) {
+ if (values && PyList_Check(values)) {
/* dont use the result */
Py_DECREF(py_result);
@@ -567,10 +567,10 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
PyObject *item_new;
/* prepend the string formatting and remake the tuple */
item= PyList_GET_ITEM(values, i);
- if(PyTuple_CheckExact(item)) {
+ if (PyTuple_CheckExact(item)) {
int ofs= PyTuple_GET_SIZE(item);
item_new= PyTuple_New(ofs + 1);
- while(ofs--) {
+ while (ofs--) {
PyObject *member= PyTuple_GET_ITEM(item, ofs);
PyTuple_SET_ITEM(item_new, ofs + 1, member);
Py_INCREF(member);
@@ -584,7 +584,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
ret = PyObject_Call(pack, item_new, NULL);
- if(ret) {
+ if (ret) {
/* copy the bytes back into memory */
memcpy(ptr, PyBytes_AS_STRING(ret), sizes[i]);
Py_DECREF(ret);
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 3f637feadf7..f251e41a92d 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -109,7 +109,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
list= PyList_New(0);
- for(BLI_bpathIterator_init(&bpi, G.main, G.main->name, 0); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) {
+ for (BLI_bpathIterator_init(&bpi, G.main, G.main->name, 0); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) {
/* build the list */
if (absolute) {
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
@@ -149,10 +149,10 @@ 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;
@@ -193,9 +193,9 @@ 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;
@@ -215,7 +215,7 @@ static PyMethodDef meth_bpy_resource_path= {"resource_path", (PyCFunction)bpy_re
static PyObject *bpy_import_test(const char *modname)
{
PyObject *mod= PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0);
- if(mod) {
+ if (mod) {
Py_DECREF(mod);
}
else {
@@ -238,7 +238,7 @@ void BPy_init_modules(void)
/* Needs to be first since this dir is needed for future modules */
char *modpath= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules");
- if(modpath) {
+ if (modpath) {
// printf("bpy: found module path '%s'.\n", modpath);
PyObject *sys_path= PySys_GetObject("path"); /* borrow */
PyObject *py_modpath= PyUnicode_FromString(modpath);
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 079d5223f58..bd7be8dd9c5 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -168,13 +168,13 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUS
{
int param= PyObject_IsTrue(value);
- if(param < 0) {
+ if (param < 0) {
PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
return -1;
}
- if(param) G.f |= G_DEBUG;
- else G.f &= ~G_DEBUG;
+ if (param) G.f |= G_DEBUG;
+ else G.f &= ~G_DEBUG;
return 0;
}
@@ -230,7 +230,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));
}
}
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 6aaeb4d9807..1a50ae79dc7 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -40,7 +40,7 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
static PyTypeObject BlenderAppCbType;
static PyStructSequence_Field app_cb_info_fields[]= {
- {(char *)"frame_change_pre", NULL},
+ {(char *)"frame_change_pre", NULL},
{(char *)"frame_change_post", NULL},
{(char *)"render_pre", NULL},
{(char *)"render_post", NULL},
@@ -77,13 +77,13 @@ static PyObject *make_app_cb_info(void)
return NULL;
}
- for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
- if(app_cb_info_fields[pos].name == NULL) {
+ 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)));
}
- if(app_cb_info_fields[pos].name != NULL) {
+ if (app_cb_info_fields[pos].name != NULL) {
Py_FatalError("invalid callback slots 2");
}
@@ -103,12 +103,12 @@ PyObject *BPY_app_handlers_struct(void)
BlenderAppCbType.tp_new= NULL;
/* assign the C callbacks */
- if(ret) {
+ if (ret) {
static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}};
bCallbackFuncStore *funcstore;
int pos= 0;
- for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+ for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
funcstore= &funcstore_array[pos];
funcstore->func= bpy_app_generic_callback;
funcstore->alloc= 0;
@@ -124,7 +124,7 @@ void BPY_app_handlers_reset(void)
{
int pos= 0;
- for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+ for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL);
}
}
@@ -134,7 +134,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
{
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) {
+ 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
@@ -143,7 +143,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
Py_ssize_t pos;
/* setup arguments */
- if(id) {
+ if (id) {
PointerRNA id_ptr;
RNA_id_pointer_create(id, &id_ptr);
PyTuple_SET_ITEM(args, 0, pyrna_struct_CreatePyObject(&id_ptr));
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index f3ef55d29c4..c5d15145ab2 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -41,6 +41,9 @@
#include "bpy_driver.h"
+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;
@@ -96,7 +99,7 @@ void BPY_driver_reset(void)
PyGILState_STATE gilstate;
int use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
- if(use_gil)
+ if (use_gil)
gilstate= PyGILState_Ensure();
if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
@@ -105,7 +108,7 @@ void BPY_driver_reset(void)
bpy_pydriver_Dict= NULL;
}
- if(use_gil)
+ if (use_gil)
PyGILState_Release(gilstate);
return;
@@ -154,31 +157,35 @@ float BPY_driver_exec(ChannelDriver *driver)
if ((expr == NULL) || (expr[0]=='\0'))
return 0.0f;
- if(!(G.f & G_SCRIPT_AUTOEXEC)) {
+ if (!(G.f & G_SCRIPT_AUTOEXEC)) {
printf("skipping driver '%s', automatic scripts are disabled\n", driver->expression);
return 0.0f;
}
use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
- if(use_gil)
+ if (use_gil)
gilstate= PyGILState_Ensure();
+ /* needed since drivers are updated directly after undo where 'main' is
+ * re-allocated [#28807] */
+ BPY_update_rna_module();
+
/* init global dictionary for py-driver evaluation settings */
if (!bpy_pydriver_Dict) {
if (bpy_pydriver_create_dict() != 0) {
fprintf(stderr, "Pydriver error: couldn't create Python dictionary");
- if(use_gil)
+ if (use_gil)
PyGILState_Release(gilstate);
return 0.0f;
}
}
- 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) {
+ if (driver->flag & DRIVER_FLAG_RECOMPILE) {
Py_XDECREF(driver->expr_comp);
driver->expr_comp= PyTuple_New(2);
@@ -192,7 +199,7 @@ float BPY_driver_exec(ChannelDriver *driver)
expr_code= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 0);
}
- if(driver->flag & DRIVER_FLAG_RENAMEVAR) {
+ if (driver->flag & DRIVER_FLAG_RENAMEVAR) {
/* may not be set */
expr_vars= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
Py_XDECREF(expr_vars);
@@ -253,7 +260,7 @@ float BPY_driver_exec(ChannelDriver *driver)
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;
@@ -264,10 +271,10 @@ float BPY_driver_exec(ChannelDriver *driver)
Py_DECREF(retval);
}
- if(use_gil)
+ if (use_gil)
PyGILState_Release(gilstate);
- if(finite(result)) {
+ if (finite(result)) {
return (float)result;
}
else {
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 429a74fddc0..aaa813137c6 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -100,14 +100,14 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
{
py_call_level++;
- if(gilstate)
+ if (gilstate)
*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;
@@ -125,13 +125,13 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
{
py_call_level--;
- if(gilstate)
+ if (gilstate)
PyGILState_Release(*gilstate);
- if(py_call_level < 0) {
+ 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.
//BPy_SetContext(NULL);
//bpy_import_main_set(NULL);
@@ -146,7 +146,7 @@ void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
void BPY_text_free_code(Text *text)
{
- if(text->compiled) {
+ if (text->compiled) {
Py_DECREF((PyObject *)text->compiled);
text->compiled= NULL;
}
@@ -273,10 +273,10 @@ void BPY_python_end(void)
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)
+ if (bpy_timer>0.0)
printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer)*100.0);
printf("\n");
@@ -292,7 +292,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);
- if(lineno != -1) {
+ if (lineno != -1) {
/* select the line with the error */
txt_move_to(text, lineno - 1, INT_MAX, FALSE);
txt_move_to(text, lineno - 1, offset, TRUE);
@@ -332,22 +332,22 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
char fn_dummy[FILE_MAXDIR];
bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
- if(text->compiled == NULL) { /* if it wasn't already compiled, do it now */
+ if (text->compiled == NULL) { /* if it wasn't already compiled, do it now */
char *buf= txt_to_buf(text);
text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
MEM_freeN(buf);
- if(PyErr_Occurred()) {
- if(do_jump) {
+ if (PyErr_Occurred()) {
+ if (do_jump) {
python_script_error_jump_text(text);
}
BPY_text_free_code(text);
}
}
- if(text->compiled) {
+ if (text->compiled) {
py_dict= PyC_DefaultNameSpace(fn_dummy);
py_result= PyEval_EvalCode(text->compiled, py_dict, py_dict);
}
@@ -356,7 +356,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
else {
FILE *fp= fopen(fn, "r");
- if(fp) {
+ if (fp) {
py_dict= PyC_DefaultNameSpace(fn);
#ifdef _WIN32
@@ -390,8 +390,8 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
}
if (!py_result) {
- if(text) {
- if(do_jump) {
+ if (text) {
+ if (do_jump) {
python_script_error_jump_text(text);
}
}
@@ -401,7 +401,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st
Py_DECREF(py_result);
}
- if(py_dict) {
+ if (py_dict) {
#ifdef PYMODULE_CLEAR_WORKAROUND
PyModuleObject *mmod= (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
PyObject *dict_back= mmod->md_dict;
@@ -450,7 +450,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
if (!value || !expr) return -1;
- if(expr[0]=='\0') {
+ if (expr[0]=='\0') {
*value= 0.0;
return error_ret;
}
@@ -479,13 +479,13 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
else {
double val;
- if(PyTuple_Check(retval)) {
+ if (PyTuple_Check(retval)) {
/* Users my have typed in 10km, 2m
* add up all values */
int i;
val= 0.0;
- for(i=0; i<PyTuple_GET_SIZE(retval); i++) {
+ for (i=0; i<PyTuple_GET_SIZE(retval); i++) {
val+= PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i));
}
}
@@ -494,7 +494,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
}
Py_DECREF(retval);
- if(val==-1 && PyErr_Occurred()) {
+ if (val==-1 && PyErr_Occurred()) {
error_ret= -1;
}
else if (!finite(val)) {
@@ -505,8 +505,8 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
}
}
- if(error_ret) {
- if(verbose) {
+ if (error_ret) {
+ if (verbose) {
BPy_errors_to_report(CTX_wm_reports(C));
}
else {
@@ -531,7 +531,7 @@ int BPY_string_exec(bContext *C, const char *expr)
if (!expr) return -1;
- if(expr[0]=='\0') {
+ if (expr[0]=='\0') {
return error_ret;
}
@@ -572,20 +572,20 @@ void BPY_modules_load_user(bContext *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
* on file load */
- if(py_call_level) {
+ if (py_call_level) {
bpy_context_update(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")) {
- if(!(G.f & G_SCRIPT_AUTOEXEC)) {
+ 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);
}
else {
@@ -611,13 +611,13 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
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)) {
+ else if (BPy_StructRNA_Check(item)) {
ptr= &(((BPy_StructRNA *)item)->ptr);
//result->ptr= ((BPy_StructRNA *)item)->ptr;
@@ -633,10 +633,10 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
else {
int len= PySequence_Fast_GET_SIZE(seq_fast);
int i;
- for(i= 0; i < len; i++) {
+ for (i= 0; i < len; i++) {
PyObject *list_item= PySequence_Fast_GET_ITEM(seq_fast, i);
- if(BPy_StructRNA_Check(list_item)) {
+ if (BPy_StructRNA_Check(list_item)) {
/*
CollectionPointerLink *link= MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get");
link->ptr= ((BPy_StructRNA *)item)->ptr;
@@ -656,12 +656,12 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
}
}
- 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);
}
else {
- if(G.f & G_DEBUG) {
+ if (G.f & G_DEBUG) {
printf("PyContext '%s' found\n", member);
}
}
@@ -759,7 +759,7 @@ PyInit_bpy(void)
dealloc_obj_Type.tp_dealloc= dealloc_obj_dealloc;
dealloc_obj_Type.tp_flags= Py_TPFLAGS_DEFAULT;
- if(PyType_Ready(&dealloc_obj_Type) < 0)
+ if (PyType_Ready(&dealloc_obj_Type) < 0)
return NULL;
dob= (dealloc_obj *) dealloc_obj_Type.tp_alloc(&dealloc_obj_Type, 0);
diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c
index ac8c90198a0..9424bdab93f 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -68,7 +68,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
Py_DECREF(atexit_func);
Py_DECREF(args);
- if(ret) {
+ if (ret) {
Py_DECREF(ret);
}
else { /* should never happen */
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index 4ce3e0356e2..603bb0ed0ac 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -184,7 +184,7 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *
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))
+ 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);
@@ -210,10 +210,10 @@ static PyObject *_bpy_names(BPy_Library *self, int blocktype)
names= BLO_blendhandle_get_datablock_names(self->blo_handle, blocktype, &totnames);
- if(names) {
+ if (names) {
int counter= 0;
list= PyList_New(totnames);
- for(l= names; l; l= l->next) {
+ for (l= names; l; l= l->next) {
PyList_SET_ITEM(list, counter, PyUnicode_FromString((char *)l->link));
counter++;
}
@@ -237,8 +237,8 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
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) {
+ if (self->blo_handle == NULL) {
+ if (BPy_reports_to_error(&reports, PyExc_IOError, TRUE) != -1) {
PyErr_Format(PyExc_IOError,
"load: %s failed to open blend file",
self->abspath);
@@ -247,8 +247,8 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
}
else {
int i= 0, code;
- while((code= BKE_idcode_iter_step(&i))) {
- if(BKE_idcode_is_linkable(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);
PyDict_SetItem(self->dict, str, PyList_New(0));
@@ -322,27 +322,27 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
{
int i= 0, code;
- while((code= BKE_idcode_iter_step(&i))) {
- if(BKE_idcode_is_linkable(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);
// printf("lib: %s\n", name_plural);
- if(ls && PyList_Check(ls)) {
+ if (ls && PyList_Check(ls)) {
/* loop */
Py_ssize_t size= PyList_GET_SIZE(ls);
Py_ssize_t i;
PyObject *item;
const char *item_str;
- for(i= 0; i < size; i++) {
+ 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) {
+ if (item_str) {
ID *id= BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code);
- if(id) {
+ if (id) {
#ifdef USE_RNA_DATABLOCKS
PointerRNA id_ptr;
RNA_id_pointer_create(id, &id_ptr);
@@ -382,7 +382,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
}
}
- if(err == -1) {
+ if (err == -1) {
/* exception raised above, XXX, this leaks some memory */
BLO_blendhandle_close(self->blo_handle);
self->blo_handle= NULL;
@@ -399,10 +399,10 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
recalc_all_library_objects(G.main);
/* append, rather than linking */
- if((self->flag & FILE_LINK)==0) {
+ if ((self->flag & FILE_LINK)==0) {
Library *lib= BLI_findstring(&G.main->library, self->abspath, offsetof(Library, name));
- if(lib) all_local(lib, 1);
- else BLI_assert(!"cant find name of just added library!");
+ if (lib) all_local(lib, 1);
+ else BLI_assert(!"cant find name of just added library!");
}
}
@@ -426,7 +426,7 @@ int bpy_lib_init(PyObject *mod_par)
/* some compilers dont like accessing this directly, delay assignment */
bpy_lib_Type.tp_getattro= PyObject_GenericGetAttr;
- if(PyType_Ready(&bpy_lib_Type) < 0)
+ if (PyType_Ready(&bpy_lib_Type) < 0)
return -1;
return 0;
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 7327679cc7e..b5fd7851458 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -76,7 +76,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
// 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();
- if(C==NULL) {
+ if (C==NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL;
}
@@ -93,8 +93,8 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- if(context_str) {
- if(RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) {
+ 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);
PyErr_Format(PyExc_TypeError,
"Calling operator \"bpy.ops.%s.poll\" error, "
@@ -105,7 +105,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
}
}
- if(context_dict==NULL || context_dict==Py_None) {
+ if (context_dict==NULL || context_dict==Py_None) {
context_dict= NULL;
}
else if (!PyDict_Check(context_dict)) {
@@ -150,7 +150,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
// 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();
- if(C==NULL) {
+ if (C==NULL) {
PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
return NULL;
}
@@ -167,7 +167,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- if(!pyrna_write_check()) {
+ if (!pyrna_write_check()) {
PyErr_Format(PyExc_RuntimeError,
"Calling operator \"bpy.ops.%s\" error, "
"can't modify blend data in this state (drawing/rendering)",
@@ -175,8 +175,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- if(context_str) {
- if(RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) {
+ 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);
PyErr_Format(PyExc_TypeError,
"Calling operator \"bpy.ops.%s\" error, "
@@ -187,7 +187,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
}
}
- if(context_dict==NULL || context_dict==Py_None) {
+ if (context_dict==NULL || context_dict==Py_None) {
context_dict= NULL;
}
else if (!PyDict_Check(context_dict)) {
@@ -203,7 +203,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
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) {
+ 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",
@@ -215,7 +215,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
WM_operator_properties_create_ptr(&ptr, ot);
WM_operator_properties_sanitize(&ptr, 0);
- if(kw && PyDict_Size(kw))
+ if (kw && PyDict_Size(kw))
error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
@@ -245,10 +245,10 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
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) {
+ if (reports->list.first) {
char *report_str= BKE_reports_string(reports, 0); /* all reports */
- if(report_str) {
+ if (report_str) {
PySys_WriteStdout("%s\n", report_str);
MEM_freeN(report_str);
}
@@ -315,7 +315,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
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;
}
@@ -336,7 +336,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
/* Save another lookup */
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
- if(kw && PyDict_Size(kw))
+ if (kw && PyDict_Size(kw))
error_val= pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
if (error_val==0)
@@ -348,7 +348,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- if(buf) {
+ if (buf) {
pybuf= PyUnicode_FromString(buf);
MEM_freeN(buf);
}
@@ -364,7 +364,7 @@ static PyObject *pyop_dir(PyObject *UNUSED(self))
GHashIterator *iter= WM_operatortype_iter();
PyObject *list= PyList_New(0), *name;
- for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
name= PyUnicode_FromString(ot->idname);
@@ -383,12 +383,12 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
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) {
+ if (ot==NULL) {
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
return NULL;
}
@@ -408,12 +408,51 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
return (PyObject *)pyrna;
}
+static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
+{
+ wmOperatorType *ot;
+ wmOperator *op;
+ PointerRNA ptr;
+ char *opname= _PyUnicode_AsString(value);
+ BPy_StructRNA *pyrna= 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) {
+ PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname);
+ return NULL;
+ }
+
+#ifdef PYRNA_FREE_SUPPORT
+ op= MEM_callocN(sizeof(wmOperator), __func__);
+#else
+ 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;
+
+ RNA_pointer_create(NULL, &RNA_Operator, op, &ptr);
+
+ pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
+#ifdef PYRNA_FREE_SUPPORT
+ pyrna->freeptr= TRUE;
+#endif
+ op->ptr= &pyrna->ptr;
+
+ return (PyObject *)pyrna;
+}
+
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},
{"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL},
- {"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL},
+ {"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL}, /* only for introspection, leaks memory */
+ {"get_instance", (PyCFunction) pyop_getinstance, METH_O, NULL}, /* only for introspection, leaks memory */
{"macro_define", (PyCFunction) PYOP_wrap_macro_define, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index de29cb2aeac..1b158f9bade 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -50,7 +50,7 @@ static void operator_properties_init(wmOperatorType *ot)
* later */
RNA_def_struct_identifier(ot->srna, ot->idname);
- if(pyrna_deferred_register_class(ot->srna, py_class) != 0) {
+ if (pyrna_deferred_register_class(ot->srna, py_class) != 0) {
PyErr_Print(); /* failed to register operator props */
PyErr_Clear();
}
@@ -72,8 +72,9 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
prop= RNA_struct_find_property(&ptr, "type");
- if(prop)
+ if (prop) {
ot->prop= prop;
+ }
}
}
@@ -125,7 +126,7 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
otmacro= WM_operatortype_macro_define(ot, opname);
- RNA_pointer_create(NULL, &RNA_OperatorTypeMacro, otmacro, &ptr_otmacro);
+ RNA_pointer_create(NULL, &RNA_OperatorMacro, otmacro, &ptr_otmacro);
return pyrna_struct_CreatePyObject(&ptr_otmacro);
}
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 88383ce84d5..d3963458298 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[]= {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
- {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
+ {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem property_flag_enum_items[]= {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
- {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
+ {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
{PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
{0, NULL, 0, NULL, NULL}};
@@ -72,7 +72,7 @@ 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", ""},
- {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
+ {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};
@@ -123,11 +123,11 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
PyObject *self= NULL;
/* first get self */
/* operators can store their own instance for later use */
- if(ptr->data) {
+ if (ptr->data) {
void **instance= RNA_struct_instance(ptr);
- if(instance) {
- if(*instance) {
+ if (instance) {
+ if (*instance) {
self= *instance;
Py_INCREF(self);
}
@@ -135,7 +135,7 @@ static PyObject *pyrna_struct_as_instance(PointerRNA *ptr)
}
/* in most cases this will run */
- if(self == NULL) {
+ if (self == NULL) {
self= pyrna_struct_CreatePyObject(ptr);
}
@@ -167,7 +167,7 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw)
PyTuple_SET_ITEM(ret, 0, func);
Py_INCREF(func);
- if(kw==NULL)
+ if (kw==NULL)
kw= PyDict_New();
else
Py_INCREF(kw);
@@ -190,7 +190,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
BLI_assert(py_data != NULL);
- if(!is_write_ok) {
+ if (!is_write_ok) {
pyrna_write_set(TRUE);
}
@@ -209,11 +209,11 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
Py_DECREF(args);
- if(ret == NULL) {
+ if (ret == NULL) {
printf_func_error(py_func);
}
else {
- if(ret != Py_None) {
+ if (ret != Py_None) {
PyErr_SetString(PyExc_ValueError, "the return value must be None");
printf_func_error(py_func);
}
@@ -223,15 +223,15 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
bpy_context_clear(C, &gilstate);
- if(!is_write_ok) {
+ if (!is_write_ok) {
pyrna_write_set(FALSE);
}
}
static int bpy_prop_callback_check(PyObject *py_func, int argcount)
{
- if(py_func) {
- if(!PyFunction_Check(py_func)) {
+ if (py_func) {
+ if (!PyFunction_Check(py_func)) {
PyErr_Format(PyExc_TypeError,
"update keyword: expected a function type, not a %.200s",
Py_TYPE(py_func)->tp_name);
@@ -255,7 +255,7 @@ static int bpy_prop_callback_check(PyObject *py_func, int argcount)
static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_cb)
{
/* assume this is already checked for type and arg length */
- if(update_cb) {
+ if (update_cb) {
PyObject **py_data= MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, "bpy_prop_callback_assign");
RNA_def_property_update_runtime(prop, (void *)bpy_prop_update_cb);
py_data[BPY_DATA_CB_SLOT_UPDATE]= update_cb;
@@ -270,7 +270,7 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c
/* utility function we need for parsing int's in an if statement */
static int py_long_as_int(PyObject *py_long, int *r_int)
{
- if(PyLong_CheckExact(py_long)) {
+ if (PyLong_CheckExact(py_long)) {
*r_int= (int)PyLong_AS_LONG(py_long);
return 0;
}
@@ -295,8 +295,8 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
return NULL; \
} \
srna= srna_from_self(self, #_func"(...):"); \
- if(srna==NULL) { \
- if(PyErr_Occurred()) \
+ if (srna==NULL) { \
+ if (PyErr_Occurred()) \
return NULL; \
return bpy_prop_deferred_return((void *)pymeth_##_func, kw); \
} \
@@ -304,24 +304,24 @@ static int py_long_as_int(PyObject *py_long, int *r_int)
/* terse macros for error checks shared between all funcs cant use function
* calls because of static strins passed to pyrna_set_to_enum_bitfield */
#define BPY_PROPDEF_CHECK(_func, _property_flag_items) \
- if(id_len >= MAX_IDPROP_NAME) { \
+ if (id_len >= MAX_IDPROP_NAME) { \
PyErr_Format(PyExc_TypeError, \
#_func"(): '%.200s' too long, max length is %d", \
id, MAX_IDPROP_NAME-1); \
return NULL; \
} \
- if(RNA_def_property_free_identifier(srna, id) == -1) { \
+ if (RNA_def_property_free_identifier(srna, id) == -1) { \
PyErr_Format(PyExc_TypeError, \
#_func"(): '%s' is defined as a non-dynamic type", \
id); \
return NULL; \
} \
- if(pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, pyopts, &opts, #_func"(options={...}):")) \
+ if (pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, pyopts, &opts, #_func"(options={...}):")) \
return NULL; \
#define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype) \
BPY_PROPDEF_CHECK(_func, _property_flag_items) \
- if(pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \
+ if (pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \
PyErr_Format(PyExc_TypeError, \
#_func"(subtype='%s'): invalid subtype", \
pysubtype); \
@@ -380,7 +380,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(BoolProperty)
- if(srna) {
+ if (srna) {
static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "update", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
@@ -412,9 +412,9 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -446,7 +446,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(BoolVectorProperty)
- if(srna) {
+ if (srna) {
static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "size", "update", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
@@ -472,12 +472,12 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_SUBTYPE_CHECK(BoolVectorProperty, property_flag_items, property_subtype_array_items)
- if(size < 1 || size > PYRNA_STACK_ARRAY) {
+ if (size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "BoolVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size);
return NULL;
}
- if(pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, FALSE, "BoolVectorProperty(default=sequence)") < 0)
+ if (pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, FALSE, "BoolVectorProperty(default=sequence)") < 0)
return NULL;
if (bpy_prop_callback_check(update_cb, 2) == -1) {
@@ -487,12 +487,12 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
// 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);
+ 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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -520,7 +520,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(IntProperty)
- if(srna) {
+ if (srna) {
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="";
int id_len;
@@ -555,9 +555,9 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_ui_text(prop, name, description);
RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
- 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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -588,7 +588,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(IntVectorProperty)
- if(srna) {
+ if (srna) {
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="";
int id_len;
@@ -616,12 +616,12 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_SUBTYPE_CHECK(IntVectorProperty, property_flag_items, property_subtype_array_items)
- if(size < 1 || size > PYRNA_STACK_ARRAY) {
+ if (size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "IntVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size);
return NULL;
}
- if(pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, FALSE, "IntVectorProperty(default=sequence)") < 0)
+ if (pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, FALSE, "IntVectorProperty(default=sequence)") < 0)
return NULL;
if (bpy_prop_callback_check(update_cb, 2) == -1) {
@@ -630,14 +630,14 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
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);
+ if (pydef) RNA_def_property_int_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
- 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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -666,7 +666,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(FloatProperty)
- if(srna) {
+ if (srna) {
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="";
int id_len;
@@ -695,7 +695,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;
}
@@ -710,9 +710,9 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_ui_text(prop, name, description);
RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
- 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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -744,7 +744,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
BPY_PROPDEF_HEAD(FloatVectorProperty)
- if(srna) {
+ if (srna) {
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="";
int id_len;
@@ -774,17 +774,17 @@ 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;
}
- if(size < 1 || size > PYRNA_STACK_ARRAY) {
+ if (size < 1 || size > PYRNA_STACK_ARRAY) {
PyErr_Format(PyExc_TypeError, "FloatVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size);
return NULL;
}
- if(pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, FALSE, "FloatVectorProperty(default=sequence)") < 0)
+ if (pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, FALSE, "FloatVectorProperty(default=sequence)") < 0)
return NULL;
if (bpy_prop_callback_check(update_cb, 2) == -1) {
@@ -793,14 +793,14 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
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);
+ if (pydef) RNA_def_property_float_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
- 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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -827,7 +827,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
BPY_PROPDEF_HEAD(StringProperty)
- if(srna) {
+ if (srna) {
static const char *kwlist[]= {"attr", "name", "description", "default", "maxlen", "options", "subtype", "update", NULL};
const char *id=NULL, *name="", *description="", *def="";
int id_len;
@@ -856,13 +856,13 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
}
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);
+ 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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -878,7 +878,7 @@ static size_t strswapbufcpy(char *buf, const char **orig)
char *dst= buf;
size_t i= 0;
*orig= buf;
- while((*dst= *src)) { dst++; src++; i++; }
+ while ((*dst= *src)) { dst++; src++; i++; }
return i + 1; /* include '\0' */
}
#endif
@@ -893,12 +893,12 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
short def_used= 0;
const char *def_cmp= NULL;
- if(is_enum_flag) {
- if(seq_len > RNA_ENUM_BITFLAG_SIZE) {
+ if (is_enum_flag) {
+ if (seq_len > RNA_ENUM_BITFLAG_SIZE) {
PyErr_SetString(PyExc_TypeError, "EnumProperty(...): maximum " STRINGIFY(RNA_ENUM_BITFLAG_SIZE) " members for a ENUM_FLAG type property");
return NULL;
}
- if(def && !PySet_Check(def)) {
+ if (def && !PySet_Check(def)) {
PyErr_Format(PyExc_TypeError,
"EnumProperty(...): default option must be a 'set' "
"type when ENUM_FLAG is enabled, not a '%.200s'",
@@ -907,9 +907,9 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
}
}
else {
- if(def) {
+ if (def) {
def_cmp= _PyUnicode_AsString(def);
- if(def_cmp==NULL) {
+ if (def_cmp==NULL) {
PyErr_Format(PyExc_TypeError,
"EnumProperty(...): default option must be a 'str' "
"type when ENUM_FLAG is disabled, not a '%.200s'",
@@ -924,7 +924,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "enum_items_from_py1");
- for(i=0; i<seq_len; i++) {
+ for (i=0; i<seq_len; i++) {
EnumPropertyItem tmp= {0, "", 0, "", ""};
Py_ssize_t item_size;
Py_ssize_t id_str_size;
@@ -933,7 +933,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
item= PySequence_Fast_GET_ITEM(seq_fast, i);
- if( (PyTuple_CheckExact(item)) &&
+ 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)) &&
@@ -941,22 +941,22 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
(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) {
+ if (is_enum_flag) {
+ if (item_size < 4) {
tmp.value= 1<<i;
}
- if(def && PySet_Contains(def, PyTuple_GET_ITEM(item, 0))) {
+ if (def && PySet_Contains(def, PyTuple_GET_ITEM(item, 0))) {
*defvalue |= tmp.value;
def_used++;
}
}
else {
- if(item_size < 4) {
+ if (item_size < 4) {
tmp.value= i;
}
- if(def && def_used == 0 && strcmp(def_cmp, tmp.identifier)==0) {
+ if (def && def_used == 0 && strcmp(def_cmp, tmp.identifier)==0) {
*defvalue= tmp.value;
def_used++; /* only ever 1 */
}
@@ -978,9 +978,9 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
}
- if(is_enum_flag) {
+ if (is_enum_flag) {
/* strict check that all set members were used */
- if(def && def_used != PySet_GET_SIZE(def)) {
+ if (def && def_used != PySet_GET_SIZE(def)) {
MEM_freeN(items);
PyErr_Format(PyExc_TypeError,
@@ -990,7 +990,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
}
}
else {
- if(def && def_used == 0) {
+ if (def && def_used == 0) {
MEM_freeN(items);
PyErr_Format(PyExc_TypeError,
@@ -1012,7 +1012,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
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);
@@ -1052,14 +1052,14 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
Py_DECREF(args);
- if(items==NULL) {
+ if (items==NULL) {
err= -1;
}
else {
PyObject *items_fast;
int defvalue_dummy=0;
- if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): return value from the callback was not a sequence"))) {
+ if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): return value from the callback was not a sequence"))) {
err= -1;
}
else {
@@ -1067,7 +1067,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
Py_DECREF(items_fast);
- if(!eitems) {
+ if (!eitems) {
err= -1;
}
}
@@ -1075,7 +1075,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
Py_DECREF(items);
}
- if(err != -1) { /* worked */
+ if (err != -1) { /* worked */
*free= 1;
}
else {
@@ -1118,7 +1118,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_HEAD(EnumProperty)
- if(srna) {
+ if (srna) {
static const char *kwlist[]= {"attr", "items", "name", "description", "default", "options", "update", NULL};
const char *id=NULL, *name="", *description="";
PyObject *def= NULL;
@@ -1149,16 +1149,16 @@ 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 */
+ if (PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */
PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(items);
- if(f_code->co_argcount != 2) {
+ if (f_code->co_argcount != 2) {
PyErr_Format(PyExc_ValueError,
"EnumProperty(...): expected 'items' function to take 2 arguments, not %d",
f_code->co_argcount);
return NULL;
}
- if(def) {
+ if (def) {
/* note, using type error here is odd but python does this for invalid arguments */
PyErr_SetString(PyExc_TypeError,
"EnumProperty(...): 'default' can't be set when 'items' is a function");
@@ -1169,7 +1169,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
eitems= DummyRNA_NULL_items;
}
else {
- if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): expected a sequence of tuples for the enum items or a function"))) {
+ if (!(items_fast= PySequence_Fast(items, "EnumProperty(...): expected a sequence of tuples for the enum items or a function"))) {
return NULL;
}
@@ -1177,28 +1177,28 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
Py_DECREF(items_fast);
- if(!eitems) {
+ if (!eitems) {
return NULL;
}
}
- 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) {
+ if (is_itemf) {
RNA_def_enum_funcs(prop, bpy_props_enum_itemf);
RNA_def_enum_py_data(prop, (void *)items);
/* Py_INCREF(items); */ /* watch out!, if user is tricky they can probably crash blender if they manage to free the callback, take care! */
}
- 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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
- if(is_itemf == FALSE) {
+ if (is_itemf == FALSE) {
MEM_freeN(eitems);
}
}
@@ -1210,8 +1210,8 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
StructRNA *srna;
srna= srna_from_self(value, "");
- if(!srna) {
- if(PyErr_Occurred()) {
+ if (!srna) {
+ if (PyErr_Occurred()) {
PyObject *msg= PyC_ExceptionBuffer();
char *msg_char= _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError,
@@ -1227,7 +1227,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
return NULL;
}
- if(!RNA_struct_is_a(srna, &RNA_PropertyGroup)) {
+ if (!RNA_struct_is_a(srna, &RNA_PropertyGroup)) {
PyErr_Format(PyExc_TypeError,
"%.200s expected an RNA type derived from PropertyGroup",
error_prefix);
@@ -1256,7 +1256,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
BPY_PROPDEF_HEAD(PointerProperty)
- if(srna) {
+ if (srna) {
static const char *kwlist[]= {"attr", "type", "name", "description", "options", "update", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
@@ -1280,7 +1280,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(...):");
- if(!ptype)
+ if (!ptype)
return NULL;
if (bpy_prop_callback_check(update_cb, 2) == -1) {
@@ -1288,9 +1288,9 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
}
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 (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);
}
bpy_prop_callback_assign(prop, update_cb);
RNA_def_property_duplicate_pointers(srna, prop);
@@ -1316,7 +1316,7 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_HEAD(CollectionProperty)
- if(srna) {
+ if (srna) {
static const char *kwlist[]= {"attr", "type", "name", "description", "options", NULL};
const char *id=NULL, *name="", *description="";
int id_len;
@@ -1338,13 +1338,13 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
BPY_PROPDEF_CHECK(CollectionProperty, property_flag_items)
ptype= pointer_type_from_py(type, "CollectionProperty(...):");
- if(!ptype)
+ if (!ptype)
return NULL;
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 (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);
}
RNA_def_property_duplicate_pointers(srna, prop);
}
@@ -1363,7 +1363,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
{
StructRNA *srna;
- if(PyTuple_GET_SIZE(args) == 1) {
+ if (PyTuple_GET_SIZE(args) == 1) {
PyObject *ret;
self= PyTuple_GET_ITEM(args, 0);
args= PyTuple_New(0);
@@ -1377,10 +1377,10 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
}
srna= srna_from_self(self, "RemoveProperty(...):");
- if(srna==NULL && PyErr_Occurred()) {
+ 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;
}
@@ -1396,7 +1396,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
return NULL;
}
- if(RNA_def_property_free_identifier(srna, id) != 1) {
+ if (RNA_def_property_free_identifier(srna, id) != 1) {
PyErr_Format(PyExc_TypeError, "RemoveProperty(): '%s' not a defined dynamic property", id);
return NULL;
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index d5a950fc5bb..76dcf9729ca 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -84,10 +84,18 @@
static PyObject* pyrna_struct_Subtype(PointerRNA *ptr);
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self);
+#define BPY_DOC_ID_PROP_TYPE_NOTE \
+" .. note::\n" \
+"\n" \
+" Only :class:`bpy.types.ID`, :class:`bpy.types.Bone` and \n" \
+" :class:`bpy.types.PoseBone` classes support custom properties.\n"
+
+
int pyrna_struct_validity_check(BPy_StructRNA *pysrna)
{
- if(pysrna->ptr.type)
+ if (pysrna->ptr.type) {
return 0;
+ }
PyErr_Format(PyExc_ReferenceError,
"StructRNA of type %.200s has been removed",
Py_TYPE(pysrna)->tp_name);
@@ -96,8 +104,9 @@ int pyrna_struct_validity_check(BPy_StructRNA *pysrna)
int pyrna_prop_validity_check(BPy_PropertyRNA *self)
{
- if(self->ptr.type)
+ if (self->ptr.type) {
return 0;
+ }
PyErr_Format(PyExc_ReferenceError,
"PropertyRNA of type %.200s.%.200s has been removed",
Py_TYPE(self)->tp_name, RNA_property_identifier(self->prop));
@@ -126,15 +135,15 @@ static void id_release_gc(struct ID *id)
{
unsigned int j;
// unsigned int i= 0;
- for(j=0; j<3; j++) {
+ 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);
- if(PyType_IsSubtype(Py_TYPE(ob), &pyrna_struct_Type) || PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type)) {
+ if (PyType_IsSubtype(Py_TYPE(ob), &pyrna_struct_Type) || PyType_IsSubtype(Py_TYPE(ob), &pyrna_prop_Type)) {
BPy_DummyPointerRNA *ob_ptr= (BPy_DummyPointerRNA *)ob;
- if(ob_ptr->ptr.id.data == id) {
+ 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);
// i++;
@@ -158,7 +167,7 @@ static GHash *id_weakref_pool_get(ID *id)
{
GHash *weakinfo_hash= NULL;
- if(id_weakref_pool) {
+ if (id_weakref_pool) {
weakinfo_hash= BLI_ghash_lookup(id_weakref_pool, (void *)id);
}
else {
@@ -167,7 +176,7 @@ static GHash *id_weakref_pool_get(ID *id)
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");
BLI_ghash_insert(id_weakref_pool, (void *)id, weakinfo_hash);
@@ -215,7 +224,7 @@ static PyObject *id_free_weakref_cb(PyObject *weakinfo_capsule, PyObject *weakre
GHash *weakinfo_hash= PyCapsule_GetPointer(weakinfo_capsule, NULL);
- if(BLI_ghash_size(weakinfo_hash) > 1) {
+ if (BLI_ghash_size(weakinfo_hash) > 1) {
BLI_ghash_remove(weakinfo_hash, weakref, NULL, NULL);
}
else { /* get the last id and free it */
@@ -241,7 +250,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
while (!BLI_ghashIterator_isDone(&weakinfo_hash_iter)) {
PyObject *weakref= (PyObject *)BLI_ghashIterator_getKey(&weakinfo_hash_iter);
PyObject *item= PyWeakref_GET_OBJECT(weakref);
- if(item != Py_None) {
+ if (item != Py_None) {
#ifdef DEBUG_RNA_WEAKREF
PyC_ObSpit("id_release_weakref item ", item);
@@ -258,7 +267,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
BLI_ghash_remove(id_weakref_pool, (void *)id, NULL, NULL);
BLI_ghash_free(weakinfo_hash, NULL, NULL);
- if(BLI_ghash_size(id_weakref_pool) == 0) {
+ if (BLI_ghash_size(id_weakref_pool) == 0) {
BLI_ghash_free(id_weakref_pool, NULL, NULL);
id_weakref_pool= NULL;
#ifdef DEBUG_RNA_WEAKREF
@@ -270,7 +279,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);
- if(weakinfo_hash) {
+ if (weakinfo_hash) {
id_release_weakref_list(id, weakinfo_hash);
}
}
@@ -284,7 +293,7 @@ void BPY_id_release(struct ID *id)
#endif
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
- if(id_weakref_pool) {
+ if (id_weakref_pool) {
PyGILState_STATE gilstate= PyGILState_Ensure();
id_release_weakref(id);
@@ -302,13 +311,13 @@ static short rna_disallow_writes= FALSE;
static int rna_id_write_error(PointerRNA *ptr, PyObject *key)
{
ID *id= ptr->id.data;
- if(id) {
+ if (id) {
const short idcode= GS(id->name);
- if(!ELEM(idcode, ID_WM, ID_SCR)) { /* may need more added here */
+ if (!ELEM(idcode, ID_WM, ID_SCR)) { /* may need more added here */
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);
@@ -370,7 +379,7 @@ static int mathutils_rna_generic_check(BaseMathObject *bmo)
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
- PYRNA_PROP_CHECK_INT(self)
+ PYRNA_PROP_CHECK_INT(self);
return self->prop ? 0 : -1;
}
@@ -379,15 +388,15 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
- PYRNA_PROP_CHECK_INT(self)
+ 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) {
+ 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);
@@ -401,13 +410,13 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
float min, max;
- PYRNA_PROP_CHECK_INT(self)
+ PYRNA_PROP_CHECK_INT(self);
- if(self->prop==NULL)
+ if (self->prop==NULL)
return -1;
#ifdef USE_PEDANTIC_WRITE
- if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
return -1;
}
#endif // USE_PEDANTIC_WRITE
@@ -421,26 +430,26 @@ 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) {
+ if (min != FLT_MIN || max != FLT_MAX) {
int i, len= RNA_property_array_length(&self->ptr, self->prop);
- for(i=0; i<len; i++) {
+ for (i=0; i<len; i++) {
CLAMP(bmo->data[i], min, max);
}
}
RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
- if(RNA_property_update_check(self->prop)) {
+ if (RNA_property_update_check(self->prop)) {
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
}
/* Euler order exception */
- if(subtype==MATHUTILS_CB_SUBTYPE_EUL) {
+ 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) {
+ if (order != eul->order) {
RNA_property_enum_set(&self->ptr, prop_eul_order, eul->order);
- if(RNA_property_update_check(prop_eul_order)) {
+ if (RNA_property_update_check(prop_eul_order)) {
RNA_property_update(BPy_GetContext(), &self->ptr, prop_eul_order);
}
}
@@ -452,9 +461,9 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtyp
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
- PYRNA_PROP_CHECK_INT(self)
+ 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);
@@ -465,13 +474,13 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
- PYRNA_PROP_CHECK_INT(self)
+ PYRNA_PROP_CHECK_INT(self);
- if(self->prop==NULL)
+ if (self->prop==NULL)
return -1;
#ifdef USE_PEDANTIC_WRITE
- if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
return -1;
}
#endif // USE_PEDANTIC_WRITE
@@ -486,7 +495,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
RNA_property_float_clamp(&self->ptr, self->prop, &bmo->data[index]);
RNA_property_float_set_index(&self->ptr, self->prop, index, bmo->data[index]);
- if(RNA_property_update_check(self->prop)) {
+ if (RNA_property_update_check(self->prop)) {
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
}
@@ -509,9 +518,9 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
- PYRNA_PROP_CHECK_INT(self)
+ 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);
@@ -522,13 +531,13 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
- PYRNA_PROP_CHECK_INT(self)
+ PYRNA_PROP_CHECK_INT(self);
- if(self->prop==NULL)
+ if (self->prop==NULL)
return -1;
#ifdef USE_PEDANTIC_WRITE
- if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) {
return -1;
}
#endif // USE_PEDANTIC_WRITE
@@ -543,7 +552,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
/* can ignore clamping here */
RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
- if(RNA_property_update_check(self->prop)) {
+ if (RNA_property_update_check(self->prop)) {
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
}
return 0;
@@ -560,10 +569,10 @@ 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)
+ if (*prop_eul_order==NULL)
*prop_eul_order= RNA_struct_find_property(ptr, "rotation_mode");
- if(*prop_eul_order) {
+ if (*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;
@@ -599,13 +608,13 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
is_thick= (flag & PROP_THICK_WRAP);
if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) {
- if(!is_thick)
+ if (!is_thick)
ret= pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
switch(RNA_property_subtype(prop)) {
case PROP_ALL_VECTOR_SUBTYPES:
- if(len>=2 && len <= 4) {
- if(is_thick) {
+ if (len>=2 && len <= 4) {
+ if (is_thick) {
ret= newVectorObject(NULL, len, Py_NEW, NULL);
RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec);
}
@@ -617,8 +626,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
}
break;
case PROP_MATRIX:
- if(len==16) {
- if(is_thick) {
+ if (len==16) {
+ if (is_thick) {
ret= newMatrixObject(NULL, 4, 4, Py_NEW, NULL);
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr);
}
@@ -629,7 +638,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
}
}
else if (len==9) {
- if(is_thick) {
+ if (is_thick) {
ret= newMatrixObject(NULL, 3, 3, Py_NEW, NULL);
RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->contigPtr);
}
@@ -642,8 +651,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
break;
case PROP_EULER:
case PROP_QUATERNION:
- if(len==3) { /* euler */
- if(is_thick) {
+ 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);
@@ -659,7 +668,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
}
}
else if (len==4) {
- if(is_thick) {
+ if (is_thick) {
ret= newQuaternionObject(NULL, Py_NEW, NULL);
RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat);
}
@@ -672,8 +681,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
break;
case PROP_COLOR:
case PROP_COLOR_GAMMA:
- if(len==3) { /* color */
- if(is_thick) {
+ if (len==3) { /* color */
+ if (is_thick) {
ret= newColorObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col);
}
@@ -688,8 +697,8 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
}
}
- if(ret==NULL) {
- if(is_thick) {
+ 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);
@@ -709,7 +718,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
/* same as RNA_enum_value_from_id but raises an exception */
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) {
+ if (RNA_enum_value_from_id(item, identifier, value) == 0) {
const char *enum_str= BPy_enum_as_string(item);
PyErr_Format(PyExc_TypeError,
"%s: '%.200s' not found in (%s)",
@@ -795,14 +804,14 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
PyObject *ret;
const char *name;
- if(!PYRNA_STRUCT_IS_VALID(self)) {
+ if (!PYRNA_STRUCT_IS_VALID(self)) {
return PyUnicode_FromFormat("<bpy_struct, %.200s dead>",
Py_TYPE(self)->tp_name);
}
/* print name if available */
name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE);
- if(name) {
+ if (name) {
ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
RNA_struct_identifier(self->ptr.type),
name);
@@ -821,12 +830,12 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
PyObject *tmp_str;
PyObject *ret;
- if(id == NULL || !PYRNA_STRUCT_IS_VALID(self))
+ if (id == NULL || !PYRNA_STRUCT_IS_VALID(self))
return pyrna_struct_str(self); /* fallback */
tmp_str= PyUnicode_FromString(id->name+2);
- if(RNA_struct_is_ID(self->ptr.type)) {
+ if (RNA_struct_is_ID(self->ptr.type)) {
ret= PyUnicode_FromFormat("bpy.data.%s[%R]",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str);
@@ -834,7 +843,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
else {
const char *path;
path= RNA_path_from_ID_to_struct(&self->ptr);
- if(path) {
+ if (path) {
ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str,
@@ -863,11 +872,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
char type_fmt[64]= "";
int type;
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
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;
}
@@ -878,23 +887,23 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
while ((*c++= tolower(*type_id++))) {} ;
- if(type==PROP_COLLECTION) {
+ 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);
}
- if(len != -1)
+ if (len != -1)
sprintf(--c, "[%d]", len);
}
/* if a pointer, try to print name of pointer target too */
- if(RNA_property_type(self->prop) == PROP_POINTER) {
+ if (RNA_property_type(self->prop) == PROP_POINTER) {
ptr= RNA_property_pointer_get(&self->ptr, self->prop);
name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE);
- if(name) {
+ if (name) {
ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
type_fmt,
RNA_struct_identifier(self->ptr.type),
@@ -904,9 +913,9 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
return ret;
}
}
- if(RNA_property_type(self->prop) == PROP_COLLECTION) {
+ if (RNA_property_type(self->prop) == PROP_COLLECTION) {
PointerRNA r_ptr;
- if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
+ if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
return PyUnicode_FromFormat("<bpy_%.200s, %.200s>",
type_fmt,
RNA_struct_identifier(r_ptr.type));
@@ -926,15 +935,15 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
PyObject *ret;
const char *path;
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
- if(id == NULL)
+ if (id == NULL)
return pyrna_prop_str(self); /* fallback */
tmp_str= PyUnicode_FromString(id->name+2);
path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
- if(path) {
+ if (path) {
ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str,
@@ -1020,7 +1029,7 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
#endif
#ifdef USE_PYRNA_STRUCT_REFERENCE
- if(self->reference) {
+ if (self->reference) {
PyObject_GC_UnTrack(self);
pyrna_struct_clear(self);
}
@@ -1033,13 +1042,13 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
#ifdef USE_PYRNA_STRUCT_REFERENCE
static void pyrna_struct_reference_set(BPy_StructRNA *self, PyObject *reference)
{
- if(self->reference) {
+ if (self->reference) {
// PyObject_GC_UnTrack(self); /* INITIALIZED TRACKED? */
pyrna_struct_clear(self);
}
/* reference is now NULL */
- if(reference) {
+ if (reference) {
self->reference= reference;
Py_INCREF(reference);
// PyObject_GC_Track(self); /* INITIALIZED TRACKED? */
@@ -1077,14 +1086,14 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
int free= FALSE;
RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
- if(item) {
+ if (item) {
result= BPy_enum_as_string(item);
}
else {
result= "";
}
- if(free)
+ if (free)
MEM_freeN(item);
return result;
@@ -1137,14 +1146,14 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_
while (_PySet_NextEntry(value, &pos, &key, &hash)) {
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);
return -1;
}
- if(pyrna_enum_value_from_id(items, param, &ret, error_prefix) < 0) {
+ if (pyrna_enum_value_from_id(items, param, &ret, error_prefix) < 0) {
return -1;
}
@@ -1173,11 +1182,11 @@ 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) {
+ if (item) {
ret= pyrna_set_to_enum_bitfield(item, value, r_value, error_prefix);
}
else {
- if(PySet_GET_SIZE(value)) {
+ 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));
@@ -1188,7 +1197,7 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj
}
}
- if(free)
+ if (free)
MEM_freeN(item);
return ret;
@@ -1199,10 +1208,10 @@ PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value)
PyObject *ret= PySet_New(NULL);
const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];
- if(RNA_enum_bitflag_identifiers(items, value, identifier)) {
+ if (RNA_enum_bitflag_identifiers(items, value, identifier)) {
PyObject *item;
int index;
- for(index=0; identifier[index]; index++) {
+ for (index=0; identifier[index]; index++) {
item= PyUnicode_FromString(identifier[index]);
PySet_Add(ret, item);
Py_DECREF(item);
@@ -1216,7 +1225,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
{
PyObject *item, *ret= NULL;
- if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];
ret= PySet_New(NULL);
@@ -1224,7 +1233,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
if (RNA_property_enum_bitflag_identifiers(BPy_GetContext(), ptr, prop, val, identifier)) {
int index;
- for(index=0; identifier[index]; index++) {
+ for (index=0; identifier[index]; index++) {
item= PyUnicode_FromString(identifier[index]);
PySet_Add(ret, item);
Py_DECREF(item);
@@ -1244,7 +1253,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
/* 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) {
+ if (enum_item && enum_item->identifier) {
ret= PyUnicode_FromString(enum_item->identifier);
}
else {
@@ -1259,13 +1268,13 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
PyErr_Warn(PyExc_RuntimeWarning, error_str);
#endif
- if(ptr_name)
+ if (ptr_name)
MEM_freeN((void *)ptr_name);
ret= PyUnicode_FromString("");
}
- if(free)
+ if (free)
MEM_freeN(enum_item);
/*
PyErr_Format(PyExc_AttributeError,
@@ -1307,7 +1316,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed));
#ifdef USE_STRING_COERCE
/* only file paths get special treatment, they may contain non utf-8 chars */
- if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
ret= PyC_UnicodeFromByte(buf);
}
else {
@@ -1316,7 +1325,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
#else // USE_STRING_COERCE
ret= PyUnicode_FromString(buf);
#endif // USE_STRING_COERCE
- if(buf_fixed != buf) {
+ if (buf_fixed != buf) {
MEM_freeN((void *)buf);
}
break;
@@ -1379,7 +1388,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
item= PyDict_GetItemString(kw, arg_name); /* wont set an error */
if (item == NULL) {
- if(all_args) {
+ if (all_args) {
PyErr_Format(PyExc_TypeError,
"%.200s: keyword \"%.200s\" missing",
error_prefix, arg_name ? arg_name : "<UNKNOWN>");
@@ -1434,7 +1443,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
if (RNA_property_array_check(prop)) {
/* done getting the length */
- if(pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) {
+ if (pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) {
return -1;
}
}
@@ -1449,12 +1458,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
/* prefer not to have an exception here
* 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)
+ if (RNA_property_flag(prop) & PROP_OUTPUT)
param= PyObject_IsTrue(value);
else
param= PyLong_AsLong(value);
- if(param < 0) {
+ if (param < 0) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s expected True/False or 0/1, not %.200s",
error_prefix, RNA_struct_identifier(ptr->type),
@@ -1462,8 +1471,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
else {
- if(data) *((int*)data)= param;
- else RNA_property_boolean_set(ptr, prop, param);
+ if (data) *((int*)data)= param;
+ else RNA_property_boolean_set(ptr, prop, param);
}
break;
}
@@ -1471,7 +1480,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
{
int overflow;
long param= PyLong_AsLongAndOverflow(value, &overflow);
- if(overflow || (param > INT_MAX) || (param < INT_MIN)) {
+ if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
PyErr_Format(PyExc_ValueError,
"%.200s %.200s.%.200s value not in 'int' range "
"(" STRINGIFY(INT_MIN) ", " STRINGIFY(INT_MAX) ")",
@@ -1489,8 +1498,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
else {
int param_i= (int)param;
RNA_property_int_clamp(ptr, prop, &param_i);
- if(data) *((int*)data)= param_i;
- else RNA_property_int_set(ptr, prop, param_i);
+ if (data) *((int*)data)= param_i;
+ else RNA_property_int_set(ptr, prop, param_i);
}
break;
}
@@ -1506,8 +1515,8 @@ 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;
- else RNA_property_float_set(ptr, prop, param);
+ if (data) *((float*)data)= param;
+ else RNA_property_float_set(ptr, prop, param);
}
break;
}
@@ -1517,14 +1526,14 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
#ifdef USE_STRING_COERCE
PyObject *value_coerce= NULL;
int subtype= RNA_property_subtype(prop);
- if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
/* TODO, get size */
param= PyC_UnicodeAsByte(value, &value_coerce);
}
else {
param= _PyUnicode_AsString(value);
#ifdef WITH_INTERNATIONAL
- if(subtype == PROP_TRANSLATE) {
+ if (subtype == PROP_TRANSLATE) {
param= UI_translate_do_iface(param);
}
#endif // WITH_INTERNATIONAL
@@ -1535,7 +1544,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
#endif // USE_STRING_COERCE
if (param==NULL) {
- if(PyUnicode_Check(value)) {
+ if (PyUnicode_Check(value)) {
/* there was an error assigning a string type,
* rather than setting a new error, prefix the existing one
*/
@@ -1554,8 +1563,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
else {
- 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);
+ 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
Py_XDECREF(value_coerce);
@@ -1567,9 +1576,9 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
int val= 0;
/* type checkins is done by each function */
- if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
/* set of enum items, concatenate all values with OR */
- if(pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) {
+ if (pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) {
return -1;
}
}
@@ -1580,8 +1589,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
}
- if(data) *((int*)data)= val;
- else RNA_property_enum_set(ptr, prop, val);
+ if (data) *((int*)data)= val;
+ else RNA_property_enum_set(ptr, prop, val);
break;
}
@@ -1603,7 +1612,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
* 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.
*/
- if( (ptr_type == &RNA_AnyType) &&
+ if ((ptr_type == &RNA_AnyType) &&
(BPy_StructRNA_Check(value)) &&
(RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator))
) {
@@ -1619,10 +1628,10 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
/* 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;
- if(RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
+ if (RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
value= pyrna_struct_CreatePyObject(&c_ptr);
value_new= value;
}
@@ -1636,7 +1645,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
}
- if(!BPy_StructRNA_Check(value) && value != Py_None) {
+ if (!BPy_StructRNA_Check(value) && value != Py_None) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s expected a %.200s type, not %.200s",
error_prefix, RNA_struct_identifier(ptr->type),
@@ -1644,14 +1653,14 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
Py_TYPE(value)->tp_name);
Py_XDECREF(value_new); return -1;
}
- else if((flag & PROP_NEVER_NULL) && value == Py_None) {
+ else if ((flag & PROP_NEVER_NULL) && value == Py_None) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s does not support a 'None' assignment %.200s type",
error_prefix, RNA_struct_identifier(ptr->type),
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),
@@ -1661,18 +1670,18 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
else {
BPy_StructRNA *param= (BPy_StructRNA*)value;
int raise_error= FALSE;
- if(data) {
+ if (data) {
- if(flag & PROP_RNAPTR) {
- if(value == Py_None)
+ if (flag & PROP_RNAPTR) {
+ if (value == Py_None)
memset(data, 0, sizeof(PointerRNA));
else
*((PointerRNA*)data)= param->ptr;
}
- else if(value == Py_None) {
+ else if (value == Py_None) {
*((void**)data)= NULL;
}
- else if(RNA_struct_is_a(param->ptr.type, ptr_type)) {
+ else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
*((void**)data)= param->ptr.data;
}
else {
@@ -1681,11 +1690,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
/* data==NULL, assign to RNA */
- if(value == Py_None) {
+ if (value == Py_None) {
PointerRNA valueptr= {{NULL}};
RNA_property_pointer_set(ptr, prop, valueptr);
}
- else if(RNA_struct_is_a(param->ptr.type, ptr_type)) {
+ else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
RNA_property_pointer_set(ptr, prop, param->ptr);
}
else {
@@ -1700,7 +1709,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
}
- if(raise_error) {
+ if (raise_error) {
PointerRNA tmp;
RNA_pointer_create(NULL, ptr_type, NULL, &tmp);
PyErr_Format(PyExc_TypeError,
@@ -1727,7 +1736,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
lb= (data)? (ListBase*)data: NULL;
/* convert a sequence of dict's into a collection */
- if(!PySequence_Check(value)) {
+ if (!PySequence_Check(value)) {
PyErr_Format(PyExc_TypeError,
"%.200s %.200s.%.200s expected a sequence for an RNA collection, not %.200s",
error_prefix, RNA_struct_identifier(ptr->type),
@@ -1736,10 +1745,10 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
seq_len= PySequence_Size(value);
- for(i=0; i < seq_len; i++) {
+ 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),
@@ -1748,7 +1757,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",
@@ -1758,7 +1767,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
return -1;
}
- if(lb) {
+ if (lb) {
link= MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink");
link->ptr= itemptr;
BLI_addtail(lb, link);
@@ -1766,7 +1775,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
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) {
+ 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);
@@ -1796,7 +1805,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
/* Run rna property functions */
- if(RNA_property_update_check(prop)) {
+ if (RNA_property_update_check(prop)) {
RNA_property_update(BPy_GetContext(), ptr, prop);
}
@@ -1805,7 +1814,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
static PyObject *pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int index)
{
- PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self)
+ PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
return pyrna_py_from_array_index(self, &self->ptr, self->prop, index);
}
@@ -1831,7 +1840,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
{
int param= PyLong_AsLong(value);
- if(param < 0 || param > 1) {
+ if (param < 0 || param > 1) {
PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1");
ret= -1;
}
@@ -1874,7 +1883,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
}
/* Run rna property functions */
- if(RNA_property_update_check(prop)) {
+ if (RNA_property_update_check(prop)) {
RNA_property_update(BPy_GetContext(), ptr, prop);
}
@@ -1884,7 +1893,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
//---------------sequence-------------------------------------------
static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self)
{
- PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self)
+ PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self);
if (RNA_property_array_dimension(&self->ptr, self->prop, NULL) > 1)
return RNA_property_multi_array_length(&self->ptr, self->prop, self->arraydim);
@@ -1894,7 +1903,7 @@ static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self)
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self)
{
- PYRNA_PROP_CHECK_INT(self)
+ PYRNA_PROP_CHECK_INT(self);
return RNA_property_collection_length(&self->ptr, self->prop);
}
@@ -1903,7 +1912,7 @@ static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self)
* of 1000's of items in a linked list for eg. */
static int pyrna_prop_array_bool(BPy_PropertyRNA *self)
{
- PYRNA_PROP_CHECK_INT(self)
+ PYRNA_PROP_CHECK_INT(self);
return RNA_property_array_length(&self->ptr, self->prop) ? 1 : 0;
}
@@ -1914,7 +1923,7 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
CollectionPropertyIterator iter;
int test;
- PYRNA_PROP_CHECK_INT(self)
+ PYRNA_PROP_CHECK_INT(self);
RNA_property_collection_begin(&self->ptr, self->prop, &iter);
test= iter.valid;
@@ -1923,13 +1932,13 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
}
+/* notice getting the length of the collection is avoided unless negative
+ * index is used or to detect internal error with a valid index.
+ * This is done for faster lookups. */
#define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \
- /* notice getting the length of the collection is avoided unless negative \
- * index is used or to detect internal error with a valid index. \
- * This is done for faster lookups. */ \
- if(keynum < 0) { \
+ if (keynum < 0) { \
keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \
- if(keynum_abs < 0) { \
+ if (keynum_abs < 0) { \
PyErr_Format(PyExc_IndexError, \
"bpy_prop_collection[%d]: out of range.", keynum); \
return ret_err; \
@@ -1943,16 +1952,16 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
PointerRNA newptr;
Py_ssize_t keynum_abs= keynum;
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
PYRNA_PROP_COLLECTION_ABS_INDEX(NULL);
- if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum_abs, &newptr)) {
+ if (RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum_abs, &newptr)) {
return pyrna_struct_CreatePyObject(&newptr);
}
else {
const int len= RNA_property_collection_length(&self->ptr, self->prop);
- if(keynum_abs >= len) {
+ if (keynum_abs >= len) {
PyErr_Format(PyExc_IndexError,
"bpy_prop_collection[index]: "
"index %d out of range, size %d", keynum, len);
@@ -1974,16 +1983,23 @@ static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, Py_ssi
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_CHECK_INT(self);
PYRNA_PROP_COLLECTION_ABS_INDEX(-1);
- if(RNA_property_collection_assign_int(&self->ptr, self->prop, keynum_abs, ptr) == 0) {
-
- PyErr_Format(PyExc_IndexError,
- "bpy_prop_collection[index] = value: "
- "failed assignment (unknown reason)", keynum);
+ 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);
+ if (keynum_abs >= len) {
+ PyErr_Format(PyExc_IndexError,
+ "bpy_prop_collection[index] = value: "
+ "index %d out of range, size %d", keynum, len);
+ }
+ else {
+ PyErr_Format(PyExc_IndexError,
+ "bpy_prop_collection[index] = value: "
+ "failed assignment (unknown reason)", keynum);
+ }
return -1;
}
@@ -1994,16 +2010,17 @@ static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int
{
int len;
- PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self)
+ PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
len= pyrna_prop_array_length(self);
- if(keynum < 0) keynum += len;
+ if (keynum < 0) keynum += len;
- if(keynum >= 0 && keynum < len)
+ if (keynum >= 0 && keynum < len)
return pyrna_prop_array_to_py_index(self, keynum);
- PyErr_Format(PyExc_IndexError, "bpy_prop_array[index]: index %d out of range", keynum);
+ PyErr_Format(PyExc_IndexError,
+ "bpy_prop_array[index]: index %d out of range", keynum);
return NULL;
}
@@ -2011,9 +2028,9 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons
{
PointerRNA newptr;
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
- if(RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr))
+ if (RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr))
return pyrna_struct_CreatePyObject(&newptr);
PyErr_Format(PyExc_KeyError, "bpy_prop_collection[key]: key \"%.200s\" not found", keyname);
@@ -2029,27 +2046,27 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py
PyObject *list;
PyObject *item;
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
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)) {
+ 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; */
- if(count == start) {
+ if (count == start) {
break;
}
count++;
}
/* add items until stop */
- for(; rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) {
+ for (; rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) {
item= pyrna_struct_CreatePyObject(&rna_macro_iter.ptr);
PyList_Append(list, item);
Py_DECREF(item);
count++;
- if(count == stop) {
+ if (count == stop) {
break;
}
}
@@ -2068,11 +2085,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
int count, totdim;
PyObject *tuple;
- PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self)
+ PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
tuple= PyTuple_New(stop - start);
- /* PYRNA_PROP_CHECK_OBJ(self) isn't needed, internal use only */
+ /* PYRNA_PROP_CHECK_OBJ(self); isn't needed, internal use only */
totdim= RNA_property_array_dimension(ptr, prop, NULL);
@@ -2086,14 +2103,14 @@ 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) {
+ if (values != values_stack) {
PyMem_FREE(values);
}
break;
@@ -2102,14 +2119,14 @@ 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) {
+ if (values != values_stack) {
PyMem_FREE(values);
}
break;
@@ -2118,14 +2135,14 @@ 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) {
+ if (values != values_stack) {
PyMem_FREE(values);
}
break;
@@ -2143,7 +2160,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject *key)
{
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
if (PyUnicode_Check(key)) {
return pyrna_prop_collection_subscript_str(self, _PyUnicode_AsString(key));
@@ -2159,28 +2176,28 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
PySliceObject *key_slice= (PySliceObject *)key;
Py_ssize_t step= 1;
- if(key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
+ if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
return NULL;
}
else if (step != 1) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported");
return NULL;
}
- else if(key_slice->start == Py_None && key_slice->stop == Py_None) {
+ else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
}
else {
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;
- if(key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL;
+ if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
+ if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL;
- if(start < 0 || stop < 0) {
+ 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);
- if(start < 0) start += len;
- if(stop < 0) start += len;
+ if (start < 0) start += len;
+ if (stop < 0) start += len;
}
if (stop - start <= 0) {
@@ -2206,11 +2223,11 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val
{
StructRNA *prop_srna;
- if(value == Py_None) {
+ if (value == Py_None) {
if (RNA_property_flag(self->prop) & PROP_NEVER_NULL) {
PyErr_Format(PyExc_TypeError,
- "bpy_prop_collection[key] = value: invalid, "
- "this collection doesnt support None assignment");
+ "bpy_prop_collection[key] = value: invalid, "
+ "this collection doesnt support None assignment");
return -1;
}
else {
@@ -2224,7 +2241,7 @@ 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))) {
+ 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,
@@ -2253,7 +2270,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
PYRNA_PROP_CHECK_INT(self);
/* validate the assigned value */
- if(value == NULL) {
+ if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
"del bpy_prop_collection[key]: not supported");
return -1;
@@ -2280,28 +2297,28 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
PySliceObject *key_slice= (PySliceObject *)key;
Py_ssize_t step= 1;
- if(key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
+ if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
return NULL;
}
else if (step != 1) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported");
return NULL;
}
- else if(key_slice->start == Py_None && key_slice->stop == Py_None) {
+ else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
}
else {
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;
- if(key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL;
+ if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
+ if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL;
- if(start < 0 || stop < 0) {
+ 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);
- if(start < 0) start += len;
- if(stop < 0) start += len;
+ if (start < 0) start += len;
+ if (stop < 0) start += len;
}
if (stop - start <= 0) {
@@ -2324,7 +2341,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject *key)
{
- PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self)
+ PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
/*if (PyUnicode_Check(key)) {
return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key));
@@ -2340,14 +2357,14 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
Py_ssize_t step= 1;
PySliceObject *key_slice= (PySliceObject *)key;
- if(key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
+ if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
return NULL;
}
else if (step != 1) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_array[slice]: slice steps not supported");
return NULL;
}
- else if(key_slice->start == Py_None && key_slice->stop == Py_None) {
+ 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);
return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
@@ -2381,16 +2398,16 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
void *values_alloc= NULL;
int ret= 0;
- if(value_orig == NULL) {
+ if (value_orig == NULL) {
PyErr_SetString(PyExc_TypeError, "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) {
+ 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");
return -1;
@@ -2405,36 +2422,36 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
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(start != 0 || stop != length) /* partial assignment? - need to get the array */
+ 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++) {
+ for (count=start; count<stop; count++) {
fval= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start));
CLAMP(fval, min, max);
values[count]= fval;
}
- if(PyErr_Occurred()) ret= -1;
- else RNA_property_float_set_array(ptr, prop, values);
+ if (PyErr_Occurred()) ret= -1;
+ else RNA_property_float_set_array(ptr, prop, values);
break;
}
case PROP_BOOLEAN:
{
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 */
+ 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++)
+ for (count=start; count<stop; count++)
values[count]= PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
- if(PyErr_Occurred()) ret= -1;
- else RNA_property_boolean_set_array(ptr, prop, values);
+ if (PyErr_Occurred()) ret= -1;
+ else RNA_property_boolean_set_array(ptr, prop, values);
break;
}
case PROP_INT:
@@ -2445,20 +2462,20 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
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 */
+ 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++) {
+ for (count=start; count<stop; count++) {
ival= PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
CLAMP(ival, min, max);
values[count]= ival;
}
- if(PyErr_Occurred()) ret= -1;
- else RNA_property_int_set_array(ptr, prop, values);
+ if (PyErr_Occurred()) ret= -1;
+ else RNA_property_int_set_array(ptr, prop, values);
break;
}
default:
@@ -2468,7 +2485,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
Py_DECREF(value);
- if(values_alloc) {
+ if (values_alloc) {
PyMem_FREE(values_alloc);
}
@@ -2480,16 +2497,17 @@ static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t k
{
int len;
- PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self)
+ PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self);
len= pyrna_prop_array_length(self);
- if(keynum < 0) keynum += len;
+ if (keynum < 0) keynum += len;
- if(keynum >= 0 && keynum < len)
+ if (keynum >= 0 && keynum < len)
return pyrna_py_to_prop_array_index(self, keynum, value);
- PyErr_SetString(PyExc_IndexError, "bpy_prop_array[index] = value: index out of range");
+ PyErr_SetString(PyExc_IndexError,
+ "bpy_prop_array[index] = value: index out of range");
return -1;
}
@@ -2539,8 +2557,8 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
ret= -1;
}
- if(ret != -1) {
- if(RNA_property_update_check(self->prop)) {
+ if (ret != -1) {
+ if (RNA_property_update_check(self->prop)) {
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
}
}
@@ -2599,7 +2617,7 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *value
/* key in dict style check */
const char *keyname= _PyUnicode_AsString(value);
- if(keyname==NULL) {
+ if (keyname==NULL) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.__contains__: expected a string");
return -1;
}
@@ -2615,21 +2633,21 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
IDProperty *group;
const char *name= _PyUnicode_AsString(value);
- PYRNA_STRUCT_CHECK_INT(self)
+ PYRNA_STRUCT_CHECK_INT(self);
if (!name) {
PyErr_SetString(PyExc_TypeError, "bpy_struct.__contains__: expected a string");
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);
- if(!group)
+ if (!group)
return 0;
return IDP_GetPropertyFromGroup(group, name) ? 1:0;
@@ -2680,28 +2698,28 @@ static PyObject *pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key)
IDProperty *group, *idprop;
const char *name= _PyUnicode_AsString(key);
- PYRNA_STRUCT_CHECK_OBJ(self)
+ 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);
- 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);
- if(idprop==NULL) {
+ if (idprop==NULL) {
PyErr_Format(PyExc_KeyError, "bpy_struct[key]: key \"%s\" not found", name);
return NULL;
}
@@ -2713,17 +2731,17 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
{
IDProperty *group;
- PYRNA_STRUCT_CHECK_INT(self)
+ PYRNA_STRUCT_CHECK_INT(self);
group= RNA_struct_idprops(&self->ptr, 1);
#ifdef USE_PEDANTIC_WRITE
- if(rna_disallow_writes && rna_id_write_error(&self->ptr, key)) {
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, key)) {
return -1;
}
#endif // USE_STRING_COERCE
- if(group==NULL) {
+ if (group==NULL) {
PyErr_SetString(PyExc_TypeError, "bpy_struct[key]= val: id properties not supported for this type");
return -1;
}
@@ -2746,21 +2764,20 @@ PyDoc_STRVAR(pyrna_struct_keys_doc,
" :return: custom property keys.\n"
" :rtype: list of strings\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes\n"
-" support custom properties.\n"
+BPY_DOC_ID_PROP_TYPE_NOTE
);
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);
- if(group==NULL)
+ if (group==NULL)
return PyList_New(0);
return BPy_Wrap_GetKeys(group);
@@ -2775,21 +2792,20 @@ PyDoc_STRVAR(pyrna_struct_items_doc,
" :return: custom property key, value pairs.\n"
" :rtype: list of key, value tuples\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
-" classes support custom properties.\n"
+BPY_DOC_ID_PROP_TYPE_NOTE
);
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);
- if(group==NULL)
+ if (group==NULL)
return PyList_New(0);
return BPy_Wrap_GetItems(self->ptr.id.data, group);
@@ -2804,21 +2820,20 @@ PyDoc_STRVAR(pyrna_struct_values_doc,
" :return: custom property values.\n"
" :rtype: list\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
-" classes support custom properties.\n"
+BPY_DOC_ID_PROP_TYPE_NOTE
);
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);
- if(group==NULL)
+ if (group==NULL)
return PyList_New(0);
return BPy_Wrap_GetValues(self->ptr.id.data, group);
@@ -2839,12 +2854,12 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
const char *name;
int ret;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
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);
@@ -2853,9 +2868,9 @@ 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) {
+ if (RNA_property_flag(prop) & PROP_IDPROPERTY) {
IDProperty *group= RNA_struct_idprops(&self->ptr, 0);
- if(group) {
+ if (group) {
ret= IDP_GetPropertyFromGroup(group, name) ? 1:0;
}
else {
@@ -2882,12 +2897,12 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *
PropertyRNA *prop;
const char *name;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
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);
@@ -2916,16 +2931,16 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
PropertyRNA *r_prop;
int index= -1;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
if (!PyArg_ParseTuple(args, "s|O!:path_resolve", &path, &PyBool_Type, &coerce))
return NULL;
if (RNA_path_resolve_full(&self->ptr, path, &r_ptr, &r_prop, &index)) {
- if(r_prop) {
- if(index != -1) {
- if(index >= RNA_property_array_length(&r_ptr, r_prop) || index < 0) {
- PyErr_Format(PyExc_TypeError,
+ if (r_prop) {
+ if (index != -1) {
+ if (index >= RNA_property_array_length(&r_ptr, r_prop) || index < 0) {
+ PyErr_Format(PyExc_IndexError,
"%.200s.path_resolve(\"%.200s\") index out of range",
RNA_struct_identifier(self->ptr.type), path);
return NULL;
@@ -2935,7 +2950,7 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
}
}
else {
- if(coerce == Py_False) {
+ if (coerce == Py_False) {
return pyrna_prop_CreatePyObject(&r_ptr, r_prop);
}
else {
@@ -2948,7 +2963,7 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
}
}
else {
- PyErr_Format(PyExc_TypeError,
+ PyErr_Format(PyExc_ValueError,
"%.200s.path_resolve(\"%.200s\") could not be resolved",
RNA_struct_identifier(self->ptr.type), path);
return NULL;
@@ -2963,7 +2978,7 @@ PyDoc_STRVAR(pyrna_struct_path_from_id_doc,
" :arg property: Optional property name which can be used if the path is\n"
" to a property of this object.\n"
" :type property: string\n"
-" :return: The path from :class:`bpy_struct.id_data`\n"
+" :return: The path from :class:`bpy.types.bpy_struct.id_data`\n"
" to this struct and property (when given).\n"
" :rtype: str\n"
);
@@ -2974,15 +2989,15 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
PropertyRNA *prop;
PyObject *ret;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
if (!PyArg_ParseTuple(args, "|s:path_from_id", &name))
return NULL;
- if(name) {
+ if (name) {
prop= RNA_struct_find_property(&self->ptr, name);
- if(prop==NULL) {
- PyErr_Format(PyExc_TypeError,
+ if (prop==NULL) {
+ PyErr_Format(PyExc_AttributeError,
"%.200s.path_from_id(\"%.200s\") not found",
RNA_struct_identifier(self->ptr.type), name);
return NULL;
@@ -2994,14 +3009,14 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
path= RNA_path_from_ID_to_struct(&self->ptr);
}
- if(path==NULL) {
- if(name) {
- PyErr_Format(PyExc_TypeError,
+ if (path==NULL) {
+ if (name) {
+ PyErr_Format(PyExc_ValueError,
"%.200s.path_from_id(\"%s\") found but does not support path creation",
RNA_struct_identifier(self->ptr.type), name);
}
else {
- PyErr_Format(PyExc_TypeError,
+ PyErr_Format(PyExc_ValueError,
"%.200s.path_from_id() does not support path creation for this type",
RNA_struct_identifier(self->ptr.type));
}
@@ -3019,7 +3034,7 @@ PyDoc_STRVAR(pyrna_prop_path_from_id_doc,
"\n"
" Returns the data path from the ID to this property (string).\n"
"\n"
-" :return: The path from :class:`bpy_struct.id_data` to this property.\n"
+" :return: The path from :class:`bpy.types.bpy_struct.id_data` to this property.\n"
" :rtype: str\n"
);
static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
@@ -3030,8 +3045,8 @@ static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
path= RNA_path_from_ID_to_property(&self->ptr, self->prop);
- if(path==NULL) {
- PyErr_Format(PyExc_TypeError,
+ 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;
@@ -3050,13 +3065,13 @@ PyDoc_STRVAR(pyrna_struct_type_recast_doc,
" such as textures can be changed at runtime.\n"
"\n"
" :return: a new instance of this object with the type initialized again.\n"
-" :rtype: subclass of :class:`bpy_struct`\n"
+" :rtype: subclass of :class:`bpy.types.bpy_struct`\n"
);
static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
{
PointerRNA r_ptr;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
RNA_pointer_recast(&self->ptr, &r_ptr);
return pyrna_struct_CreatePyObject(&r_ptr);
@@ -3070,14 +3085,14 @@ static void pyrna_dir_members_py(PyObject *list, PyObject *self)
dict_ptr= _PyObject_GetDictPtr((PyObject *)self);
- if(dict_ptr && (dict=*dict_ptr)) {
+ 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;
- if(dict) {
+ if (dict) {
list_tmp= PyDict_Keys(dict);
PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
Py_DECREF(list_tmp);
@@ -3118,13 +3133,14 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
RNA_PROP_BEGIN(ptr, itemptr, iterprop) {
nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
- if(nameptr) {
+ if (nameptr) {
pystring= PyUnicode_FromString(nameptr);
PyList_Append(list, pystring);
Py_DECREF(pystring);
- if(name != nameptr)
+ if (name != nameptr) {
MEM_freeN(nameptr);
+ }
}
}
RNA_PROP_END;
@@ -3137,7 +3153,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
PyObject *ret;
PyObject *pystring;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(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
@@ -3149,11 +3165,11 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
pyrna_dir_members_rna(ret, &self->ptr);
- if(self->ptr.type == &RNA_Context) {
+ if (self->ptr.type == &RNA_Context) {
ListBase lb= CTX_data_dir_get(self->ptr.data);
LinkData *link;
- for(link=lb.first; link; link=link->next) {
+ for (link=lb.first; link; link=link->next) {
pystring= PyUnicode_FromString(link->data);
PyList_Append(ret, pystring);
Py_DECREF(pystring);
@@ -3184,15 +3200,15 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
PropertyRNA *prop;
FunctionRNA *func;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
- if(name == NULL) {
+ if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: __getattr__ must be a string");
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;
}
@@ -3209,7 +3225,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
}
else if (self->ptr.type == &RNA_Context) {
bContext *C= self->ptr.data;
- if(C==NULL) {
+ if (C==NULL) {
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context is 'NULL', can't get \"%.200s\" from context",
name);
@@ -3222,10 +3238,10 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
int done= CTX_data_get(C, name, &newptr, &newlb, &newtype);
- if(done==1) { /* found */
+ if (done==1) { /* found */
switch(newtype) {
case CTX_DATA_TYPE_POINTER:
- if(newptr.data == NULL) {
+ if (newptr.data == NULL) {
ret= Py_None;
Py_INCREF(ret);
}
@@ -3240,7 +3256,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
ret= PyList_New(0);
- for(link=newlb.first; link; link=link->next) {
+ for (link=newlb.first; link; link=link->next) {
linkptr= pyrna_struct_CreatePyObject(&link->ptr);
PyList_Append(ret, linkptr);
Py_DECREF(linkptr);
@@ -3319,11 +3335,11 @@ 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)
+ if (ret == NULL) { // || pyrna_is_deferred_prop(ret)
StructRNA *srna= srna_from_self(cls, "StructRNA.__getattr__");
- if(srna) {
+ if (srna) {
PropertyRNA *prop= RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr));
- if(prop) {
+ if (prop) {
PointerRNA tptr;
PyErr_Clear(); /* clear error from tp_getattro */
RNA_pointer_create(NULL, &RNA_Property, prop, &tptr);
@@ -3342,7 +3358,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
StructRNA *srna= srna_from_self(cls, "StructRNA.__setattr__");
const int is_deferred_prop= (value && pyrna_is_deferred_prop(value));
- if(srna && !pyrna_write_check() && (is_deferred_prop || RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr)))) {
+ if (srna && !pyrna_write_check() && (is_deferred_prop || RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr)))) {
PyErr_Format(PyExc_AttributeError,
"pyrna_struct_meta_idprop_setattro() "
"can't set in readonly state '%.200s.%S'",
@@ -3350,10 +3366,10 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
return -1;
}
- if(srna == NULL) {
+ if (srna == NULL) {
/* allow setting on unregistered classes which can be registered later on */
/*
- if(value && is_deferred_prop) {
+ if (value && is_deferred_prop) {
PyErr_Format(PyExc_AttributeError,
"pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'",
((PyTypeObject *)cls)->tp_name);
@@ -3365,11 +3381,11 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
return PyType_Type.tp_setattro(cls, attr, value);
}
- if(value) {
+ if (value) {
/* check if the value is a property */
- if(is_deferred_prop) {
+ if (is_deferred_prop) {
int ret= deferred_register_prop(srna, attr, value);
- if(ret == -1) {
+ if (ret == -1) {
/* error set */
return ret;
}
@@ -3405,15 +3421,15 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
const char *name= _PyUnicode_AsString(pyname);
PropertyRNA *prop= NULL;
- PYRNA_STRUCT_CHECK_INT(self)
+ PYRNA_STRUCT_CHECK_INT(self);
#ifdef USE_PEDANTIC_WRITE
- if(rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
return -1;
}
#endif // USE_STRING_COERCE
- if(name == NULL) {
+ if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: __setattr__ must be a string");
return -1;
}
@@ -3428,7 +3444,7 @@ 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) {
+ if (C==NULL) {
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context is 'NULL', can't set \"%.200s\" from context",
name);
@@ -3441,7 +3457,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
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);
@@ -3454,8 +3470,8 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
}
/* pyrna_py_to_prop sets its own exceptions */
- if(prop) {
- if(value == NULL) {
+ if (prop) {
+ if (value == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
return -1;
}
@@ -3480,8 +3496,8 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
pyrna_dir_members_py(ret, (PyObject *)self);
}
- if(RNA_property_type(self->prop) == PROP_COLLECTION) {
- if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
+ if (RNA_property_type(self->prop) == PROP_COLLECTION) {
+ if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
pyrna_dir_members_rna(ret, &r_ptr);
}
}
@@ -3499,17 +3515,17 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
{
const char *name= _PyUnicode_AsString(pyname);
- if(name == NULL) {
+ if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_prop_collection: __getattr__ must be a string");
return NULL;
}
- else if(name[0] != '_') {
+ else if (name[0] != '_') {
PyObject *ret;
PropertyRNA *prop;
FunctionRNA *func;
PointerRNA r_ptr;
- if(RNA_property_collection_type_get(&self->ptr, self->prop, &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);
@@ -3536,10 +3552,10 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
PyObject *ret= PyObject_GenericGetAttr((PyObject *)self, pyname);
- if(ret == NULL && name[0] != '_') { /* avoid inheriting __call__ and similar */
+ if (ret == NULL && name[0] != '_') { /* avoid inheriting __call__ and similar */
/* since this is least common case, handle it last */
PointerRNA r_ptr;
- if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
+ if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
PyObject *cls;
PyObject *error_type, *error_value, *error_traceback;
@@ -3549,7 +3565,7 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
cls= pyrna_struct_Subtype(&r_ptr); /* borrows */
ret= PyObject_GenericGetAttr(cls, pyname);
/* restore the original error */
- if(ret == NULL) {
+ if (ret == NULL) {
PyErr_Restore(error_type, error_value, error_traceback);
}
}
@@ -3568,20 +3584,20 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam
PointerRNA r_ptr;
#ifdef USE_PEDANTIC_WRITE
- if(rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
+ if (rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) {
return -1;
}
#endif // USE_STRING_COERCE
- if(name == NULL) {
+ if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_prop: __setattr__ must be a string");
return -1;
}
- else if(value == NULL) {
+ else if (value == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy_prop: del not supported");
return -1;
}
- else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
+ else if (RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
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):");
@@ -3600,7 +3616,7 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
PointerRNA r_ptr;
RNA_property_collection_add(&self->ptr, self->prop, &r_ptr);
- if(!r_ptr.data) {
+ if (!r_ptr.data) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.add(): not supported for this collection");
return NULL;
}
@@ -3618,7 +3634,7 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
return NULL;
}
- if(!RNA_property_collection_remove(&self->ptr, self->prop, key)) {
+ if (!RNA_property_collection_remove(&self->ptr, self->prop, key)) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.remove() not supported for this collection");
return NULL;
}
@@ -3635,7 +3651,7 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje
return NULL;
}
- if(!RNA_property_collection_move(&self->ptr, self->prop, key, pos)) {
+ if (!RNA_property_collection_move(&self->ptr, self->prop, key, pos)) {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection.move() not supported for this collection");
return NULL;
}
@@ -3646,7 +3662,7 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje
static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
{
/* used for struct and pointer since both have a ptr */
- if(self->ptr.id.data) {
+ if (self->ptr.id.data) {
PointerRNA id_ptr;
RNA_id_pointer_create((ID *)self->ptr.id.data, &id_ptr);
return pyrna_struct_CreatePyObject(&id_ptr);
@@ -3655,18 +3671,34 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
Py_RETURN_NONE;
}
+static PyObject *pyrna_struct_get_data(BPy_DummyPointerRNA *self)
+{
+ return pyrna_struct_CreatePyObject(&self->ptr);
+}
+
+static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self)
+{
+ PointerRNA tptr;
+ RNA_pointer_create(NULL, &RNA_Property, self->prop, &tptr);
+ return pyrna_struct_Subtype(&tptr);
+}
+
+
+
/*****************************************************************************/
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef pyrna_prop_getseters[]= {
- {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
+ {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL},
+ {(char *)"data", (getter)pyrna_struct_get_data, (setter)NULL, (char *)"The data this property is using, *type* :class:`bpy.types.bpy_struct`", NULL},
+ {(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)"The property type for introspection", NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef pyrna_struct_getseters[]= {
- {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
+ {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -3688,15 +3720,16 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
- if(nameptr) {
+ if (nameptr) {
/* add to python list */
item= PyUnicode_FromString(nameptr);
PyList_Append(ret, item);
Py_DECREF(item);
/* done */
- if(name != nameptr)
+ if (name != nameptr) {
MEM_freeN(nameptr);
+ }
}
}
RNA_PROP_END;
@@ -3721,13 +3754,13 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
int i= 0;
RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
- if(itemptr.data) {
+ if (itemptr.data) {
/* add to python list */
item= PyTuple_New(2);
nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
- if(nameptr) {
+ if (nameptr) {
PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(nameptr));
- if(name != nameptr)
+ if (name != nameptr)
MEM_freeN(nameptr);
}
else {
@@ -3773,8 +3806,7 @@ PyDoc_STRVAR(pyrna_struct_get_doc,
" *key* is not found.\n"
" :type default: Undefined\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
-" classes support custom properties.\n"
+BPY_DOC_ID_PROP_TYPE_NOTE
);
static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
{
@@ -3783,23 +3815,24 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
const char *key;
PyObject* def= Py_None;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
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);
- if(group) {
+ if (group) {
idprop= IDP_GetPropertyFromGroup(group, key);
- if(idprop)
+ if (idprop) {
return BPy_IDGroup_WrapData(self->ptr.id.data, idprop);
+ }
}
return Py_INCREF(def), def;
@@ -3840,12 +3873,12 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
const char *key;
PyObject* def= Py_None;
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
return NULL;
- if(RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr))
+ if (RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr))
return pyrna_struct_CreatePyObject(&newptr);
return Py_INCREF(def), def;
@@ -3886,19 +3919,19 @@ static int foreach_parse_args(
*size= *attr_tot= *attr_signed= FALSE;
*raw_type= PROP_RAW_UNSET;
- if(!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) {
+ 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.
- if(*tot>0) {
+ if (*tot>0) {
foreach_attr_type(self, *attr, raw_type, attr_tot, attr_signed);
*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)
+ if ((*attr_tot) < 1)
*attr_tot= 1;
if (RNA_property_type(self->prop) == PROP_COLLECTION)
@@ -3910,7 +3943,7 @@ static int foreach_parse_args(
target_tot= array_tot * (*attr_tot);
/* rna_access.c - rna_raw_access(...) uses this same method */
- if(target_tot != (*tot)) {
+ if (target_tot != (*tot)) {
PyErr_Format(PyExc_TypeError,
"foreach_get(attr, sequence) sequence length mismatch given %d, needed %d",
*tot, target_tot);
@@ -3934,14 +3967,14 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
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;
case PROP_RAW_DOUBLE:
@@ -3965,17 +3998,17 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
int tot, size, attr_tot, attr_signed;
RawPropertyType raw_type;
- if(foreach_parse_args(self, args, &attr, &seq, &tot, &size, &raw_type, &attr_tot, &attr_signed) < 0)
+ 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 */
+ if (set) { /* get the array from python */
buffer_is_compat= FALSE;
- if(PyObject_CheckBuffer(seq)) {
+ if (PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
@@ -3983,7 +4016,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
buffer_is_compat= foreach_compat_buffer(raw_type, attr_signed, buf.format);
- if(buffer_is_compat) {
+ if (buffer_is_compat) {
ok= RNA_property_collection_raw_set(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
}
@@ -3991,10 +4024,10 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
}
/* could not use the buffer, fallback to sequence */
- if(!buffer_is_compat) {
+ if (!buffer_is_compat) {
array= PyMem_Malloc(size * tot);
- for( ; i<tot; i++) {
+ for ( ; i<tot; i++) {
item= PySequence_GetItem(seq, i);
switch(raw_type) {
case PROP_RAW_CHAR:
@@ -4026,7 +4059,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
}
else {
buffer_is_compat= FALSE;
- if(PyObject_CheckBuffer(seq)) {
+ if (PyObject_CheckBuffer(seq)) {
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
@@ -4034,7 +4067,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
buffer_is_compat= foreach_compat_buffer(raw_type, attr_signed, buf.format);
- if(buffer_is_compat) {
+ if (buffer_is_compat) {
ok= RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, buf.buf, raw_type, tot);
}
@@ -4042,14 +4075,14 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
}
/* could not use the buffer, fallback to sequence */
- if(!buffer_is_compat) {
+ if (!buffer_is_compat) {
array= PyMem_Malloc(size * 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) {
case PROP_RAW_CHAR:
@@ -4081,10 +4114,10 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
}
}
- if(array)
+ if (array)
PyMem_Free(array);
- if(PyErr_Occurred()) {
+ if (PyErr_Occurred()) {
/* Maybe we could make our own error */
PyErr_Print();
PyErr_SetString(PyExc_TypeError, "couldn't access the py sequence");
@@ -4113,7 +4146,7 @@ PyDoc_STRVAR(pyrna_prop_collection_foreach_get_doc,
);
static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
{
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
return foreach_getset(self, args, 0);
}
@@ -4133,7 +4166,7 @@ PyDoc_STRVAR(pyrna_prop_collection_foreach_set_doc,
);
static PyObject *pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObject *args)
{
- PYRNA_PROP_CHECK_OBJ(self)
+ PYRNA_PROP_CHECK_OBJ(self);
return foreach_getset(self, args, 1);
}
@@ -4147,14 +4180,14 @@ static PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
PyObject *iter= NULL;
int len;
- PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self)
+ 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);
/* we know this is a list so no need to PyIter_Check
* otherwise it could be NULL (unlikely) if conversion failed */
- if(ret) {
+ if (ret) {
iter= PyObject_GetIter(ret);
Py_DECREF(ret);
}
@@ -4174,7 +4207,7 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
/* we know this is a list so no need to PyIter_Check
* otherwise it could be NULL (unlikely) if conversion failed */
- if(ret) {
+ if (ret) {
iter= PyObject_GetIter(ret);
Py_DECREF(ret);
}
@@ -4246,7 +4279,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[]= {
* todo - also accept useful args */
static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
{
- if(PyTuple_GET_SIZE(args) == 1) {
+ if (PyTuple_GET_SIZE(args) == 1) {
BPy_StructRNA *base= (BPy_StructRNA *)PyTuple_GET_ITEM(args, 0);
if (Py_TYPE(base) == type) {
Py_INCREF(base);
@@ -4267,7 +4300,7 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
* Keep this since it could be useful.
*/
BPy_StructRNA *ret;
- if((ret= (BPy_StructRNA *)type->tp_alloc(type, 0))) {
+ if ((ret= (BPy_StructRNA *)type->tp_alloc(type, 0))) {
ret->ptr= base->ptr;
}
/* pass on exception & NULL if tp_alloc fails */
@@ -4320,7 +4353,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
int type= RNA_property_type(prop);
int flag= RNA_property_flag(prop);
- if(RNA_property_array_check(prop)) {
+ if (RNA_property_array_check(prop)) {
int a, len;
if (flag & PROP_DYNAMIC) {
@@ -4338,12 +4371,12 @@ 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++)
+ 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++)
+ for (a=0; a<len; a++)
PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int*)data)[a]));
break;
case PROP_FLOAT:
@@ -4353,7 +4386,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
ret= newVectorObject(data, len, Py_NEW, NULL);
break;
case PROP_MATRIX:
- if(len==16) {
+ if (len==16) {
ret= newMatrixObject(data, 4, 4, Py_NEW, NULL);
break;
}
@@ -4365,7 +4398,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
#endif
default:
ret= PyTuple_New(len);
- for(a=0; a<len; a++)
+ for (a=0; a<len; a++)
PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float*)data)[a]));
}
@@ -4402,7 +4435,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
data_ch= *(char **)data;
#ifdef USE_STRING_COERCE
- if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
ret= PyC_UnicodeFromByte(data_ch);
}
else {
@@ -4428,12 +4461,12 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
PointerRNA newptr;
StructRNA *ptype= RNA_property_pointer_type(ptr, prop);
- if(flag & PROP_RNAPTR) {
+ if (flag & PROP_RNAPTR) {
/* in this case we get the full ptr */
newptr= *(PointerRNA*)data;
}
else {
- if(RNA_struct_is_ID(ptype)) {
+ if (RNA_struct_is_ID(ptype)) {
RNA_id_pointer_create(*(void**)data, &newptr);
}
else {
@@ -4462,7 +4495,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
ret= PyList_New(0);
- for(link=lb->first; link; link=link->next) {
+ for (link=lb->first; link; link=link->next) {
linkptr= pyrna_struct_CreatePyObject(&link->ptr);
PyList_Append(ret, linkptr);
Py_DECREF(linkptr);
@@ -4492,8 +4525,8 @@ static PyObject *small_dict_get_item_string(PyObject *dict, const char *key_look
PyObject *value = NULL;
while (PyDict_Next(dict, &pos, &key, &value)) {
- if(PyUnicode_Check(key)) {
- if(strcmp(key_lookup, _PyUnicode_AsString(key))==0) {
+ if (PyUnicode_Check(key)) {
+ if (strcmp(key_lookup, _PyUnicode_AsString(key))==0) {
return value;
}
}
@@ -4529,12 +4562,12 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
/* 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));
@@ -4564,7 +4597,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
parms_len= RNA_parameter_list_arg_count(&parms);
ret_len= 0;
- if(pyargs_len + pykw_len > parms_len) {
+ if (pyargs_len + pykw_len > parms_len) {
RNA_parameter_list_end(&iter);
PyErr_Format(PyExc_TypeError,
"%.200s.%.200s(): takes at most %d arguments, got %d",
@@ -4601,7 +4634,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#else
item= small_dict_get_item_string(kw, RNA_property_identifier(parm)); /* borrow ref */
#endif
- if(item)
+ if (item)
kw_tot++; /* make sure invalid keywords are not given */
kw_arg= TRUE;
@@ -4610,7 +4643,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
i++; /* current argument */
if (item==NULL) {
- if(flag & PROP_REQUIRED) {
+ if (flag & PROP_REQUIRED) {
PyErr_Format(PyExc_TypeError,
"%.200s.%.200s(): required parameter \"%.200s\" not specified",
RNA_struct_identifier(self_ptr->type),
@@ -4625,8 +4658,8 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
}
#ifdef DEBUG_STRING_FREE
- if(item) {
- if(PyUnicode_Check(item)) {
+ if (item) {
+ if (PyUnicode_Check(item)) {
item= PyUnicode_FromString(_PyUnicode_AsString(item));
PyList_Append(string_free_ls, item);
Py_DECREF(item);
@@ -4635,13 +4668,13 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#endif
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),
@@ -4668,7 +4701,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
* the if below is quick, checking if it passed less keyword args then we gave.
* (Dont overwrite the error if we have one, otherwise can skip important messages and confuse with args)
*/
- if(err == 0 && kw && (pykw_len > kw_tot)) {
+ if (err == 0 && kw && (pykw_len > kw_tot)) {
PyObject *key, *value;
Py_ssize_t pos= 0;
@@ -4683,13 +4716,13 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
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)) {
+ for (; iter.valid; RNA_parameter_list_next(&iter)) {
parm= iter.parm;
if (strcmp(arg_name, RNA_property_identifier(parm))==0) {
found= TRUE;
@@ -4699,7 +4732,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
RNA_parameter_list_end(&iter);
- if(found==FALSE) {
+ if (found==FALSE) {
BLI_dynstr_appendf(bad_args, first ? "%s" : ", %s", arg_name);
first= FALSE;
}
@@ -4710,9 +4743,9 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
first= TRUE;
RNA_parameter_list_begin(&parms, &iter);
- for(; iter.valid; RNA_parameter_list_next(&iter)) {
+ for (; iter.valid; RNA_parameter_list_next(&iter)) {
parm= iter.parm;
- if(RNA_property_flag(parm) & PROP_OUTPUT)
+ if (RNA_property_flag(parm) & PROP_OUTPUT)
continue;
BLI_dynstr_appendf(good_args, first ? "%s" : ", %s", RNA_property_identifier(parm));
@@ -4749,7 +4782,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
err= (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE));
/* return value */
- if(err != -1) {
+ if (err != -1) {
if (ret_len > 0) {
if (ret_len > 1) {
ret= PyTuple_New(ret_len);
@@ -4757,7 +4790,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
RNA_parameter_list_begin(&parms, &iter);
- for(; iter.valid; RNA_parameter_list_next(&iter)) {
+ for (; iter.valid; RNA_parameter_list_next(&iter)) {
parm= iter.parm;
flag= RNA_property_flag(parm);
@@ -4771,7 +4804,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single);
/* possible there is an error in conversion */
- if(ret==NULL)
+ if (ret==NULL)
err= -1;
}
}
@@ -4779,7 +4812,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#ifdef DEBUG_STRING_FREE
- // if(PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls));
+ // if (PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls));
Py_DECREF(string_free_ls);
#undef DEBUG_STRING_FREE
#endif
@@ -5515,7 +5548,7 @@ static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self)
static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self)
{
- if(self->iter.valid == FALSE) {
+ if (self->iter.valid == FALSE) {
PyErr_SetString(PyExc_StopIteration, "pyrna_prop_collection_iter stop");
return NULL;
}
@@ -5523,8 +5556,8 @@ static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *
BPy_StructRNA *pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&self->iter.ptr);
#ifdef USE_PYRNA_STRUCT_REFERENCE
- if(pyrna) { /* unlikely but may fail */
- if((PyObject *)pyrna != Py_None) {
+ if (pyrna) { /* unlikely but may fail */
+ if ((PyObject *)pyrna != Py_None) {
/* hold a reference to the iterator since it may have
* allocated memory 'pyrna' needs. eg: introspecting dynamic enum's */
/* TODO, we could have an api call to know if this is needed since most collections don't */
@@ -5598,13 +5631,13 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict
/* get the base type */
base= RNA_struct_base(srna);
- if(base && 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_DECREF(py_base); /* srna owns, this is only to pass as an arg */
}
- if(py_base==NULL) {
+ if (py_base==NULL) {
py_base= (PyObject *)&pyrna_struct_Type;
}
@@ -5620,10 +5653,10 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
const char *idname= RNA_struct_identifier(srna);
PyObject *newclass;
- if(bpy_types_dict==NULL) {
+ 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__);
@@ -5636,27 +5669,27 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
newclass= PyDict_GetItemString(bpy_types_dict, idname);
/* sanity check, could skip this unless in debug mode */
- if(newclass) {
+ 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__);
- 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;
}
- else if(PyTuple_GET_SIZE(tp_bases)) {
+ else if (PyTuple_GET_SIZE(tp_bases)) {
PyObject *base= PyTuple_GET_ITEM(tp_bases, 0);
- if(base_compare != base) {
+ 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;
}
else {
- if(G.f & G_DEBUG)
+ if (G.f & G_DEBUG)
fprintf(stderr, "SRNA Subclassed: '%s'\n", idname);
}
}
@@ -5695,10 +5728,10 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
/* remove __doc__ for now */
// const char *descr= RNA_struct_ui_description(srna);
- // if(!descr) descr= "(no docs)";
+ // if (!descr) descr= "(no docs)";
// "__doc__", descr
- if(RNA_struct_idprops_check(srna) && !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type)) {
+ if (RNA_struct_idprops_check(srna) && !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type)) {
metaclass= (PyObject *)&pyrna_struct_meta_idprop_Type;
}
else {
@@ -5733,7 +5766,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
/* use for subtyping so we know which srna is used for a PointerRNA */
static StructRNA *srna_from_ptr(PointerRNA *ptr)
{
- if(ptr->type == &RNA_Struct) {
+ if (ptr->type == &RNA_Struct) {
return ptr->data;
}
else {
@@ -5772,7 +5805,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
}
}
- if(pyrna == NULL) {
+ if (pyrna == NULL) {
PyErr_SetString(PyExc_MemoryError, "couldn't create bpy_struct object");
return NULL;
}
@@ -5789,7 +5822,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
// PyC_ObSpit("NewStructRNA: ", (PyObject *)pyrna);
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
- if(ptr->id.data) {
+ if (ptr->id.data) {
id_weakref_pool_add(ptr->id.data, (BPy_DummyPointerRNA *)pyrna);
}
#endif
@@ -5807,7 +5840,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
type= &pyrna_prop_Type;
}
else {
- if((RNA_property_flag(prop) & PROP_IDPROPERTY) == 0) {
+ if ((RNA_property_flag(prop) & PROP_IDPROPERTY) == 0) {
type= &pyrna_prop_collection_Type;
}
else {
@@ -5829,7 +5862,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
#endif
}
- if(pyrna == NULL) {
+ if (pyrna == NULL) {
PyErr_SetString(PyExc_MemoryError, "couldn't create BPy_rna object");
return NULL;
}
@@ -5838,7 +5871,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
pyrna->prop= prop;
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
- if(ptr->id.data) {
+ if (ptr->id.data) {
id_weakref_pool_add(ptr->id.data, (BPy_DummyPointerRNA *)pyrna);
}
#endif
@@ -5862,29 +5895,29 @@ void BPY_rna_init(void)
#endif
/* metaclass */
- if(PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0)
+ if (PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0)
return;
- if(PyType_Ready(&pyrna_struct_Type) < 0)
+ if (PyType_Ready(&pyrna_struct_Type) < 0)
return;
- if(PyType_Ready(&pyrna_prop_Type) < 0)
+ if (PyType_Ready(&pyrna_prop_Type) < 0)
return;
- if(PyType_Ready(&pyrna_prop_array_Type) < 0)
+ if (PyType_Ready(&pyrna_prop_array_Type) < 0)
return;
- if(PyType_Ready(&pyrna_prop_collection_Type) < 0)
+ if (PyType_Ready(&pyrna_prop_collection_Type) < 0)
return;
- if(PyType_Ready(&pyrna_prop_collection_idprop_Type) < 0)
+ if (PyType_Ready(&pyrna_prop_collection_idprop_Type) < 0)
return;
- if(PyType_Ready(&pyrna_func_Type) < 0)
+ if (PyType_Ready(&pyrna_func_Type) < 0)
return;
#ifdef USE_PYRNA_ITER
- if(PyType_Ready(&pyrna_prop_collection_iter_Type) < 0)
+ if (PyType_Ready(&pyrna_prop_collection_iter_Type) < 0)
return;
#endif
}
@@ -5906,7 +5939,11 @@ PyObject *BPY_rna_module(void)
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 */
+#endif
}
#if 0
@@ -5933,7 +5970,7 @@ static PyObject *pyrna_basetype_getattro(BPy_BaseTypeRNA *self, PyObject *pyname
PyObject *ret;
const char *name= _PyUnicode_AsString(pyname);
- if(name == NULL) {
+ if (name == NULL) {
PyErr_SetString(PyExc_AttributeError, "bpy.types: __getattr__ must be a string");
ret= NULL;
}
@@ -5979,7 +6016,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
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++) {
+ for (meth=pyrna_basetype_methods; meth->ml_name; meth++) {
name= PyUnicode_FromString(meth->ml_name);
PyList_Append(list, name);
Py_DECREF(name);
@@ -6001,7 +6038,7 @@ PyObject *BPY_rna_types(void)
pyrna_basetype_Type.tp_flags= Py_TPFLAGS_DEFAULT;
pyrna_basetype_Type.tp_methods= pyrna_basetype_methods;
- if(PyType_Ready(&pyrna_basetype_Type) < 0)
+ if (PyType_Ready(&pyrna_basetype_Type) < 0)
return NULL;
}
@@ -6022,26 +6059,26 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr
StructRNA *srna;
/* ack, PyObject_GetAttrString wont look up this types tp_dict first :/ */
- if(PyType_Check(self)) {
+ if (PyType_Check(self)) {
py_srna= (BPy_StructRNA *)PyDict_GetItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna);
Py_XINCREF(py_srna);
}
- if(parent) {
+ 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)
+ 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);
return NULL;
}
- if(!BPy_StructRNA_Check(py_srna)) {
+ if (!BPy_StructRNA_Check(py_srna)) {
PyErr_Format(PyExc_TypeError,
"%.200s, bl_rna attribute wrong type '%.200s' on '%.200s'' instance",
error_prefix, Py_TYPE(py_srna)->tp_name,
@@ -6050,7 +6087,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr
return NULL;
}
- if(py_srna->ptr.type != &RNA_Struct) {
+ if (py_srna->ptr.type != &RNA_Struct) {
PyErr_Format(PyExc_TypeError,
"%.200s, bl_rna attribute not a RNA_Struct, on '%.200s'' instance",
error_prefix, Py_TYPE(self)->tp_name);
@@ -6071,7 +6108,7 @@ 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)) {
@@ -6092,7 +6129,7 @@ StructRNA *srna_from_self(PyObject *self, const char *error_prefix)
srna= pyrna_struct_as_srna(self, 0, error_prefix);
- if(!PyErr_Occurred()) {
+ if (!PyErr_Occurred()) {
PyErr_Restore(error_type, error_value, error_traceback);
}
@@ -6104,14 +6141,14 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
{
/* We only care about results from C which
* are for sure types, save some time with error */
- if(pyrna_is_deferred_prop(item)) {
+ if (pyrna_is_deferred_prop(item)) {
PyObject *py_func, *py_kw, *py_srna_cobject, *py_ret;
- if(PyArg_ParseTuple(item, "OO!", &py_func, &PyDict_Type, &py_kw)) {
+ 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",
@@ -6130,7 +6167,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
Py_DECREF(args_fake); /* free's py_srna_cobject too */
- if(py_ret) {
+ if (py_ret) {
Py_DECREF(py_ret);
}
else {
@@ -6168,12 +6205,12 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
/* 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++) {
+ 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);
item= PyDict_GetItem(class_dict, key);
ret= deferred_register_prop(srna, key, item);
- if(ret != 0)
+ if (ret != 0)
break;
}
}
@@ -6181,7 +6218,7 @@ static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
while (PyDict_Next(class_dict, &pos, &key, &item)) {
ret= deferred_register_prop(srna, key, item);
- if(ret != 0)
+ if (ret != 0)
break;
}
}
@@ -6195,7 +6232,7 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
int i, ret;
/* first scan base classes for registerable properties */
- for(i=0; i<len; 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,
@@ -6207,12 +6244,12 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
* So only scan base classes which are not subclasses if blender types.
* This best fits having 'mix-in' classes for operators and render engines.
* */
- if( py_superclass != &PyBaseObject_Type &&
+ if (py_superclass != &PyBaseObject_Type &&
!PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type)
) {
ret= pyrna_deferred_register_class_recursive(srna, py_superclass);
- if(ret != 0) {
+ if (ret != 0) {
return ret;
}
}
@@ -6226,7 +6263,7 @@ int pyrna_deferred_register_class(StructRNA *srna, PyObject *py_class)
{
/* Panels and Menus dont need this
* save some time and skip the checks here */
- if(!RNA_struct_idprops_register_check(srna))
+ if (!RNA_struct_idprops_register_check(srna))
return 0;
return pyrna_deferred_register_class_recursive(srna, (PyTypeObject *)py_class);
@@ -6241,9 +6278,9 @@ static int rna_function_arg_count(FunctionRNA *func)
Link *link;
int count= (RNA_function_flag(func) & FUNC_NO_SELF) ? 0 : 1;
- for(link=lb->first; link; link=link->next) {
+ for (link=lb->first; link; link=link->next) {
parm= (PropertyRNA*)link;
- if(!(RNA_property_flag(parm) & PROP_OUTPUT))
+ if (!(RNA_property_flag(parm) & PROP_OUTPUT))
count++;
}
@@ -6277,11 +6314,11 @@ 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) {
+ for (link=lb->first; link; link=link->next) {
func= (FunctionRNA*)link;
flag= RNA_function_flag(func);
- if(!(flag & FUNC_REGISTER))
+ if (!(flag & FUNC_REGISTER))
continue;
item= PyObject_GetAttrString(py_class, RNA_function_identifier(func));
@@ -6302,7 +6339,7 @@ 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 (flag & FUNC_NO_SELF) {
if (PyMethod_Check(item)==0) {
PyErr_Format(PyExc_TypeError,
"expected %.200s, %.200s class \"%.200s\" attribute to be a method, not a %.200s",
@@ -6327,7 +6364,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
/* note, the number of args we check for and the number of args we give to
* @classmethods are different (quirk of python), this is why rna_function_arg_count() doesn't return the value -1*/
- if(flag & FUNC_NO_SELF)
+ if (flag & FUNC_NO_SELF)
func_arg_count++;
if (arg_count != func_arg_count) {
@@ -6343,12 +6380,12 @@ 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) {
+ for (link=lb->first; link; link=link->next) {
const char *identifier;
prop= (PropertyRNA*)link;
flag= RNA_property_flag(prop);
- if(!(flag & PROP_REGISTER))
+ if (!(flag & PROP_REGISTER))
continue;
identifier= RNA_property_identifier(prop);
@@ -6358,10 +6395,10 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
/* 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) { \
+ if (strcmp(identifier, rna_attr) == 0) { \
item= PyObject_GetAttrString(py_class, py_attr); \
- if(item && item != Py_None) { \
- if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { \
+ if (item && item != Py_None) { \
+ if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { \
Py_DECREF(item); \
return -1; \
} \
@@ -6387,7 +6424,7 @@ 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 */
- if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0)
+ if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0)
return -1;
}
}
@@ -6426,7 +6463,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
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;
@@ -6434,7 +6471,7 @@ 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)
+ if (C==NULL)
C= BPy_GetContext();
is_valid_wm= (CTX_wm_manager(C) != NULL);
@@ -6443,11 +6480,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if (!is_static) {
/* some datatypes (operator, render engine) can store PyObjects for re-use */
- if(ptr->data) {
+ if (ptr->data) {
void **instance = RNA_struct_instance(ptr);
- if(instance) {
- if(*instance) {
+ if (instance) {
+ if (*instance) {
py_class_instance= *instance;
Py_INCREF(py_class_instance);
}
@@ -6459,16 +6496,16 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
}
/* end exception */
- if(py_class_instance==NULL)
+ if (py_class_instance==NULL)
py_srna= pyrna_struct_CreatePyObject(ptr);
- if(py_class_instance) {
+ if (py_class_instance) {
/* special case, instance is cached */
}
- else if(py_srna == NULL) {
+ else if (py_srna == NULL) {
py_class_instance= NULL;
}
- else if(py_srna == Py_None) { /* probably wont ever happen but possible */
+ else if (py_srna == Py_None) { /* probably wont ever happen but possible */
Py_DECREF(py_srna);
py_class_instance= NULL;
}
@@ -6478,7 +6515,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
* otherwise __init__() always needs to take a second self argument, see pyrna_struct_new().
* Although this is annoying to have to impliment a part of pythons typeobject.c:type_call().
*/
- if(py_class->tp_init) {
+ 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__ */
@@ -6519,10 +6556,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
#endif
- if(py_class_instance == NULL) {
+ if (py_class_instance == NULL) {
err= -1; /* so the error is not overridden below */
}
- else if(py_class_instance_store) {
+ else if (py_class_instance_store) {
*py_class_instance_store= py_class_instance;
Py_INCREF(py_class_instance);
}
@@ -6533,12 +6570,12 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
PyObject *item= PyObject_GetAttrString((PyObject *)py_class, RNA_function_identifier(func));
// flag= RNA_function_flag(func);
- if(item) {
+ if (item) {
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
args= PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */
- if(is_static) {
+ if (is_static) {
i= 0;
}
else {
@@ -6597,7 +6634,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
}
else {
/* the error may be already set if the class instance couldn't be created */
- if(err != -1) {
+ if (err != -1) {
PyErr_Format(PyExc_RuntimeError,
"could not create instance of %.200s to call callback function %.200s",
RNA_struct_identifier(ptr->type), RNA_function_identifier(func));
@@ -6609,30 +6646,30 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
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;
}
- else if(ret_len==1) {
+ 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,
* re-raise the exception with more info since it would be slow to
* create prefix on every call (when there are no errors) */
- if(err == -1) {
+ if (err == -1) {
PyC_Err_Format_Prefix(PyExc_RuntimeError,
"class %.200s, function %.200s: incompatible return value ",
- RNA_struct_identifier(ptr->type), RNA_function_identifier(func)
+ RNA_struct_identifier(ptr->type), RNA_function_identifier(func)
);
}
}
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),
@@ -6658,8 +6695,9 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
/* 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, PyTuple_GET_ITEM(ret, i++), "calling class function:");
- if(err)
+ if (err) {
break;
+ }
}
}
@@ -6669,7 +6707,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
Py_DECREF(ret);
}
- if(err != 0) {
+ if (err != 0) {
ReportList *reports;
/* alert the user, else they wont know unless they see the console. */
if ( (!is_static) &&
@@ -6709,12 +6747,12 @@ static void bpy_class_free(void *pyob_ptr)
//
// remove the rna attribute instead.
PyDict_DelItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna);
- if(PyErr_Occurred())
+ if (PyErr_Occurred())
PyErr_Clear();
#if 0 /* needs further investigation, too annoying so quiet for now */
- if(G.f&G_DEBUG) {
- if(self->ob_refcnt > 1) {
+ if (G.f&G_DEBUG) {
+ if (self->ob_refcnt > 1) {
PyC_ObSpit("zombie class - ref should be 1", self);
}
}
@@ -6739,8 +6777,8 @@ void pyrna_alloc_types(void)
RNA_PROP_BEGIN(&ptr, itemptr, prop) {
PyObject *item= pyrna_struct_Subtype(&itemptr);
- if(item == NULL) {
- if(PyErr_Occurred()) {
+ if (item == NULL) {
+ if (PyErr_Occurred()) {
PyErr_Print();
PyErr_Clear();
}
@@ -6769,7 +6807,7 @@ void pyrna_free_types(void)
StructRNA *srna= srna_from_ptr(&itemptr);
void *py_ptr= RNA_struct_py_type_get(srna);
- if(py_ptr) {
+ if (py_ptr) {
#if 0 // XXX - should be able to do this but makes python crash on exit
bpy_class_free(py_ptr);
#endif
@@ -6816,19 +6854,19 @@ 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)
+ if (srna==NULL)
return NULL;
/* fails in cases, cant use this check but would like to :| */
/*
- if(RNA_struct_py_type_get(srna)) {
+ 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));
@@ -6839,7 +6877,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
/* check that we have a register callback for this type */
reg= RNA_struct_register(srna);
- if(!reg) {
+ if (!reg) {
PyErr_Format(PyExc_ValueError,
"register_class(...): expected a subclass of a registerable "
"rna type (%.200s does not support registration)",
@@ -6857,18 +6895,18 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
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)
+ if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
/* python errors validating are not converted into reports so the check above will fail.
* the cause for returning NULL will be printed as an error */
- if(srna_new == NULL)
+ if (srna_new == NULL)
return NULL;
pyrna_subtype_set_rna(py_class, srna_new); /* takes a ref to py_class */
/* old srna still references us, keep the check incase registering somehow can free it */
- if(RNA_struct_py_type_get(srna)) {
+ if (RNA_struct_py_type_get(srna)) {
RNA_struct_py_type_set(srna, NULL);
// Py_DECREF(py_class); // should be able to do this XXX since the old rna adds a new ref.
}
@@ -6877,17 +6915,17 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
*
* 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);
- if(py_cls_meth == NULL) {
+ if (py_cls_meth == NULL) {
PyErr_Clear();
}
else {
PyObject *ret= PyObject_CallObject(py_cls_meth, NULL);
- if(ret) {
+ if (ret) {
Py_DECREF(ret);
}
else {
@@ -6907,13 +6945,13 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN
/* verify properties */
const ListBase *lb= RNA_struct_type_properties(srna);
- for(link=lb->first; link; link=link->next) {
+ for (link=lb->first; link; link=link->next) {
prop= (PropertyRNA*)link;
- if(RNA_property_type(prop) == PROP_POINTER && !(RNA_property_flag(prop) & PROP_BUILTIN)) {
+ 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) {
+ if (RNA_property_pointer_type(&tptr, prop) == srna) {
*prop_identifier= RNA_property_identifier(prop);
return 1;
}
@@ -6939,32 +6977,32 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
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)
+ if (srna==NULL)
return NULL;
/* check that we have a unregister callback for this type */
unreg= RNA_struct_unregister(srna);
- if(!unreg) {
+ if (!unreg) {
PyErr_SetString(PyExc_ValueError, "unregister_class(...): expected a Type subclassed from a registerable rna type (no unregister supported)");
return NULL;
}
/* call classed unregister method */
py_cls_meth= PyObject_GetAttr(py_class, bpy_intern_str_unregister);
- if(py_cls_meth == NULL) {
+ if (py_cls_meth == NULL) {
PyErr_Clear();
}
else {
PyObject *ret= PyObject_CallObject(py_cls_meth, NULL);
- if(ret) {
+ if (ret) {
Py_DECREF(ret);
}
else {
@@ -6973,7 +7011,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
}
/* should happen all the time but very slow */
- if(G.f & G_DEBUG) {
+ if (G.f & G_DEBUG) {
/* remove all properties using this class */
StructRNA *srna_iter;
PointerRNA ptr_rna;
@@ -6988,13 +7026,13 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
/* loop over all structs */
RNA_PROP_BEGIN(&ptr_rna, itemptr, prop_rna) {
srna_iter= itemptr.data;
- if(pyrna_srna_contains_pointer_prop_srna(srna_iter, srna, &prop_identifier)) {
+ if (pyrna_srna_contains_pointer_prop_srna(srna_iter, srna, &prop_identifier)) {
break;
}
}
RNA_PROP_END;
- if(prop_identifier) {
+ if (prop_identifier) {
PyErr_Format(PyExc_RuntimeError,
"unregister_class(...): can't unregister %s because %s.%s pointer property is using this",
RNA_struct_identifier(srna), RNA_struct_identifier(srna_iter), prop_identifier);
@@ -7009,7 +7047,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
unreg(CTX_data_main(C), srna); /* calls bpy_class_free, this decref's py_class */
PyDict_DelItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna);
- if(PyErr_Occurred())
+ if (PyErr_Occurred())
PyErr_Clear(); //return NULL;
Py_RETURN_NONE;
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 8bde1db96ca..00b20f0599c 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -70,18 +70,18 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
}
/* full paths can only be given from ID base */
- if(is_idbase) {
+ if (is_idbase) {
int r_index= -1;
- if(RNA_path_resolve_full(ptr, path, &r_ptr, &prop, &r_index)==0) {
+ if (RNA_path_resolve_full(ptr, path, &r_ptr, &prop, &r_index)==0) {
prop= NULL;
}
- else if(r_index != -1) {
+ else if (r_index != -1) {
PyErr_Format(PyExc_ValueError,
"%.200s path includes index, must be a separate argument",
error_prefix, path);
return -1;
}
- else if(ptr->id.data != r_ptr.id.data) {
+ else if (ptr->id.data != r_ptr.id.data) {
PyErr_Format(PyExc_ValueError,
"%.200s path spans ID blocks",
error_prefix, path);
@@ -107,8 +107,8 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
return -1;
}
- if(RNA_property_array_check(prop) == 0) {
- if((*index) == -1) {
+ if (RNA_property_array_check(prop) == 0) {
+ if ((*index) == -1) {
*index= 0;
}
else {
@@ -120,7 +120,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
}
else {
int array_len= RNA_property_array_length(&r_ptr, prop);
- if((*index) < -1 || (*index) >= array_len) {
+ if ((*index) < -1 || (*index) >= array_len) {
PyErr_Format(PyExc_TypeError,
"%.200s index out of range \"%s\", given %d, array length is %d",
error_prefix, path, *index, array_len);
@@ -128,7 +128,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
}
}
- if(is_idbase) {
+ if (is_idbase) {
*path_full= BLI_strdup(path);
}
else {
@@ -156,10 +156,10 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, PyObject
if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name))
return -1;
- if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
+ if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0)
return -1;
- if(*cfra==FLT_MAX)
+ if (*cfra==FLT_MAX)
*cfra= CTX_data_scene(BPy_GetContext())->r.cfra;
return 0; /* success */
@@ -189,9 +189,9 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
float cfra= FLT_MAX;
const char *group_name= NULL;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
- if(pyrna_struct_keyframe_parse(&self->ptr, args, kw,
+ if (pyrna_struct_keyframe_parse(&self->ptr, args, kw,
"s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()",
&path_full, &index, &cfra, &group_name) == -1)
{
@@ -206,7 +206,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
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)
+ if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
return PyBool_FromLong(result);
@@ -237,9 +237,9 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
float cfra= FLT_MAX;
const char *group_name= NULL;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
- if(pyrna_struct_keyframe_parse(&self->ptr, args, kw,
+ if (pyrna_struct_keyframe_parse(&self->ptr, args, kw,
"s|ifs:bpy_struct.keyframe_delete()",
"bpy_struct.keyframe_insert()",
&path_full, &index, &cfra, &group_name) == -1)
@@ -255,7 +255,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
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)
+ if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
return PyBool_FromLong(result);
@@ -273,19 +273,19 @@ char pyrna_struct_driver_add_doc[] =
" :arg index: array index of the property drive. Defaults to -1 for all indices or a single channel if the property is not an array.\n"
" :type index: int\n"
" :return: The driver(s) added.\n"
-" :rtype: :class:`FCurve` or list if index is -1 with an array property.\n"
+" :rtype: :class:`bpy.types.FCurve` or list if index is -1 with an array property.\n"
;
PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
{
const char *path, *path_full;
int index= -1;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index))
return NULL;
- if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) < 0) {
+ if (pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) < 0) {
return NULL;
}
else {
@@ -297,10 +297,10 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
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)
+ if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
- if(result) {
+ if (result) {
ID *id= self->ptr.id.data;
AnimData *adt= BKE_animdata_from_id(id);
FCurve *fcu;
@@ -308,10 +308,10 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
PointerRNA tptr;
PyObject *item;
- if(index == -1) { /* all, use a list */
+ if (index == -1) { /* all, use a list */
int i= 0;
ret= PyList_New(0);
- while((fcu= list_find_fcurve(&adt->drivers, path_full, i++))) {
+ while ((fcu= list_find_fcurve(&adt->drivers, path_full, i++))) {
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
item= pyrna_struct_CreatePyObject(&tptr);
PyList_Append(ret, item);
@@ -356,12 +356,12 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
const char *path, *path_full;
int index= -1;
- PYRNA_STRUCT_CHECK_OBJ(self)
+ PYRNA_STRUCT_CHECK_OBJ(self);
if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index))
return NULL;
- if(pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) < 0) {
+ if (pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) < 0) {
return NULL;
}
else {
@@ -374,7 +374,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
MEM_freeN((void *)path_full);
- if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
+ if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
return NULL;
WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION|ND_FCURVES_ORDER, NULL);
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index cab57724d6d..24ecad85d14 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -67,7 +67,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
if (dim + 1 < totdim) {
/* check that a sequence contains dimsize[dim] items */
const Py_ssize_t seq_size= PySequence_Size(seq);
- if(seq_size == -1) {
+ 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;
@@ -77,7 +77,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
int ok= 1;
item= PySequence_GetItem(seq, i);
- if(item == NULL) {
+ 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;
@@ -112,7 +112,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
else {
/* check that items are of correct type */
const int seq_size= PySequence_Size(seq);
- if(seq_size == -1) {
+ 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;
@@ -120,7 +120,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);
- if(item == NULL) {
+ if (item == NULL) {
PyErr_Format(PyExc_TypeError, "%s sequence type '%s' failed to retrieve index %d",
error_prefix, Py_TYPE(seq)->tp_name, i);
return -1;
@@ -146,15 +146,15 @@ static int count_items(PyObject *seq, int dim)
{
int totitem= 0;
- if(dim > 1) {
+ if (dim > 1) {
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);
- if(item) {
+ if (item) {
const int tot= count_items(item, dim - 1);
Py_DECREF(item);
- if(tot != -1) {
+ if (tot != -1) {
totitem += tot;
}
else {
@@ -184,7 +184,7 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
totdim= RNA_property_array_dimension(ptr, prop, dimsize);
tot= count_items(rvalue, totdim - lvalue_dim);
- if(tot == -1) {
+ if (tot == -1) {
PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, error validating the sequence length",
error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
return -1;
@@ -294,13 +294,13 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int
/* Note that 'data can be NULL' */
- if(seq_size == -1) {
+ if (seq_size == -1) {
return NULL;
}
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);
- if(item) {
+ if (item) {
if (dim + 1 < totdim) {
data= copy_values(item, ptr, prop, dim + 1, data, item_size, index, convert_item, rna_set_index);
}
@@ -334,7 +334,7 @@ static int py_to_array(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, char *
if (totitem) {
/* note: this code is confusing */
- if(param_data && RNA_property_flag(prop) & PROP_DYNAMIC) {
+ 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;
@@ -351,7 +351,7 @@ static int py_to_array(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, char *
/* 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 (copy_values(seq, ptr, prop, 0, data, item_size, NULL, convert_item, NULL) != NULL) {
if (param_data==NULL) {
/* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */
rna_set_array(ptr, prop, data);
@@ -396,8 +396,8 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, i
index += arrayoffset;
- if(lvalue_dim == totdim) { /* single item, assign directly */
- if(!check_item_type(py)) {
+ if (lvalue_dim == totdim) { /* single item, assign directly */
+ if (!check_item_type(py)) {
PyErr_Format(PyExc_TypeError, "%s %.200s.%.200s, expected a %s type, not %s",
error_prefix, RNA_struct_identifier(ptr->type),
RNA_property_identifier(prop), item_type_str,
@@ -628,7 +628,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
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) {
@@ -642,7 +642,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
case PROP_FLOAT:
{
float value_f= PyFloat_AsDouble(value);
- if(value_f==-1 && PyErr_Occurred()) {
+ if (value_f==-1 && PyErr_Occurred()) {
PyErr_Clear();
return 0;
}
@@ -650,7 +650,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
float tmp[32];
float *tmp_arr;
- if(len * sizeof(float) > sizeof(tmp)) {
+ if (len * sizeof(float) > sizeof(tmp)) {
tmp_arr= PyMem_MALLOC(len * sizeof(float));
}
else {
@@ -659,11 +659,13 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
RNA_property_float_get_array(ptr, prop, tmp_arr);
- for(i=0; i<len; i++)
- if(tmp_arr[i] == value_f)
+ for (i=0; i<len; i++) {
+ if (tmp_arr[i] == value_f) {
break;
+ }
+ }
- if(tmp_arr != tmp)
+ if (tmp_arr != tmp)
PyMem_FREE(tmp_arr);
return i<len ? 1 : 0;
@@ -674,7 +676,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
case PROP_INT:
{
int value_i= PyLong_AsSsize_t(value);
- if(value_i==-1 && PyErr_Occurred()) {
+ if (value_i==-1 && PyErr_Occurred()) {
PyErr_Clear();
return 0;
}
@@ -682,23 +684,25 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
int tmp[32];
int *tmp_arr;
- if(len * sizeof(int) > sizeof(tmp)) {
+ if (len * sizeof(int) > sizeof(tmp)) {
tmp_arr= PyMem_MALLOC(len * sizeof(int));
}
else {
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++)
- if(tmp_arr[i] == value_i)
+ for (i=0; i<len; i++) {
+ if (tmp_arr[i] == value_i) {
break;
+ }
+ }
- if(tmp_arr != tmp)
+ if (tmp_arr != tmp)
PyMem_FREE(tmp_arr);
return i<len ? 1 : 0;
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index 747a876d6df..9c4eea2f6af 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -114,19 +114,19 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
PyErr_Fetch(&exception, &value, (PyObject **)&tb);
- if(exception && PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) {
+ if (exception && PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) {
/* no traceback available when SyntaxError.
* python has no api's to this. reference parse_syntax_error() from pythonrun.c */
PyErr_NormalizeException(&exception, &value, (PyObject **)&tb);
PyErr_Restore(exception, value, (PyObject *)tb); /* takes away reference! */
- if(value) { /* should always be true */
+ if (value) { /* should always be true */
PyObject *message;
const char *filename, *text;
- if(parse_syntax_error(value, &message, &filename, lineno, offset, &text)) {
+ if (parse_syntax_error(value, &message, &filename, lineno, offset, &text)) {
/* python adds a '/', prefix, so check for both */
- if( (strcmp(filename, filepath) == 0) ||
+ if ((strcmp(filename, filepath) == 0) ||
((filename[0] == '\\' || filename[0] == '/') && strcmp(filename + 1, filepath) == 0)
) {
/* good */
@@ -145,13 +145,13 @@ 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"); tb && (PyObject *)tb != Py_None; tb= tb->tb_next) {
+ for (tb= (PyTracebackObject *)PySys_GetObject("last_traceback"); tb && (PyObject *)tb != Py_None; tb= tb->tb_next) {
PyObject *coerce;
const char *tb_filepath= traceback_filepath(tb, &coerce);
const int match= strcmp(tb_filepath, filepath) != 0;
Py_DECREF(coerce);
- if(match) {
+ if (match) {
*lineno= tb->tb_lineno;
break;
}
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 1450621d59e..516a9e49a39 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -48,7 +48,7 @@ char *BPy_enum_as_string(EnumPropertyItem *item)
char *cstring;
for (e= item; item->identifier; item++) {
- if(item->identifier[0])
+ if (item->identifier[0])
BLI_dynstr_appendf(dynstr, (e==item)?"'%s'":", '%s'", item->identifier);
}
@@ -63,11 +63,11 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short
report_str= BKE_reports_string(reports, RPT_ERROR);
- if(clear) {
+ if (clear) {
BKE_reports_clear(reports);
}
- if(report_str) {
+ if (report_str) {
PyErr_SetString(exception, report_str);
MEM_freeN(report_str);
}
@@ -89,7 +89,7 @@ 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;
@@ -97,13 +97,13 @@ short BPy_errors_to_report(ReportList *reports)
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)
+ if (filename==NULL)
filename= "<unknown location>";
cstring= _PyUnicode_AsString(pystring);
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 8fa6a7b0629..b4363716d86 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -77,7 +77,7 @@ PyInit_gpu(void)
PyObject* m;
m = PyModule_Create(&gpumodule);
- if(m == NULL)
+ if (m == NULL)
return NULL;
// device constants
@@ -164,7 +164,7 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
static const char *kwlist[] = {"scene", "material", NULL};
- if(!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat))
return NULL;
if (!strcmp(Py_TYPE(pyscene)->tp_name, "Scene") &&
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 9adeae9dc29..34575a8d886 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -49,14 +49,14 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max
int i, size;
/* non list/tuple cases */
- if(!(value_fast=PySequence_Fast(value, error_prefix))) {
+ 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 (size > array_max || size < array_min) {
if (array_max == array_min) {
PyErr_Format(PyExc_ValueError,
"%.200s: sequence size is %d, expected %d",
@@ -74,7 +74,7 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max
i= size;
do {
i--;
- if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
+ if (((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError,
"%.200s: sequence index %d expected a number, "
"found '%.200s' type, ",
@@ -82,7 +82,7 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max
Py_DECREF(value_fast);
return -1;
}
- } while(i);
+ } while (i);
Py_XDECREF(value_fast);
return size;
@@ -94,16 +94,16 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
#if 1 /* approx 6x speedup for mathutils types */
int size;
- if( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) ||
+ 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) {
+ if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
}
- if(size > array_max || size < array_min) {
+ if (size > array_max || size < array_min) {
if (array_max == array_min) {
PyErr_Format(PyExc_ValueError,
"%.200s: sequence size is %d, expected %d",
@@ -129,8 +129,8 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix)
{
- if(EulerObject_Check(value)) {
- if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
+ if (EulerObject_Check(value)) {
+ if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
}
else {
@@ -139,7 +139,7 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
}
}
else if (QuaternionObject_Check(value)) {
- if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
+ if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
}
else {
@@ -150,10 +150,10 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
}
}
else if (MatrixObject_Check(value)) {
- if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
+ if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
return -1;
}
- else if(((MatrixObject *)value)->col_size < 3 || ((MatrixObject *)value)->row_size < 3) {
+ else if (((MatrixObject *)value)->col_size < 3 || ((MatrixObject *)value)->row_size < 3) {
PyErr_Format(PyExc_ValueError,
"%.200s: matrix must have minimum 3x3 dimensions",
error_prefix);
@@ -202,7 +202,7 @@ 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;
}
@@ -220,8 +220,8 @@ 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;
}
@@ -233,10 +233,10 @@ int Mathutils_RegisterCallback(Mathutils_Callback *cb)
int _BaseMathObject_ReadCallback(BaseMathObject *self)
{
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
- if(cb->get(self, self->cb_subtype) != -1)
+ if (cb->get(self, self->cb_subtype) != -1)
return 0;
- if(!PyErr_Occurred()) {
+ if (!PyErr_Occurred()) {
PyErr_Format(PyExc_RuntimeError,
"%s read, user has become invalid",
Py_TYPE(self)->tp_name);
@@ -247,10 +247,10 @@ int _BaseMathObject_ReadCallback(BaseMathObject *self)
int _BaseMathObject_WriteCallback(BaseMathObject *self)
{
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
- if(cb->set(self, self->cb_subtype) != -1)
+ if (cb->set(self, self->cb_subtype) != -1)
return 0;
- if(!PyErr_Occurred()) {
+ if (!PyErr_Occurred()) {
PyErr_Format(PyExc_RuntimeError,
"%s write, user has become invalid",
Py_TYPE(self)->tp_name);
@@ -261,10 +261,10 @@ int _BaseMathObject_WriteCallback(BaseMathObject *self)
int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
{
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
- if(cb->get_index(self, self->cb_subtype, index) != -1)
+ if (cb->get_index(self, self->cb_subtype, index) != -1)
return 0;
- if(!PyErr_Occurred()) {
+ if (!PyErr_Occurred()) {
PyErr_Format(PyExc_RuntimeError,
"%s read index, user has become invalid",
Py_TYPE(self)->tp_name);
@@ -275,10 +275,10 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
{
Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
- if(cb->set_index(self, self->cb_subtype, index) != -1)
+ if (cb->set_index(self, self->cb_subtype, index) != -1)
return 0;
- if(!PyErr_Occurred()) {
+ if (!PyErr_Occurred()) {
PyErr_Format(PyExc_RuntimeError,
"%s write index, user has become invalid",
Py_TYPE(self)->tp_name);
@@ -316,11 +316,11 @@ int BaseMathObject_clear(BaseMathObject *self)
void BaseMathObject_dealloc(BaseMathObject *self)
{
/* only free non wrapped */
- if(self->wrapped != Py_WRAP) {
+ if (self->wrapped != Py_WRAP) {
PyMem_Free(self->data);
}
- if(self->cb_user) {
+ if (self->cb_user) {
PyObject_GC_UnTrack(self);
BaseMathObject_clear(self);
}
@@ -350,15 +350,15 @@ PyMODINIT_FUNC PyInit_mathutils(void)
PyObject *submodule;
PyObject *item;
- if(PyType_Ready(&vector_Type) < 0)
+ if (PyType_Ready(&vector_Type) < 0)
return NULL;
- if(PyType_Ready(&matrix_Type) < 0)
+ if (PyType_Ready(&matrix_Type) < 0)
return NULL;
- if(PyType_Ready(&euler_Type) < 0)
+ if (PyType_Ready(&euler_Type) < 0)
return NULL;
- if(PyType_Ready(&quaternion_Type) < 0)
+ if (PyType_Ready(&quaternion_Type) < 0)
return NULL;
- if(PyType_Ready(&color_Type) < 0)
+ if (PyType_Ready(&color_Type) < 0)
return NULL;
submodule = PyModule_Create(&M_Mathutils_module_def);
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index d0c7ec72cea..f7cc1d4271a 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -42,7 +42,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
float col[3]= {0.0f, 0.0f, 0.0f};
- if(kwds && PyDict_Size(kwds)) {
+ if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
"mathutils.Color(): "
"takes no keyword args");
@@ -53,7 +53,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
case 0:
break;
case 1:
- if((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1)
+ if ((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1)
return NULL;
break;
default:
@@ -75,13 +75,13 @@ static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits)
ret= PyTuple_New(COLOR_SIZE);
- if(ndigits >= 0) {
- for(i= 0; i < COLOR_SIZE; i++) {
+ if (ndigits >= 0) {
+ 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]));
}
}
@@ -102,7 +102,7 @@ PyDoc_STRVAR(Color_copy_doc,
);
static PyObject *Color_copy(ColorObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return newColorObject(self->col, Py_NEW, Py_TYPE(self));
@@ -115,7 +115,7 @@ static PyObject *Color_repr(ColorObject * self)
{
PyObject *ret, *tuple;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
tuple= Color_ToTupleExt(self, -1);
@@ -137,7 +137,7 @@ static PyObject* Color_richcmpr(PyObject *a, PyObject *b, int op)
ColorObject *colA= (ColorObject*)a;
ColorObject *colB= (ColorObject*)b;
- if(BaseMath_ReadCallback(colA) == -1 || BaseMath_ReadCallback(colB) == -1)
+ if (BaseMath_ReadCallback(colA) == -1 || BaseMath_ReadCallback(colB) == -1)
return NULL;
ok= EXPP_VectorsAreEqual(colA->col, colB->col, COLOR_SIZE, 1) ? 0 : -1;
@@ -175,16 +175,16 @@ static int Color_len(ColorObject *UNUSED(self))
//sequence accessor (get)
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) {
+ if (i < 0 || i >= COLOR_SIZE) {
PyErr_SetString(PyExc_IndexError,
"color[attribute]: "
"array index out of range");
return NULL;
}
- if(BaseMath_ReadIndexCallback(self, i) == -1)
+ if (BaseMath_ReadIndexCallback(self, i) == -1)
return NULL;
return PyFloat_FromDouble(self->col[i]);
@@ -196,16 +196,16 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value)
{
float f = PyFloat_AsDouble(value);
- if(f == -1 && PyErr_Occurred()) { // parsed item not a number
+ if (f == -1 && PyErr_Occurred()) { // parsed item not a number
PyErr_SetString(PyExc_TypeError,
"color[attribute] = x: "
"argument not a number");
return -1;
}
- if(i<0) i= COLOR_SIZE-i;
+ if (i<0) i= COLOR_SIZE-i;
- if(i < 0 || i >= COLOR_SIZE){
+ if (i < 0 || i >= COLOR_SIZE) {
PyErr_SetString(PyExc_IndexError, "color[attribute] = x: "
"array assignment index out of range");
return -1;
@@ -213,7 +213,7 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value)
self->col[i] = f;
- if(BaseMath_WriteIndexCallback(self, i) == -1)
+ if (BaseMath_WriteIndexCallback(self, i) == -1)
return -1;
return 0;
@@ -225,7 +225,7 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end)
PyObject *tuple;
int count;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
CLAMP(begin, 0, COLOR_SIZE);
@@ -234,7 +234,7 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end)
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
- for(count= begin; count < end; count++) {
+ for (count= begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->col[count]));
}
@@ -247,7 +247,7 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
int i, size;
float col[COLOR_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
CLAMP(begin, 0, COLOR_SIZE);
@@ -255,17 +255,17 @@ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq)
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)){
+ if (size != (end - begin)) {
PyErr_SetString(PyExc_ValueError,
"color[begin:end] = []: "
"size mismatch in slice assignment");
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);
@@ -379,7 +379,7 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2)
color1 = (ColorObject*)v1;
color2 = (ColorObject*)v2;
- if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
add_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
@@ -401,7 +401,7 @@ static PyObject *Color_iadd(PyObject *v1, PyObject *v2)
color1 = (ColorObject*)v1;
color2 = (ColorObject*)v2;
- if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
add_vn_vn(color1->col, color2->col, COLOR_SIZE);
@@ -426,7 +426,7 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2)
color1 = (ColorObject*)v1;
color2 = (ColorObject*)v2;
- if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
sub_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE);
@@ -448,7 +448,7 @@ static PyObject *Color_isub(PyObject *v1, PyObject *v2)
color1 = (ColorObject*)v1;
color2 = (ColorObject*)v2;
- if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
+ if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
return NULL;
sub_vn_vn(color1->col, color2->col, COLOR_SIZE);
@@ -473,12 +473,12 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
if ColorObject_Check(v1) {
color1= (ColorObject *)v1;
- if(BaseMath_ReadCallback(color1) == -1)
+ if (BaseMath_ReadCallback(color1) == -1)
return NULL;
}
if ColorObject_Check(v2) {
color2= (ColorObject *)v2;
- if(BaseMath_ReadCallback(color2) == -1)
+ if (BaseMath_ReadCallback(color2) == -1)
return NULL;
}
@@ -515,7 +515,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2)
if ColorObject_Check(v1) {
color1= (ColorObject *)v1;
- if(BaseMath_ReadCallback(color1) == -1)
+ if (BaseMath_ReadCallback(color1) == -1)
return NULL;
}
else {
@@ -526,7 +526,7 @@ 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==0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError,
"Color division: divide by zero error");
return NULL;
@@ -547,7 +547,7 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2)
ColorObject *color = (ColorObject *)v1;
float scalar;
- if(BaseMath_ReadCallback(color) == -1)
+ if (BaseMath_ReadCallback(color) == -1)
return NULL;
/* only support color *= float */
@@ -572,12 +572,12 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
ColorObject *color = (ColorObject *)v1;
float scalar;
- if(BaseMath_ReadCallback(color) == -1)
+ if (BaseMath_ReadCallback(color) == -1)
return NULL;
/* only support color /= float */
if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR /= FLOAT */
- if(scalar==0.0f) {
+ if (scalar==0.0f) {
PyErr_SetString(PyExc_ZeroDivisionError,
"Color division: divide by zero error");
return NULL;
@@ -603,7 +603,7 @@ static PyObject *Color_neg(ColorObject *self)
{
float tcol[COLOR_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
negate_vn_vn(tcol, self->col, COLOR_SIZE);
@@ -665,7 +665,7 @@ static PyObject *Color_getChannelHSV(ColorObject * self, void *type)
float hsv[3];
int i= GET_INT_FROM_POINTER(type);
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2]));
@@ -679,14 +679,14 @@ static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type)
int i= GET_INT_FROM_POINTER(type);
float f = PyFloat_AsDouble(value);
- if(f == -1 && PyErr_Occurred()) {
+ if (f == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"color.h/s/v = value: "
"argument not a number");
return -1;
}
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2]));
@@ -694,7 +694,7 @@ static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type)
hsv[i] = f;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], &(self->col[0]), &(self->col[1]), &(self->col[2]));
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return -1;
return 0;
@@ -706,7 +706,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure))
float hsv[3];
PyObject *ret;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
rgb_to_hsv(self->col[0], self->col[1], self->col[2], &(hsv[0]), &(hsv[1]), &(hsv[2]));
@@ -722,7 +722,7 @@ static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closur
{
float hsv[3];
- if(mathutils_array_parse(hsv, 3, 3, value, "mathutils.Color.hsv = value") == -1)
+ if (mathutils_array_parse(hsv, 3, 3, value, "mathutils.Color.hsv = value") == -1)
return -1;
CLAMP(hsv[0], 0.0f, 1.0f);
@@ -731,7 +731,7 @@ static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closur
hsv_to_rgb(hsv[0], hsv[1], hsv[2], &(self->col[0]), &(self->col[1]), &(self->col[2]));
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return -1;
return 0;
@@ -834,11 +834,11 @@ PyObject *newColorObject(float *col, int type, PyTypeObject *base_type)
self->cb_user= NULL;
self->cb_type= self->cb_subtype= 0;
- if(type == Py_WRAP){
+ if(type == Py_WRAP) {
self->col = col;
self->wrapped = Py_WRAP;
}
- else if (type == Py_NEW){
+ else if (type == Py_NEW) {
self->col = PyMem_Malloc(COLOR_SIZE * sizeof(float));
if(col)
copy_v3_v3(self->col, col);
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index c96eafcd6ad..d9f741d841a 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -50,21 +50,21 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f};
short order= EULER_ORDER_XYZ;
- if(kwds && PyDict_Size(kwds)) {
+ if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
"mathutils.Euler(): "
"takes no keyword args");
return NULL;
}
- if(!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str))
+ if (!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str))
return NULL;
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:
@@ -84,7 +84,7 @@ static const char *euler_order_str(EulerObject *self)
short euler_order_from_string(const char *str, const char *error_prefix)
{
- if((str[0] && str[1] && str[2] && str[3]=='\0')) {
+ 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;
@@ -109,13 +109,13 @@ static PyObject *Euler_ToTupleExt(EulerObject *self, int ndigits)
ret= PyTuple_New(EULER_SIZE);
- if(ndigits >= 0) {
- for(i= 0; i < EULER_SIZE; i++) {
+ if (ndigits >= 0) {
+ 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]));
}
}
@@ -138,7 +138,7 @@ static PyObject *Euler_to_quaternion(EulerObject * self)
{
float quat[4];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
eulO_to_quat(quat, self->eul, self->order);
@@ -159,7 +159,7 @@ static PyObject *Euler_to_matrix(EulerObject * self)
{
float mat[9];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
eulO_to_mat3((float (*)[3])mat, self->eul, self->order);
@@ -176,7 +176,7 @@ static PyObject *Euler_zero(EulerObject * self)
{
zero_v3(self->eul);
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return NULL;
Py_RETURN_NONE;
@@ -198,21 +198,21 @@ 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, &angle)) {
PyErr_SetString(PyExc_TypeError,
"Euler.rotate_axis(): "
"expected an axis 'X', 'Y', 'Z' and an angle (float)");
return NULL;
}
- if(!(ELEM3(axis, 'X', 'Y', 'Z'))){
+ if (!(ELEM3(axis, 'X', 'Y', 'Z'))) {
PyErr_SetString(PyExc_ValueError,
"Euler.rotate_axis(): "
"expected axis to be 'X', 'Y' or 'Z'");
return NULL;
}
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
@@ -235,10 +235,10 @@ static PyObject *Euler_rotate(EulerObject * self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_any_to_rotmat(other_rmat, value, "euler.rotate(value)") == -1)
+ if (mathutils_any_to_rotmat(other_rmat, value, "euler.rotate(value)") == -1)
return NULL;
eulO_to_mat3(self_rmat, self->eul, self->order);
@@ -262,10 +262,10 @@ static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
{
float teul[EULER_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value, "euler.make_compatible(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value, "euler.make_compatible(other), invalid 'other' arg") == -1)
return NULL;
compatible_eul(self->eul, teul);
@@ -291,7 +291,7 @@ PyDoc_STRVAR(Euler_copy_doc,
);
static PyObject *Euler_copy(EulerObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return newEulerObject(self->eul, self->order, Py_NEW, Py_TYPE(self));
@@ -304,7 +304,7 @@ static PyObject *Euler_repr(EulerObject * self)
{
PyObject *ret, *tuple;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
tuple= Euler_ToTupleExt(self, -1);
@@ -324,7 +324,7 @@ static PyObject* Euler_richcmpr(PyObject *a, PyObject *b, int op)
EulerObject *eulA= (EulerObject*)a;
EulerObject *eulB= (EulerObject*)b;
- if(BaseMath_ReadCallback(eulA) == -1 || BaseMath_ReadCallback(eulB) == -1)
+ 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;
@@ -362,16 +362,16 @@ static int Euler_len(EulerObject *UNUSED(self))
//sequence accessor (get)
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) {
+ if (i < 0 || i >= EULER_SIZE) {
PyErr_SetString(PyExc_IndexError,
"euler[attribute]: "
"array index out of range");
return NULL;
}
- if(BaseMath_ReadIndexCallback(self, i) == -1)
+ if (BaseMath_ReadIndexCallback(self, i) == -1)
return NULL;
return PyFloat_FromDouble(self->eul[i]);
@@ -383,16 +383,16 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
{
float f = PyFloat_AsDouble(value);
- if(f == -1 && PyErr_Occurred()) { // parsed item not a number
+ if (f == -1 && PyErr_Occurred()) { // parsed item not a number
PyErr_SetString(PyExc_TypeError,
"euler[attribute] = x: "
"argument not a number");
return -1;
}
- if(i<0) i= EULER_SIZE-i;
+ if (i<0) i= EULER_SIZE-i;
- if(i < 0 || i >= EULER_SIZE){
+ if (i < 0 || i >= EULER_SIZE) {
PyErr_SetString(PyExc_IndexError,
"euler[attribute] = x: "
"array assignment index out of range");
@@ -401,7 +401,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
self->eul[i] = f;
- if(BaseMath_WriteIndexCallback(self, i) == -1)
+ if (BaseMath_WriteIndexCallback(self, i) == -1)
return -1;
return 0;
@@ -413,7 +413,7 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end)
PyObject *tuple;
int count;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
CLAMP(begin, 0, EULER_SIZE);
@@ -422,7 +422,7 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end)
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
- for(count = begin; count < end; count++) {
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->eul[count]));
}
@@ -435,7 +435,7 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
int i, size;
float eul[EULER_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
CLAMP(begin, 0, EULER_SIZE);
@@ -443,17 +443,17 @@ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq)
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)){
+ if (size != (end - begin)) {
PyErr_SetString(PyExc_ValueError,
"euler[begin:end] = []: "
"size mismatch in slice assignment");
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);
@@ -566,7 +566,7 @@ static int Euler_setAxis(EulerObject *self, PyObject *value, void *type)
/* rotation order */
static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure))
{
- if(BaseMath_ReadCallback(self) == -1) /* can read order too */
+ if (BaseMath_ReadCallback(self) == -1) /* can read order too */
return NULL;
return PyUnicode_FromString(euler_order_str(self));
@@ -577,7 +577,7 @@ static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closu
const char *order_str= _PyUnicode_AsString(value);
short order= euler_order_from_string(order_str, "euler.order");
- if(order == -1)
+ if (order == -1)
return -1;
self->order= order;
@@ -678,18 +678,18 @@ PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_t
self= base_type ? (EulerObject *)base_type->tp_alloc(base_type, 0) :
(EulerObject *)PyObject_GC_New(EulerObject, &euler_Type);
- if(self) {
+ if (self) {
/* init callbacks as NULL */
self->cb_user= NULL;
self->cb_type= self->cb_subtype= 0;
- if(type == Py_WRAP) {
+ if (type == Py_WRAP) {
self->eul = eul;
self->wrapped = Py_WRAP;
}
else if (type == Py_NEW) {
self->eul = PyMem_Malloc(EULER_SIZE * sizeof(float));
- if(eul) {
+ if (eul) {
copy_v3_v3(self->eul, eul);
}
else {
@@ -711,7 +711,7 @@ PyObject *newEulerObject(float *eul, short order, int type, PyTypeObject *base_t
PyObject *newEulerObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype)
{
EulerObject *self= (EulerObject *)newEulerObject(NULL, order, Py_NEW, NULL);
- if(self) {
+ if (self) {
Py_INCREF(cb_user);
self->cb_user= cb_user;
self->cb_type= (unsigned char)cb_type;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index a2a15600965..b1700aa53c6 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -55,10 +55,10 @@ static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype)
MatrixObject *self= (MatrixObject *)bmo->cb_user;
int i;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
- for(i=0; i < self->col_size; i++)
+ for (i=0; i < self->col_size; i++)
bmo->data[i]= self->matrix[subtype][i];
return 0;
@@ -69,10 +69,10 @@ static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype)
MatrixObject *self= (MatrixObject *)bmo->cb_user;
int i;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
- for(i=0; i < self->col_size; i++)
+ for (i=0; i < self->col_size; i++)
self->matrix[subtype][i]= bmo->data[i];
(void)BaseMath_WriteCallback(self);
@@ -83,7 +83,7 @@ static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int subtype, i
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
bmo->data[index]= self->matrix[subtype][index];
@@ -94,7 +94,7 @@ static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, i
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
self->matrix[subtype][index]= bmo->data[index];
@@ -117,7 +117,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = {
//create a new matrix type
static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- if(kwds && PyDict_Size(kwds)) {
+ if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
"Matrix(): "
"takes no keyword args");
@@ -134,15 +134,15 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
/* -1 is an error, size checks will accunt for this */
const unsigned short row_size= PySequence_Size(arg);
- if(row_size >= 2 && row_size <= 4) {
+ if (row_size >= 2 && row_size <= 4) {
PyObject *item= PySequence_GetItem(arg, 0);
const unsigned short col_size= PySequence_Size(item);
Py_XDECREF(item);
- if(col_size >= 2 && col_size <= 4) {
+ if (col_size >= 2 && col_size <= 4) {
/* sane row & col size, new matrix and assign as slice */
PyObject *matrix= newMatrixObject(NULL, row_size, col_size, Py_NEW, type);
- if(Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
+ if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
return matrix;
}
else { /* matrix ok, slice assignment not */
@@ -164,7 +164,7 @@ static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObjec
{
PyObject *ret= Matrix_copy(self);
PyObject *ret_dummy= matrix_func(ret);
- if(ret_dummy) {
+ if (ret_dummy) {
Py_DECREF(ret_dummy);
return (PyObject *)ret;
}
@@ -214,16 +214,16 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
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)) {
+ 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");
return NULL;
}
- if(vec && PyUnicode_Check(vec)) {
+ 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') {
+ 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 "
@@ -238,19 +238,19 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
angle= angle_wrap_rad(angle);
- if(matSize != 2 && matSize != 3 && matSize != 4) {
+ if (matSize != 2 && matSize != 3 && matSize != 4) {
PyErr_SetString(PyExc_ValueError,
"Matrix.Rotation(): "
"can only return a 2x2 3x3 or 4x4 matrix");
return NULL;
}
- if(matSize == 2 && (vec != NULL)) {
+ if (matSize == 2 && (vec != NULL)) {
PyErr_SetString(PyExc_ValueError,
"Matrix.Rotation(): "
"cannot create a 2x2 rotation matrix around arbitrary axis");
return NULL;
}
- if((matSize == 3 || matSize == 4) && (axis == NULL) && (vec == NULL)) {
+ if ((matSize == 3 || matSize == 4) && (axis == NULL) && (vec == NULL)) {
PyErr_SetString(PyExc_ValueError,
"Matrix.Rotation(): "
"axis of rotation for 3d and 4d matrices is required");
@@ -258,7 +258,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
}
/* check for valid vector/axis above */
- if(vec) {
+ if (vec) {
float tvec[3];
if (mathutils_array_parse(tvec, 3, 3, vec, "Matrix.Rotation(angle, size, axis), invalid 'axis' arg") == -1)
@@ -281,7 +281,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
single_axis_angle_to_mat3((float (*)[3])mat, axis[0], angle);
}
- if(matSize == 4) {
+ if (matSize == 4) {
matrix_3x3_as_4x4(mat);
}
//pass to matrix creation
@@ -337,23 +337,23 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
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)) {
+ if (!PyArg_ParseTuple(args, "fi|O:Matrix.Scale", &factor, &matSize, &vec)) {
return NULL;
}
- if(matSize != 2 && matSize != 3 && matSize != 4) {
+ if (matSize != 2 && matSize != 3 && matSize != 4) {
PyErr_SetString(PyExc_ValueError,
"Matrix.Scale(): "
"can only return a 2x2 3x3 or 4x4 matrix");
return NULL;
}
- if(vec) {
+ 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) {
+ if (mathutils_array_parse(tvec, vec_size, vec_size, vec, "Matrix.Scale(factor, size, axis), invalid 'axis' arg") == -1) {
return NULL;
}
}
- if(vec == NULL) { //scaling along axis
- if(matSize == 2) {
+ if (vec == NULL) { //scaling along axis
+ if (matSize == 2) {
mat[0] = factor;
mat[3] = factor;
}
@@ -367,14 +367,14 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
//normalize arbitrary axis
float norm = 0.0f;
int x;
- for(x = 0; x < vec_size; x++) {
+ for (x = 0; x < vec_size; x++) {
norm += tvec[x] * tvec[x];
}
norm = (float) sqrt(norm);
- for(x = 0; x < vec_size; x++) {
+ for (x = 0; x < vec_size; x++) {
tvec[x] /= norm;
}
- if(matSize == 2) {
+ if (matSize == 2) {
mat[0] = 1 + ((factor - 1) *(tvec[0] * tvec[0]));
mat[1] = ((factor - 1) *(tvec[0] * tvec[1]));
mat[2] = ((factor - 1) *(tvec[0] * tvec[1]));
@@ -392,7 +392,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
mat[8] = 1 + ((factor - 1) *(tvec[2] * tvec[2]));
}
}
- if(matSize == 4) {
+ if (matSize == 4) {
matrix_3x3_as_4x4(mat);
}
//pass to matrix creation
@@ -423,21 +423,21 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
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)) {
+ if (!PyArg_ParseTuple(args, "Oi:Matrix.OrthoProjection", &axis, &matSize)) {
return NULL;
}
- if(matSize != 2 && matSize != 3 && matSize != 4) {
+ if (matSize != 2 && matSize != 3 && matSize != 4) {
PyErr_SetString(PyExc_ValueError,
"Matrix.OrthoProjection(): "
"can only return a 2x2 3x3 or 4x4 matrix");
return NULL;
}
- if(PyUnicode_Check(axis)) { //ortho projection onto cardinal plane
+ if (PyUnicode_Check(axis)) { //ortho projection onto cardinal plane
Py_ssize_t plane_len;
const char *plane= _PyUnicode_AsStringAndSize(axis, &plane_len);
- if(matSize == 2) {
- if(plane_len == 1 && plane[0]=='X') {
+ if (matSize == 2) {
+ if (plane_len == 1 && plane[0]=='X') {
mat[0]= 1.0f;
}
else if (plane_len == 1 && plane[0]=='Y') {
@@ -452,7 +452,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
}
}
else {
- if(plane_len == 2 && plane[0]=='X' && plane[1]=='Y') {
+ if (plane_len == 2 && plane[0]=='X' && plane[1]=='Y') {
mat[0]= 1.0f;
mat[4]= 1.0f;
}
@@ -479,25 +479,25 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
int vec_size= (matSize == 2 ? 2 : 3);
float tvec[4];
- if(mathutils_array_parse(tvec, vec_size, vec_size, axis, "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1) {
+ if (mathutils_array_parse(tvec, vec_size, vec_size, axis, "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1) {
return NULL;
}
//normalize arbitrary axis
- for(x = 0; x < vec_size; x++) {
+ for (x = 0; x < vec_size; x++) {
norm += tvec[x] * tvec[x];
}
norm = (float) sqrt(norm);
- for(x = 0; x < vec_size; x++) {
+ for (x = 0; x < vec_size; x++) {
tvec[x] /= norm;
}
- if(matSize == 2) {
+ if (matSize == 2) {
mat[0] = 1 - (tvec[0] * tvec[0]);
mat[1] = -(tvec[0] * tvec[1]);
mat[2] = -(tvec[0] * tvec[1]);
mat[3] = 1 - (tvec[1] * tvec[1]);
}
- else if(matSize > 2) {
+ else if (matSize > 2) {
mat[0] = 1 - (tvec[0] * tvec[0]);
mat[1] = -(tvec[0] * tvec[1]);
mat[2] = -(tvec[0] * tvec[2]);
@@ -509,7 +509,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
mat[8] = 1 - (tvec[2] * tvec[2]);
}
}
- if(matSize == 4) {
+ if (matSize == 4) {
matrix_3x3_as_4x4(mat);
}
//pass to matrix creation
@@ -540,20 +540,20 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
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)) {
+ if (!PyArg_ParseTuple(args, "siO:Matrix.Shear", &plane, &matSize, &fac)) {
return NULL;
}
- if(matSize != 2 && matSize != 3 && matSize != 4) {
+ if (matSize != 2 && matSize != 3 && matSize != 4) {
PyErr_SetString(PyExc_ValueError,
"Matrix.Shear(): "
"can only return a 2x2 3x3 or 4x4 matrix");
return NULL;
}
- if(matSize == 2) {
+ if (matSize == 2) {
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");
@@ -564,10 +564,10 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
mat[0] = 1.0f;
mat[3] = 1.0f;
- if(strcmp(plane, "X") == 0) {
+ if (strcmp(plane, "X") == 0) {
mat[2] = factor;
}
- else if(strcmp(plane, "Y") == 0) {
+ else if (strcmp(plane, "Y") == 0) {
mat[1] = factor;
}
else {
@@ -581,7 +581,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
/* 3 or 4, apply as 3x3, resize later if needed */
float factor[2];
- if(mathutils_array_parse(factor, 2, 2, fac, "Matrix.Shear()") < 0) {
+ if (mathutils_array_parse(factor, 2, 2, fac, "Matrix.Shear()") < 0) {
return NULL;
}
@@ -590,15 +590,15 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
mat[4] = 1.0f;
mat[8] = 1.0f;
- if(strcmp(plane, "XY") == 0) {
+ if (strcmp(plane, "XY") == 0) {
mat[6] = factor[0];
mat[7] = factor[1];
}
- else if(strcmp(plane, "XZ") == 0) {
+ else if (strcmp(plane, "XZ") == 0) {
mat[3] = factor[0];
mat[5] = factor[1];
}
- else if(strcmp(plane, "YZ") == 0) {
+ else if (strcmp(plane, "YZ") == 0) {
mat[1] = factor[0];
mat[2] = factor[1];
}
@@ -610,7 +610,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
}
}
- if(matSize == 4) {
+ if (matSize == 4) {
matrix_3x3_as_4x4(mat);
}
//pass to matrix creation
@@ -627,11 +627,11 @@ void matrix_as_3x3(float mat[3][3], MatrixObject *self)
/* assumes rowsize == colsize is checked and the read callback has run */
static float matrix_determinant_internal(MatrixObject *self)
{
- if(self->row_size == 2) {
+ if (self->row_size == 2) {
return determinant_m2(self->matrix[0][0], self->matrix[0][1],
self->matrix[1][0], self->matrix[1][1]);
}
- else if(self->row_size == 3) {
+ 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],
@@ -657,17 +657,17 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self)
{
float quat[4];
- if(BaseMath_ReadCallback(self) == -1)
+ 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)) {
+ if ((self->col_size < 3) || (self->row_size < 3) || (self->col_size != self->row_size)) {
PyErr_SetString(PyExc_ValueError,
"Matrix.to_quat(): "
"inappropriate matrix size - expects 3x3 or 4x4 matrix");
return NULL;
}
- if(self->col_size == 3){
+ if (self->col_size == 3) {
mat3_to_quat(quat, (float (*)[3])self->contigPtr);
}
else {
@@ -704,21 +704,21 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
float tmat[3][3];
float (*mat)[3];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat))
+ if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat))
return NULL;
- if(eul_compat) {
- if(BaseMath_ReadCallback(eul_compat) == -1)
+ if (eul_compat) {
+ if (BaseMath_ReadCallback(eul_compat) == -1)
return NULL;
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) {
+ if (self->col_size ==3 && self->row_size ==3) {
mat= (float (*)[3])self->contigPtr;
}
else if (self->col_size ==4 && self->row_size ==4) {
@@ -732,19 +732,19 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
return NULL;
}
- if(order_str) {
+ if (order_str) {
order= euler_order_from_string(order_str, "Matrix.to_euler()");
- if(order == -1)
+ if (order == -1)
return NULL;
}
- if(eul_compat) {
- if(order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat);
+ if (eul_compat) {
+ if (order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat);
else mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
}
else {
- if(order == 1) mat3_to_eul(eul, mat);
+ if (order == 1) mat3_to_eul(eul, mat);
else mat3_to_eulO(eul, order, mat);
}
@@ -760,13 +760,13 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
{
int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
- 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");
return NULL;
}
- if(self->cb_user){
+ if (self->cb_user) {
PyErr_SetString(PyExc_TypeError,
"Matrix.resize_4x4(): "
"cannot resize owned data - make a copy and resize that");
@@ -774,21 +774,21 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
}
self->contigPtr = PyMem_Realloc(self->contigPtr, (sizeof(float) * 16));
- if(self->contigPtr == NULL) {
+ if (self->contigPtr == NULL) {
PyErr_SetString(PyExc_MemoryError,
"Matrix.resize_4x4(): "
"problem allocating pointer space");
return NULL;
}
/*set row pointers*/
- for(x = 0; x < 4; x++) {
+ 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++){
+ 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){
+ if (index == 10 || index == 15) {
self->contigPtr[index] = 1.0f;
}
else {
@@ -796,14 +796,14 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
}
}
}
- for(x = 1; x <= self->row_size; x++){
+ 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--){
+ 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--){
+ for ( ; curr_pos >= first_row_elem; curr_pos--) {
self->contigPtr[new_pos] = self->contigPtr[curr_pos];
new_pos--;
}
@@ -824,13 +824,13 @@ PyDoc_STRVAR(Matrix_to_4x4_doc,
);
static PyObject *Matrix_to_4x4(MatrixObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(self->col_size==4 && self->row_size==4) {
+ if (self->col_size==4 && self->row_size==4) {
return (PyObject *)newMatrixObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
}
- else if(self->col_size==3 && self->row_size==3) {
+ else if (self->col_size==3 && self->row_size==3) {
float mat[4][4];
copy_m4_m3(mat, (float (*)[3])self->contigPtr);
return (PyObject *)newMatrixObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
@@ -855,10 +855,10 @@ static PyObject *Matrix_to_3x3(MatrixObject *self)
{
float mat[3][3];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if((self->col_size < 3) || (self->row_size < 3)) {
+ if ((self->col_size < 3) || (self->row_size < 3)) {
PyErr_SetString(PyExc_TypeError,
"Matrix.to_3x3(): inappropriate matrix size");
return NULL;
@@ -879,10 +879,10 @@ PyDoc_STRVAR(Matrix_to_translation_doc,
);
static PyObject *Matrix_to_translation(MatrixObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if((self->col_size < 3) || self->row_size < 4){
+ if ((self->col_size < 3) || self->row_size < 4) {
PyErr_SetString(PyExc_TypeError,
"Matrix.to_translation(): "
"inappropriate matrix size");
@@ -908,11 +908,11 @@ static PyObject *Matrix_to_scale(MatrixObject *self)
float mat[3][3];
float size[3];
- if(BaseMath_ReadCallback(self) == -1)
+ 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)) {
+ if ((self->col_size < 3) || (self->row_size < 3)) {
PyErr_SetString(PyExc_TypeError,
"Matrix.to_scale(): "
"inappropriate matrix size, 3x3 minimum size");
@@ -945,10 +945,10 @@ static PyObject *Matrix_invert(MatrixObject *self)
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(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(self->row_size != self->col_size){
+ if (self->row_size != self->col_size) {
PyErr_SetString(PyExc_TypeError,
"Matrix.invert(ed): "
"only square matrices are supported");
@@ -958,25 +958,25 @@ static PyObject *Matrix_invert(MatrixObject *self)
/*calculate the determinant*/
det = matrix_determinant_internal(self);
- if(det != 0) {
+ if (det != 0) {
/*calculate the classical adjoint*/
- if(self->row_size == 2) {
+ 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];
- } else if(self->row_size == 3) {
+ } else if (self->row_size == 3) {
adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->contigPtr);
- } else if(self->row_size == 4) {
+ } else if (self->row_size == 4) {
adjoint_m4_m4((float (*)[4]) mat, (float (*)[4])self->contigPtr);
}
/*divide by determinate*/
- for(x = 0; x < (self->row_size * self->col_size); x++) {
+ for (x = 0; x < (self->row_size * self->col_size); x++) {
mat[x] /= det;
}
/*set values*/
- for(x = 0; x < self->row_size; x++) {
- for(y = 0; y < self->col_size; y++) {
+ for (x = 0; x < self->row_size; x++) {
+ for (y = 0; y < self->col_size; y++) {
self->matrix[x][y] = mat[z];
z++;
}
@@ -1024,13 +1024,13 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_any_to_rotmat(other_rmat, value, "matrix.rotate(value)") == -1)
+ 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->col_size != 3 || self->row_size != 3) {
PyErr_SetString(PyExc_TypeError,
"Matrix.rotate(): "
"must have 3x3 dimensions");
@@ -1063,14 +1063,14 @@ static PyObject *Matrix_decompose(MatrixObject *self)
float quat[4];
float size[3];
- if(self->col_size != 4 || self->row_size != 4) {
+ if (self->col_size != 4 || self->row_size != 4) {
PyErr_SetString(PyExc_TypeError,
"Matrix.decompose(): "
"inappropriate matrix size - expects 4x4 matrix");
return NULL;
}
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
mat4_to_loc_rot_size(loc, rot, size, (float (*)[4])self->contigPtr);
@@ -1103,21 +1103,21 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
MatrixObject *mat2 = NULL;
float fac, mat[MATRIX_MAX_DIM*MATRIX_MAX_DIM];
- if(!PyArg_ParseTuple(args, "O!f:lerp", &matrix_Type, &mat2, &fac))
+ 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->row_size != mat2->row_size || self->col_size != mat2->col_size) {
PyErr_SetString(PyExc_ValueError,
"Matrix.lerp(): "
"expects both matrix objects of the same dimensions");
return NULL;
}
- if(BaseMath_ReadCallback(self) == -1 || BaseMath_ReadCallback(mat2) == -1)
+ if (BaseMath_ReadCallback(self) == -1 || BaseMath_ReadCallback(mat2) == -1)
return NULL;
/* TODO, different sized matrix */
- if(self->row_size==4 && self->col_size==4) {
+ if (self->row_size==4 && self->col_size==4) {
blend_m4_m4m4((float (*)[4])mat, (float (*)[4])self->contigPtr, (float (*)[4])mat2->contigPtr, fac);
}
else if (self->row_size==3 && self->col_size==3) {
@@ -1146,10 +1146,10 @@ PyDoc_STRVAR(Matrix_determinant_doc,
);
static PyObject *Matrix_determinant(MatrixObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(self->row_size != self->col_size){
+ if (self->row_size != self->col_size) {
PyErr_SetString(PyExc_TypeError,
"Matrix.determinant(): "
"only square matrices are supported");
@@ -1170,21 +1170,21 @@ static PyObject *Matrix_transpose(MatrixObject *self)
{
float t = 0.0f;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(self->row_size != self->col_size){
+ if (self->row_size != self->col_size) {
PyErr_SetString(PyExc_TypeError,
"Matrix.transpose(d): "
"only square matrices are supported");
return NULL;
}
- if(self->row_size == 2) {
+ if (self->row_size == 2) {
t = self->matrix[1][0];
self->matrix[1][0] = self->matrix[0][1];
self->matrix[0][1] = t;
- } else if(self->row_size == 3) {
+ } else if (self->row_size == 3) {
transpose_m3((float (*)[3])self->contigPtr);
}
else {
@@ -1221,7 +1221,7 @@ static PyObject *Matrix_zero(MatrixObject *self)
{
fill_vn(self->contigPtr, self->row_size * self->col_size, 0.0f);
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return NULL;
Py_RETURN_NONE;
@@ -1239,29 +1239,29 @@ PyDoc_STRVAR(Matrix_identity_doc,
);
static PyObject *Matrix_identity(MatrixObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(self->row_size != self->col_size){
+ if (self->row_size != self->col_size) {
PyErr_SetString(PyExc_TypeError,
"Matrix.identity(): "
"only square matrices are supported");
return NULL;
}
- if(self->row_size == 2) {
+ 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;
- } else if(self->row_size == 3) {
+ } else if (self->row_size == 3) {
unit_m3((float (*)[3])self->contigPtr);
}
else {
unit_m4((float (*)[4])self->contigPtr);
}
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return NULL;
Py_RETURN_NONE;
@@ -1278,7 +1278,7 @@ PyDoc_STRVAR(Matrix_copy_doc,
);
static PyObject *Matrix_copy(MatrixObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return (PyObject*)newMatrixObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
@@ -1291,12 +1291,12 @@ static PyObject *Matrix_repr(MatrixObject *self)
int x, y;
PyObject *rows[MATRIX_MAX_DIM]= {NULL};
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- for(x = 0; x < self->row_size; x++){
+ for (x = 0; x < self->row_size; x++) {
rows[x]= PyTuple_New(self->col_size);
- for(y = 0; y < self->col_size; y++) {
+ for (y = 0; y < self->col_size; y++) {
PyTuple_SET_ITEM(rows[x], y, PyFloat_FromDouble(self->matrix[x][y]));
}
}
@@ -1327,7 +1327,7 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op)
MatrixObject *matA= (MatrixObject*)a;
MatrixObject *matB= (MatrixObject*)b;
- if(BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1)
+ if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1)
return NULL;
ok= ( (matA->col_size == matB->col_size) &&
@@ -1369,10 +1369,10 @@ static int Matrix_len(MatrixObject *self)
the wrapped vector gives direct access to the matrix data*/
static PyObject *Matrix_item(MatrixObject *self, int i)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(i < 0 || i >= self->row_size) {
+ if (i < 0 || i >= self->row_size) {
PyErr_SetString(PyExc_IndexError,
"matrix[attribute]: "
"array index out of range");
@@ -1386,16 +1386,16 @@ static PyObject *Matrix_item(MatrixObject *self, int i)
static int Matrix_ass_item(MatrixObject *self, int i, PyObject *value)
{
float vec[4];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
- if(i >= self->row_size || i < 0){
+ if (i >= self->row_size || i < 0) {
PyErr_SetString(PyExc_IndexError,
"matrix[attribute] = x: bad column");
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->col_size, self->col_size, value, "matrix[i] = value assignment") < 0) {
return -1;
}
@@ -1413,7 +1413,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
PyObject *tuple;
int count;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
CLAMP(begin, 0, self->row_size);
@@ -1421,7 +1421,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
- for(count= begin; count < end; count++) {
+ for (count= begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin,
newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count));
@@ -1435,7 +1435,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
{
PyObject *value_fast= NULL;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
CLAMP(begin, 0, self->row_size);
@@ -1443,7 +1443,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
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;
}
@@ -1452,7 +1452,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
int i;
float mat[16];
- if(PySequence_Fast_GET_SIZE(value_fast) != size) {
+ if (PySequence_Fast_GET_SIZE(value_fast) != size) {
Py_DECREF(value_fast);
PyErr_SetString(PyExc_ValueError,
"matrix[begin:end] = []: "
@@ -1465,7 +1465,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
/*parse each sub sequence*/
PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i);
- if(mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item, "matrix[begin:end] = value assignment") < 0) {
+ if (mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item, "matrix[begin:end] = value assignment") < 0) {
return -1;
}
}
@@ -1489,17 +1489,17 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
mat1 = (MatrixObject*)m1;
mat2 = (MatrixObject*)m2;
- if(!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
+ if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
PyErr_SetString(PyExc_TypeError,
"Matrix addition: "
"arguments not valid for this operation");
return NULL;
}
- if(BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1)
+ 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->row_size != mat2->row_size || mat1->col_size != mat2->col_size) {
PyErr_SetString(PyExc_TypeError,
"Matrix addition: "
"matrices must have the same dimensions for this operation");
@@ -1520,17 +1520,17 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
mat1 = (MatrixObject*)m1;
mat2 = (MatrixObject*)m2;
- if(!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
+ if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
PyErr_SetString(PyExc_TypeError,
"Matrix addition: "
"arguments not valid for this operation");
return NULL;
}
- if(BaseMath_ReadCallback(mat1) == -1 || BaseMath_ReadCallback(mat2) == -1)
+ 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->row_size != mat2->row_size || mat1->col_size != mat2->col_size) {
PyErr_SetString(PyExc_TypeError,
"Matrix addition: "
"matrices must have the same dimensions for this operation");
@@ -1556,18 +1556,18 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
MatrixObject *mat1 = NULL, *mat2 = NULL;
- if(MatrixObject_Check(m1)) {
+ if (MatrixObject_Check(m1)) {
mat1 = (MatrixObject*)m1;
- if(BaseMath_ReadCallback(mat1) == -1)
+ if (BaseMath_ReadCallback(mat1) == -1)
return NULL;
}
- if(MatrixObject_Check(m2)) {
+ if (MatrixObject_Check(m2)) {
mat2 = (MatrixObject*)m2;
- if(BaseMath_ReadCallback(mat2) == -1)
+ if (BaseMath_ReadCallback(mat2) == -1)
return NULL;
}
- if(mat1 && mat2) {
+ if (mat1 && mat2) {
/*MATRIX * MATRIX*/
float mat[16]= {0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
@@ -1576,9 +1576,9 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
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++) {
+ 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]);
}
mat[((x * mat1->col_size) + y)] = (float)dot;
@@ -1588,20 +1588,20 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
return newMatrixObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1));
}
- else if(mat2) {
+ else if (mat2) {
/*FLOAT/INT * MATRIX */
if (((scalar= PyFloat_AsDouble(m1)) == -1.0f && PyErr_Occurred())==0) {
return matrix_mul_float(mat2, scalar);
}
}
- else if(mat1) {
+ else if (mat1) {
/*VEC * MATRIX */
- if(VectorObject_Check(m2)) {
+ if (VectorObject_Check(m2)) {
VectorObject *vec2= (VectorObject *)m2;
float tvec[4];
- if(BaseMath_ReadCallback(vec2) == -1)
+ if (BaseMath_ReadCallback(vec2) == -1)
return NULL;
- if(column_vector_multiplication(tvec, vec2, mat1) == -1) {
+ if (column_vector_multiplication(tvec, vec2, mat1) == -1) {
return NULL;
}
@@ -1624,7 +1624,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
}
static PyObject* Matrix_inv(MatrixObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return Matrix_invert(self);
@@ -1771,11 +1771,11 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur
{
float mat[3][3];
- if(BaseMath_ReadCallback(self) == -1)
+ 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)) {
+ if ((self->col_size < 3) || (self->row_size < 3)) {
PyErr_SetString(PyExc_AttributeError,
"Matrix.median_scale: "
"inappropriate matrix size, 3x3 minimum");
@@ -1789,13 +1789,13 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur
static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure))
{
- if(BaseMath_ReadCallback(self) == -1)
+ 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)
+ 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)
+ else if (self->col_size == 3 && self->row_size == 3)
return PyBool_FromLong(is_negative_m3((float (*)[3])self->contigPtr));
else {
PyErr_SetString(PyExc_AttributeError,
@@ -1807,13 +1807,13 @@ static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure
static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure))
{
- if(BaseMath_ReadCallback(self) == -1)
+ 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)
+ 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)
+ else if (self->col_size == 3 && self->row_size == 3)
return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->contigPtr));
else {
PyErr_SetString(PyExc_AttributeError,
@@ -1953,7 +1953,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign
int x, row, col;
/*matrix objects can be any 2-4row x 2-4col matrix*/
- if(rowSize < 2 || rowSize > 4 || colSize < 2 || colSize > 4) {
+ if (rowSize < 2 || rowSize > 4 || colSize < 2 || colSize > 4) {
PyErr_SetString(PyExc_RuntimeError,
"Matrix(): "
"row and column sizes must be between 2 and 4");
@@ -1963,7 +1963,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign
self= base_type ? (MatrixObject *)base_type->tp_alloc(base_type, 0) :
(MatrixObject *)PyObject_GC_New(MatrixObject, &matrix_Type);
- if(self) {
+ if (self) {
self->row_size = rowSize;
self->col_size = colSize;
@@ -1971,30 +1971,30 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign
self->cb_user= NULL;
self->cb_type= self->cb_subtype= 0;
- if(type == Py_WRAP){
+ if (type == Py_WRAP) {
self->contigPtr = mat;
/*pointer array points to contigous memory*/
- for(x = 0; x < rowSize; x++) {
+ for (x = 0; x < rowSize; x++) {
self->matrix[x] = self->contigPtr + (x * colSize);
}
self->wrapped = Py_WRAP;
}
- else if (type == Py_NEW){
+ else if (type == Py_NEW) {
self->contigPtr = PyMem_Malloc(rowSize * colSize * sizeof(float));
- if(self->contigPtr == NULL) { /*allocation failure*/
+ if (self->contigPtr == 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++) {
+ 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++) {
+ 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];
}
}
@@ -2016,7 +2016,7 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign
PyObject *newMatrixObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype)
{
MatrixObject *self= (MatrixObject *)newMatrixObject(NULL, rowSize, colSize, Py_NEW, NULL);
- if(self) {
+ if (self) {
Py_INCREF(cb_user);
self->cb_user= cb_user;
self->cb_type= (unsigned char)cb_type;
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 947e4425d3f..eda6aa5c84e 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -53,13 +53,13 @@ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
ret= PyTuple_New(QUAT_SIZE);
- if(ndigits >= 0) {
- for(i= 0; i < QUAT_SIZE; i++) {
+ if (ndigits >= 0) {
+ 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]));
}
}
@@ -90,34 +90,34 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
short order= EULER_ORDER_XYZ;
EulerObject *eul_compat = NULL;
- if(!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat))
+ if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat))
return NULL;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(order_str) {
+ if (order_str) {
order= euler_order_from_string(order_str, "Matrix.to_euler()");
- if(order == -1)
+ if (order == -1)
return NULL;
}
normalize_qt_qt(tquat, self->quat);
- if(eul_compat) {
+ if (eul_compat) {
float mat[3][3];
- if(BaseMath_ReadCallback(eul_compat) == -1)
+ if (BaseMath_ReadCallback(eul_compat) == -1)
return NULL;
quat_to_mat3(mat, tquat);
- if(order == EULER_ORDER_XYZ) mat3_to_compatible_eul(eul, eul_compat->eul, mat);
+ if (order == EULER_ORDER_XYZ) mat3_to_compatible_eul(eul, eul_compat->eul, mat);
else mat3_to_compatible_eulO(eul, eul_compat->eul, order, mat);
}
else {
- if(order == EULER_ORDER_XYZ) quat_to_eul(eul, tquat);
+ if (order == EULER_ORDER_XYZ) quat_to_eul(eul, tquat);
else quat_to_eulO(eul, order, tquat);
}
@@ -136,7 +136,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
{
float mat[9]; /* all values are set */
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
quat_to_mat3((float (*)[3])mat, self->quat);
@@ -158,10 +158,10 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
{
float quat[QUAT_SIZE], tquat[QUAT_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ 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);
@@ -183,17 +183,17 @@ static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
{
float tquat[QUAT_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") == -1)
return NULL;
return PyFloat_FromDouble(dot_qtqt(self->quat, tquat));
}
PyDoc_STRVAR(Quaternion_rotation_difference_doc,
-".. function:: difference(other)\n"
+".. function:: rotation_difference(other)\n"
"\n"
" Returns a quaternion representing the rotational difference.\n"
"\n"
@@ -206,10 +206,10 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject
{
float tquat[QUAT_SIZE], quat[QUAT_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.difference(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.difference(other), invalid 'other' arg") == -1)
return NULL;
rotation_between_quats_to_quat(quat, self->quat, tquat);
@@ -234,20 +234,20 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
PyObject *value;
float tquat[QUAT_SIZE], quat[QUAT_SIZE], fac;
- if(!PyArg_ParseTuple(args, "Of:slerp", &value, &fac)) {
+ if (!PyArg_ParseTuple(args, "Of:slerp", &value, &fac)) {
PyErr_SetString(PyExc_TypeError,
"quat.slerp(): "
"expected Quaternion types and float");
return NULL;
}
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.slerp(other), invalid 'other' arg") == -1)
+ if (mathutils_array_parse(tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.slerp(other), invalid 'other' arg") == -1)
return NULL;
- if(fac > 1.0f || fac < 0.0f) {
+ if (fac > 1.0f || fac < 0.0f) {
PyErr_SetString(PyExc_ValueError,
"quat.slerp(): "
"interpolation factor must be between 0.0 and 1.0");
@@ -272,10 +272,10 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
float tquat[4], length;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
- if(mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1)
+ if (mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1)
return NULL;
length= normalize_qt_qt(tquat, self->quat);
@@ -298,7 +298,7 @@ PyDoc_STRVAR(Quaternion_normalize_doc,
);
static PyObject *Quaternion_normalize(QuaternionObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
normalize_qt(self->quat);
@@ -327,7 +327,7 @@ PyDoc_STRVAR(Quaternion_invert_doc,
);
static PyObject *Quaternion_invert(QuaternionObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
invert_qt(self->quat);
@@ -359,7 +359,7 @@ PyDoc_STRVAR(Quaternion_identity_doc,
);
static PyObject *Quaternion_identity(QuaternionObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
unit_qt(self->quat);
@@ -378,7 +378,7 @@ PyDoc_STRVAR(Quaternion_negate_doc,
);
static PyObject *Quaternion_negate(QuaternionObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
mul_qt_fl(self->quat, -1.0f);
@@ -394,7 +394,7 @@ PyDoc_STRVAR(Quaternion_conjugate_doc,
);
static PyObject *Quaternion_conjugate(QuaternionObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
conjugate_qt(self->quat);
@@ -429,7 +429,7 @@ PyDoc_STRVAR(Quaternion_copy_doc,
);
static PyObject *Quaternion_copy(QuaternionObject *self)
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return newQuaternionObject(self->quat, Py_NEW, Py_TYPE(self));
@@ -441,7 +441,7 @@ static PyObject *Quaternion_repr(QuaternionObject *self)
{
PyObject *ret, *tuple;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
tuple= Quaternion_to_tuple_ext(self, -1);
@@ -461,7 +461,7 @@ static PyObject* Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
QuaternionObject *quatA= (QuaternionObject *)a;
QuaternionObject *quatB= (QuaternionObject *)b;
- if(BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1)
+ if (BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1)
return NULL;
ok= (EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1)) ? 0 : -1;
@@ -499,16 +499,16 @@ 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) {
+ if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
"quaternion[attribute]: "
"array index out of range");
return NULL;
}
- if(BaseMath_ReadIndexCallback(self, i) == -1)
+ if (BaseMath_ReadIndexCallback(self, i) == -1)
return NULL;
return PyFloat_FromDouble(self->quat[i]);
@@ -519,16 +519,16 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i)
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 */
+ 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){
+ if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
"quaternion[attribute] = x: "
"array assignment index out of range");
@@ -536,7 +536,7 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
}
self->quat[i] = scalar;
- if(BaseMath_WriteIndexCallback(self, i) == -1)
+ if (BaseMath_WriteIndexCallback(self, i) == -1)
return -1;
return 0;
@@ -548,7 +548,7 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end)
PyObject *tuple;
int count;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
CLAMP(begin, 0, QUAT_SIZE);
@@ -557,7 +557,7 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end)
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
- for(count= begin; count < end; count++) {
+ for (count= begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->quat[count]));
}
@@ -570,7 +570,7 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
int i, size;
float quat[QUAT_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
CLAMP(begin, 0, QUAT_SIZE);
@@ -578,10 +578,10 @@ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyOb
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)){
+ if (size != (end - begin)) {
PyErr_SetString(PyExc_ValueError,
"quaternion[begin:end] = []: "
"size mismatch in slice assignment");
@@ -589,7 +589,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);
@@ -674,7 +674,7 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
float quat[QUAT_SIZE];
QuaternionObject *quat1 = NULL, *quat2 = NULL;
- if(!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
+ if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
PyErr_SetString(PyExc_TypeError,
"Quaternion addition: "
"arguments not valid for this operation");
@@ -683,7 +683,7 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
quat1 = (QuaternionObject*)q1;
quat2 = (QuaternionObject*)q2;
- if(BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1)
+ if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1)
return NULL;
add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f);
@@ -697,7 +697,7 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
float quat[QUAT_SIZE];
QuaternionObject *quat1 = NULL, *quat2 = NULL;
- if(!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
+ if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
PyErr_SetString(PyExc_TypeError,
"Quaternion addition: "
"arguments not valid for this operation");
@@ -707,10 +707,10 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
quat1 = (QuaternionObject*)q1;
quat2 = (QuaternionObject*)q2;
- if(BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1)
+ if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1)
return NULL;
- for(x = 0; x < QUAT_SIZE; x++) {
+ for (x = 0; x < QUAT_SIZE; x++) {
quat[x] = quat1->quat[x] - quat2->quat[x];
}
@@ -732,24 +732,24 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
float quat[QUAT_SIZE], scalar;
QuaternionObject *quat1 = NULL, *quat2 = NULL;
- if(QuaternionObject_Check(q1)) {
+ if (QuaternionObject_Check(q1)) {
quat1 = (QuaternionObject*)q1;
- if(BaseMath_ReadCallback(quat1) == -1)
+ if (BaseMath_ReadCallback(quat1) == -1)
return NULL;
}
- if(QuaternionObject_Check(q2)) {
+ if (QuaternionObject_Check(q2)) {
quat2 = (QuaternionObject*)q2;
- if(BaseMath_ReadCallback(quat2) == -1)
+ if (BaseMath_ReadCallback(quat2) == -1)
return NULL;
}
- if(quat1 && quat2) { /* QUAT*QUAT (cross product) */
+ if (quat1 && quat2) { /* QUAT*QUAT (cross product) */
mul_qt_qtqt(quat, quat1->quat, quat2->quat);
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
}
/* 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) {
+ else if (quat2) { /* FLOAT*QUAT */
+ if (((scalar= PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred())==0) {
return quat_mul_float(quat2, scalar);
}
}
@@ -759,14 +759,14 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
VectorObject *vec2 = (VectorObject *)q2;
float tvec[3];
- if(vec2->size != 3) {
+ if (vec2->size != 3) {
PyErr_SetString(PyExc_ValueError,
"Vector multiplication: "
"only 3D vector rotations (with quats) "
"currently supported");
return NULL;
}
- if(BaseMath_ReadCallback(vec2) == -1) {
+ if (BaseMath_ReadCallback(vec2) == -1) {
return NULL;
}
@@ -776,7 +776,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
return newVectorObject(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);
}
}
@@ -797,7 +797,7 @@ static PyObject *Quaternion_neg(QuaternionObject *self)
{
float tquat[QUAT_SIZE];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
negate_v4_v4(tquat, self->quat);
@@ -874,7 +874,7 @@ static int Quaternion_setAxis(QuaternionObject *self, PyObject *value, void *typ
static PyObject *Quaternion_getMagnitude(QuaternionObject *self, void *UNUSED(closure))
{
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat)));
@@ -884,7 +884,7 @@ static PyObject *Quaternion_getAngle(QuaternionObject *self, void *UNUSED(closur
{
float tquat[4];
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
normalize_qt_qt(tquat, self->quat);
@@ -899,7 +899,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
float axis[3], angle_dummy;
double angle;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
len= normalize_qt_qt(tquat, self->quat);
@@ -907,7 +907,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
angle= PyFloat_AsDouble(value);
- if(angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */
+ if (angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError,
"Quaternion.angle = value: float expected");
return -1;
@@ -916,7 +916,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
angle= angle_wrap_rad(angle);
/* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */
- if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+ if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
) {
@@ -926,7 +926,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
axis_angle_to_quat(self->quat, axis, angle);
mul_qt_fl(self->quat, len);
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return -1;
return 0;
@@ -939,14 +939,14 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos
float axis[3];
float angle;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return NULL;
normalize_qt_qt(tquat, self->quat);
quat_to_axis_angle(axis, &angle, tquat);
/* If the axis of rotation is 0,0,0 set it to 1,0,0 - for zero-degree rotations */
- if( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+ if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[2], 0.0f, 10)
) {
@@ -964,7 +964,7 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *
float axis[3];
float angle;
- if(BaseMath_ReadCallback(self) == -1)
+ if (BaseMath_ReadCallback(self) == -1)
return -1;
len= normalize_qt_qt(tquat, self->quat);
@@ -976,7 +976,7 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *
axis_angle_to_quat(self->quat, axis, angle);
mul_qt_fl(self->quat, len);
- if(BaseMath_WriteCallback(self) == -1)
+ if (BaseMath_WriteCallback(self) == -1)
return -1;
return 0;
@@ -989,14 +989,14 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
double angle = 0.0f;
float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f};
- if(kwds && PyDict_Size(kwds)) {
+ if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
"mathutils.Quaternion(): "
"takes no keyword args");
return NULL;
}
- if(!PyArg_ParseTuple(args, "|Od:mathutils.Quaternion", &seq, &angle))
+ if (!PyArg_ParseTuple(args, "|Od:mathutils.Quaternion", &seq, &angle))
return NULL;
switch(PyTuple_GET_SIZE(args)) {
@@ -1021,7 +1021,7 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec
{
PyObject *ret= Quaternion_copy(self);
PyObject *ret_dummy= quat_func(ret);
- if(ret_dummy) {
+ if (ret_dummy) {
Py_DECREF(ret_dummy);
return (PyObject *)ret;
}
@@ -1144,18 +1144,18 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
self= base_type ? (QuaternionObject *)base_type->tp_alloc(base_type, 0) :
(QuaternionObject *)PyObject_GC_New(QuaternionObject, &quaternion_Type);
- if(self) {
+ if (self) {
/* init callbacks as NULL */
self->cb_user= NULL;
self->cb_type= self->cb_subtype= 0;
- if(type == Py_WRAP){
+ if (type == Py_WRAP) {
self->quat = quat;
self->wrapped = Py_WRAP;
}
- else if (type == Py_NEW){
+ else if (type == Py_NEW) {
self->quat = PyMem_Malloc(QUAT_SIZE * sizeof(float));
- if(!quat) { //new empty
+ if (!quat) { //new empty
unit_qt(self->quat);
}
else {
@@ -1173,7 +1173,7 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
{
QuaternionObject *self= (QuaternionObject *)newQuaternionObject(NULL, Py_NEW, NULL);
- if(self) {
+ if (self) {
Py_INCREF(cb_user);
self->cb_user= cb_user;
self->cb_type= (unsigned char)cb_type;
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 413df78f09e..df8598cc3f1 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -123,11 +123,11 @@ static PyObject *Vector_normalize(VectorObject *self)
if(BaseMath_ReadCallback(self) == -1)
return NULL;
- for(i = 0; i < self->size; i++) {
+ for (i = 0; i < self->size; i++) {
norm += self->vec[i] * self->vec[i];
}
norm = (float) sqrt(norm);
- for(i = 0; i < self->size; i++) {
+ for (i = 0; i < self->size; i++) {
self->vec[i] /= norm;
}
@@ -251,11 +251,11 @@ static PyObject *Vector_resize_4d(VectorObject *self)
return NULL;
}
- if(self->size == 2){
+ if(self->size == 2) {
self->vec[2] = 0.0f;
self->vec[3] = 1.0f;
}
- else if(self->size == 3){
+ else if(self->size == 3) {
self->vec[3] = 1.0f;
}
self->size = 4;
@@ -332,12 +332,12 @@ static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits)
ret= PyTuple_New(self->size);
if(ndigits >= 0) {
- for(i = 0; i < self->size; i++) {
+ for (i = 0; i < self->size; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->vec[i], ndigits)));
}
}
else {
- for(i = 0; i < self->size; i++) {
+ for (i = 0; i < self->size; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->vec[i]));
}
}
@@ -581,7 +581,7 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value)
if(mathutils_array_parse(tvec, self->size, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1)
return NULL;
- for(x = 0; x < self->size; x++) {
+ for (x = 0; x < self->size; x++) {
dot += (double)(self->vec[x] * tvec[x]);
}
@@ -621,11 +621,11 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
if(mathutils_array_parse(tvec, size, size, value, "Vector.angle(other), invalid 'other' arg") == -1)
return NULL;
- for(x = 0; x < size; x++) {
+ for (x = 0; x < size; x++) {
test_v1 += (double)(self->vec[x] * self->vec[x]);
test_v2 += (double)(tvec[x] * tvec[x]);
}
- if (!test_v1 || !test_v2){
+ if (!test_v1 || !test_v2) {
/* avoid exception */
if(fallback) {
Py_INCREF(fallback);
@@ -640,7 +640,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
}
//dot product
- for(x = 0; x < self->size; x++) {
+ for (x = 0; x < self->size; x++) {
dot += (double)(self->vec[x] * tvec[x]);
}
dot /= (sqrt(test_v1) * sqrt(test_v2));
@@ -714,13 +714,13 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
return NULL;
//get dot products
- for(x = 0; x < size; x++) {
+ for (x = 0; x < size; x++) {
dot += (double)(self->vec[x] * tvec[x]);
dot2 += (double)(tvec[x] * tvec[x]);
}
//projection
dot /= dot2;
- for(x = 0; x < size; x++) {
+ for (x = 0; x < size; x++) {
vec[x] = (float)dot * tvec[x];
}
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
@@ -757,7 +757,7 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
ifac= 1.0f - fac;
- for(x = 0; x < size; x++) {
+ for (x = 0; x < size; x++) {
vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]);
}
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
@@ -872,7 +872,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value,
if(i<0) i= self->size-i;
- if(i < 0 || i >= self->size){
+ if(i < 0 || i >= self->size) {
if(is_attr) {
PyErr_Format(PyExc_AttributeError,
"Vector.%c = x: unavailable on %dd vector",
@@ -912,7 +912,7 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end)
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
- for(count = begin; count < end; count++) {
+ for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->vec[count]));
}
@@ -936,7 +936,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se
return -1;
/*parsed well - now set in vector*/
- for(y = 0; y < size; y++){
+ for (y = 0; y < size; y++) {
self->vec[begin + y] = vec[y];
}
@@ -1088,7 +1088,7 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec,
double dot = 0.0f;
int x, y, z = 0;
- if(mat->row_size != vec->size){
+ if(mat->row_size != vec->size) {
if(mat->row_size == 4 && vec->size == 3) {
vec_cpy[3] = 1.0f;
}
@@ -1105,8 +1105,8 @@ int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject* vec,
rvec[3] = 1.0f;
- for(x = 0; x < mat->col_size; x++) {
- for(y = 0; y < mat->row_size; y++) {
+ 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]);
}
rvec[z++] = (float)dot;
@@ -1153,7 +1153,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
}
/*dot product*/
- for(i = 0; i < vec1->size; i++) {
+ for (i = 0; i < vec1->size; i++) {
dot += (double)(vec1->vec[i] * vec2->vec[i]);
}
return PyFloat_FromDouble(dot);
@@ -1325,7 +1325,7 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2)
return NULL;
}
- for(i = 0; i < vec1->size; i++) {
+ for (i = 0; i < vec1->size; i++) {
vec[i] = vec1->vec[i] / scalar;
}
return newVectorObject(vec, vec1->size, Py_NEW, Py_TYPE(v1));
@@ -1354,7 +1354,7 @@ static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
"divide by zero error");
return NULL;
}
- for(i = 0; i < vec1->size; i++) {
+ for (i = 0; i < vec1->size; i++) {
vec1->vec[i] /= scalar;
}
@@ -1383,7 +1383,7 @@ static double vec_magnitude_nosqrt(float *data, int size)
double dot = 0.0f;
int i;
- for(i=0; i<size; i++){
+ for (i=0; i<size; i++) {
dot += (double)data[i];
}
/*return (double)sqrt(dot);*/
@@ -1403,8 +1403,8 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
double epsilon = .000001f;
double lenA, lenB;
- if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)){
- if (comparison_type == Py_NE){
+ if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)) {
+ if (comparison_type == Py_NE) {
Py_RETURN_TRUE;
}
else {
@@ -1417,8 +1417,8 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
if(BaseMath_ReadCallback(vecA) == -1 || BaseMath_ReadCallback(vecB) == -1)
return NULL;
- if (vecA->size != vecB->size){
- if (comparison_type == Py_NE){
+ if (vecA->size != vecB->size) {
+ if (comparison_type == Py_NE) {
Py_RETURN_TRUE;
}
else {
@@ -1426,18 +1426,18 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
}
}
- switch (comparison_type){
+ switch (comparison_type) {
case Py_LT:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if(lenA < lenB){
+ if(lenA < lenB) {
result = 1;
}
break;
case Py_LE:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if(lenA < lenB){
+ if(lenA < lenB) {
result = 1;
}
else {
@@ -1453,14 +1453,14 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
case Py_GT:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if(lenA > lenB){
+ if(lenA > lenB) {
result = 1;
}
break;
case Py_GE:
lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
- if(lenA > lenB){
+ if(lenA > lenB) {
result = 1;
}
else {
@@ -1471,7 +1471,7 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
printf("The result of the comparison could not be evaluated");
break;
}
- if (result == 1){
+ if (result == 1) {
Py_RETURN_TRUE;
}
else {
@@ -1631,7 +1631,7 @@ static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure))
if(BaseMath_ReadCallback(self) == -1)
return NULL;
- for(i = 0; i < self->size; i++){
+ for (i = 0; i < self->size; i++) {
dot += (double)(self->vec[i] * self->vec[i]);
}
return PyFloat_FromDouble(sqrt(dot));
@@ -1661,7 +1661,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
return 0;
}
- for(i = 0; i < self->size; i++){
+ for (i = 0; i < self->size; i++) {
dot += (double)(self->vec[i] * self->vec[i]);
}
@@ -1675,7 +1675,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
dot= dot/param;
- for(i = 0; i < self->size; i++){
+ for (i = 0; i < self->size; i++) {
self->vec[i]= self->vec[i] / (float)dot;
}
@@ -1693,7 +1693,7 @@ static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closur
if(BaseMath_ReadCallback(self) == -1)
return NULL;
- for(i = 0; i < self->size; i++){
+ for (i = 0; i < self->size; i++) {
dot += (double)(self->vec[i] * self->vec[i]);
}
return PyFloat_FromDouble(dot);
@@ -1778,7 +1778,7 @@ static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure)
if (((scalarVal=PyFloat_AsDouble(value)) == -1 && PyErr_Occurred())==0) {
int i;
- for(i=0; i < MAX_DIMENSIONS; i++)
+ for (i=0; i < MAX_DIMENSIONS; i++)
vec_assign[i]= scalarVal;
size_from= axis_from;
@@ -2219,8 +2219,8 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
double dot = 0.0f;
int x, y, z= 0, vec_size= vec->size;
- if(mat->col_size != vec_size){
- if(mat->col_size == 4 && vec_size != 3){
+ if(mat->col_size != vec_size) {
+ if(mat->col_size == 4 && vec_size != 3) {
PyErr_SetString(PyExc_ValueError,
"vector * matrix: matrix column size "
"and the vector size must be the same");
@@ -2235,11 +2235,11 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
return -1;
memcpy(vec_cpy, vec->vec, vec_size * sizeof(float));
-printf("asasas\n");
+
rvec[3] = 1.0f;
//muliplication
- for(x = 0; x < mat->row_size; x++) {
- for(y = 0; y < mat->col_size; y++) {
+ for (x = 0; x < mat->row_size; x++) {
+ for (y = 0; y < mat->col_size; y++) {
dot += mat->matrix[x][y] * vec_cpy[y];
}
rvec[z++] = (float)dot;
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 0394d732ae3..dafd89757a9 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -86,16 +86,16 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
float det, inv_det, u, v, t;
int clip= 1;
- if(!PyArg_ParseTuple(args, "O!O!O!O!O!|i:intersect_ray_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip)) {
+ if (!PyArg_ParseTuple(args, "O!O!O!O!O!|i:intersect_ray_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &ray, &vector_Type, &ray_off , &clip)) {
return NULL;
}
- if(vec1->size != 3 || vec2->size != 3 || vec3->size != 3 || ray->size != 3 || ray_off->size != 3) {
+ if (vec1->size != 3 || vec2->size != 3 || vec3->size != 3 || ray->size != 3 || ray_off->size != 3) {
PyErr_SetString(PyExc_ValueError,
"only 3D vectors for all parameters");
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;
VECCOPY(v1, vec1->vec);
@@ -174,19 +174,19 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
VectorObject *vec1, *vec2, *vec3, *vec4;
float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3];
- if(!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) {
+ if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) {
return NULL;
}
- if(vec1->size != vec2->size || vec1->size != vec3->size || vec3->size != vec2->size) {
+ if (vec1->size != vec2->size || vec1->size != vec3->size || vec3->size != vec2->size) {
PyErr_SetString(PyExc_ValueError,
"vectors must be of the same size");
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;
- if(vec1->size == 3 || vec1->size == 2) {
+ if (vec1->size == 3 || vec1->size == 2) {
int result;
if (vec1->size == 3) {
@@ -257,42 +257,42 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
VectorObject *vec1, *vec2, *vec3, *vec4;
float n[3];
- if(PyTuple_GET_SIZE(args) == 3) {
- if(!PyArg_ParseTuple(args, "O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) {
+ if (PyTuple_GET_SIZE(args) == 3) {
+ if (!PyArg_ParseTuple(args, "O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) {
return NULL;
}
- if(vec1->size != vec2->size || vec1->size != vec3->size) {
+ if (vec1->size != vec2->size || vec1->size != vec3->size) {
PyErr_SetString(PyExc_ValueError,
"vectors must be of the same size");
return NULL;
}
- if(vec1->size < 3) {
+ if (vec1->size < 3) {
PyErr_SetString(PyExc_ValueError,
"2D vectors unsupported");
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;
normal_tri_v3(n, vec1->vec, vec2->vec, vec3->vec);
}
else {
- if(!PyArg_ParseTuple(args, "O!O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) {
+ if (!PyArg_ParseTuple(args, "O!O!O!O!:normal", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3, &vector_Type, &vec4)) {
return NULL;
}
- if(vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size) {
+ if (vec1->size != vec2->size || vec1->size != vec3->size || vec1->size != vec4->size) {
PyErr_SetString(PyExc_ValueError,
"vectors must be of the same size");
return NULL;
}
- if(vec1->size < 3) {
+ if (vec1->size < 3) {
PyErr_SetString(PyExc_ValueError,
"2D vectors unsupported");
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;
normal_quad_v3(n, vec1->vec, vec2->vec, vec3->vec, vec4->vec);
@@ -320,17 +320,17 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3;
- if(!PyArg_ParseTuple(args, "O!O!O!:area_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) {
+ if (!PyArg_ParseTuple(args, "O!O!O!:area_tri", &vector_Type, &vec1, &vector_Type, &vec2, &vector_Type, &vec3)) {
return NULL;
}
- if(vec1->size != vec2->size || vec1->size != vec3->size) {
+ if (vec1->size != vec2->size || vec1->size != vec3->size) {
PyErr_SetString(PyExc_ValueError,
"vectors must be of the same size");
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;
if (vec1->size == 3) {
@@ -367,7 +367,7 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
{
VectorObject *line_a1, *line_a2, *line_b1, *line_b2;
float vi[2];
- if(!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line_2d",
+ if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_line_line_2d",
&vector_Type, &line_a1,
&vector_Type, &line_a2,
&vector_Type, &line_b1,
@@ -376,10 +376,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;
- if(isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) {
+ if (isect_seg_seg_v2_point(line_a1->vec, line_a2->vec, line_b1->vec, line_b2->vec, vi) == 1) {
return newVectorObject(vi, 2, Py_NEW, NULL);
}
else {
@@ -411,7 +411,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
VectorObject *line_a, *line_b, *plane_co, *plane_no;
int no_flip= 0;
float isect[3];
- if(!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane",
+ if (!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane",
&vector_Type, &line_a,
&vector_Type, &line_b,
&vector_Type, &plane_co,
@@ -421,7 +421,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
return NULL;
}
- if( BaseMath_ReadCallback(line_a) == -1 ||
+ if ( BaseMath_ReadCallback(line_a) == -1 ||
BaseMath_ReadCallback(line_b) == -1 ||
BaseMath_ReadCallback(plane_co) == -1 ||
BaseMath_ReadCallback(plane_no) == -1
@@ -429,14 +429,14 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
return NULL;
}
- if(ELEM4(2, line_a->size, line_b->size, plane_co->size, plane_no->size)) {
+ if (ELEM4(2, line_a->size, line_b->size, plane_co->size, plane_no->size)) {
PyErr_SetString(PyExc_ValueError,
"geometry.intersect_line_plane(...): "
" can't use 2D Vectors");
return NULL;
}
- if(isect_line_plane_v3(isect, line_a->vec, line_b->vec, plane_co->vec, plane_no->vec, no_flip) == 1) {
+ if (isect_line_plane_v3(isect, line_a->vec, line_b->vec, plane_co->vec, plane_no->vec, no_flip) == 1) {
return newVectorObject(isect, 3, Py_NEW, NULL);
}
else {
@@ -471,7 +471,7 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
float isect_a[3];
float isect_b[3];
- if(!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere",
+ if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere",
&vector_Type, &line_a,
&vector_Type, &line_b,
&vector_Type, &sphere_co,
@@ -480,14 +480,14 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
return NULL;
}
- if( BaseMath_ReadCallback(line_a) == -1 ||
+ if ( BaseMath_ReadCallback(line_a) == -1 ||
BaseMath_ReadCallback(line_b) == -1 ||
BaseMath_ReadCallback(sphere_co) == -1
) {
return NULL;
}
- if(ELEM3(2, line_a->size, line_b->size, sphere_co->size)) {
+ if (ELEM3(2, line_a->size, line_b->size, sphere_co->size)) {
PyErr_SetString(PyExc_ValueError,
"geometry.intersect_line_sphere(...): "
" can't use 2D Vectors");
@@ -502,22 +502,22 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
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;
+ 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;
}
- if(use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 3, Py_NEW, NULL)); }
+ if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 3, Py_NEW, NULL)); }
else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); }
- if(use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 3, Py_NEW, NULL)); }
+ if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 3, Py_NEW, NULL)); }
else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); }
return ret;
@@ -551,7 +551,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
float isect_a[3];
float isect_b[3];
- if(!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d",
+ if (!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d",
&vector_Type, &line_a,
&vector_Type, &line_b,
&vector_Type, &sphere_co,
@@ -560,7 +560,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
return NULL;
}
- if( BaseMath_ReadCallback(line_a) == -1 ||
+ if ( BaseMath_ReadCallback(line_a) == -1 ||
BaseMath_ReadCallback(line_b) == -1 ||
BaseMath_ReadCallback(sphere_co) == -1
) {
@@ -575,22 +575,22 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
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;
+ 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;
}
- if(use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 2, Py_NEW, NULL)); }
+ if (use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 2, Py_NEW, NULL)); }
else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); }
- if(use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 2, Py_NEW, NULL)); }
+ if (use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 2, Py_NEW, NULL)); }
else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); }
return ret;
@@ -617,7 +617,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
float lambda;
PyObject *ret;
- if(!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line",
+ if (!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line",
&vector_Type, &pt,
&vector_Type, &line_1,
&vector_Type, &line_2)
@@ -625,7 +625,7 @@ 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 */
@@ -666,7 +666,7 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
- if(!PyArg_ParseTuple(args, "O!O!O!O!:intersect_point_tri_2d",
+ if (!PyArg_ParseTuple(args, "O!O!O!O!:intersect_point_tri_2d",
&vector_Type, &pt_vec,
&vector_Type, &tri_p1,
&vector_Type, &tri_p2,
@@ -675,7 +675,7 @@ 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;
return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec));
@@ -702,7 +702,7 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb
{
VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
- if(!PyArg_ParseTuple(args, "O!O!O!O!O!:intersect_point_quad_2d",
+ if (!PyArg_ParseTuple(args, "O!O!O!O!O!:intersect_point_quad_2d",
&vector_Type, &pt_vec,
&vector_Type, &quad_p1,
&vector_Type, &quad_p2,
@@ -712,7 +712,7 @@ 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;
return PyLong_FromLong(isect_point_quad_v2(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec));
@@ -747,7 +747,7 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
VectorObject *vec_t1_src, *vec_t2_src, *vec_t3_src;
float vec[3];
- if(!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform",
+ if (!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform",
&vector_Type, &vec_pt,
&vector_Type, &vec_t1_src,
&vector_Type, &vec_t2_src,
@@ -759,7 +759,7 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
return NULL;
}
- if( vec_pt->size != 3 ||
+ if ( vec_pt->size != 3 ||
vec_t1_src->size != 3 ||
vec_t2_src->size != 3 ||
vec_t3_src->size != 3 ||
@@ -814,7 +814,7 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
float h2[4]= {0.0, 0.0, 0.0, 0.0};
- if(!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier",
+ if (!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier",
&vector_Type, &vec_k1,
&vector_Type, &vec_h1,
&vector_Type, &vec_h2,
@@ -823,30 +823,30 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
return NULL;
}
- if(resolu <= 1) {
+ if (resolu <= 1) {
PyErr_SetString(PyExc_ValueError,
"resolution must be 2 or over");
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);
- 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++) {
+ 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) {
+ for (i=0; i<resolu; i++, fp= fp+dims) {
PyList_SET_ITEM(list, i, newVectorObject(fp, dims, Py_NEW, NULL));
}
MEM_freeN(coord_array);
@@ -875,7 +875,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */
int index, *dl_face, totpoints=0;
- if(!PySequence_Check(polyLineSeq)) {
+ if (!PySequence_Check(polyLineSeq)) {
PyErr_SetString(PyExc_TypeError,
"expected a sequence of poly lines");
return NULL;
@@ -883,7 +883,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
len_polylines= PySequence_Size(polyLineSeq);
- for(i= 0; i < len_polylines; ++i) {
+ for (i= 0; i < len_polylines; ++i) {
polyLine= PySequence_GetItem(polyLineSeq, i);
if (!PySequence_Check(polyLine)) {
freedisplist(&dispbase);
@@ -914,16 +914,16 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
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) {
+ for (index= 0; index<len_polypoints; ++index, fp+=3) {
polyVec= PySequence_GetItem(polyLine, index);
- if(VectorObject_Check(polyVec)) {
+ if (VectorObject_Check(polyVec)) {
- if(BaseMath_ReadCallback((VectorObject *)polyVec) == -1)
+ if (BaseMath_ReadCallback((VectorObject *)polyVec) == -1)
ls_error= 1;
fp[0]= ((VectorObject *)polyVec)->vec[0];
fp[1]= ((VectorObject *)polyVec)->vec[1];
- if(((VectorObject *)polyVec)->size > 2)
+ if (((VectorObject *)polyVec)->size > 2)
fp[2]= ((VectorObject *)polyVec)->vec[2];
else
fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */
@@ -939,7 +939,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
Py_DECREF(polyLine);
}
- if(ls_error) {
+ if (ls_error) {
freedisplist(&dispbase); /* possible some dl was allocated */
PyErr_SetString(PyExc_TypeError,
"A point in one of the polylines "
@@ -955,7 +955,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
dl= dispbase.first;
tri_list= PyList_New(dl->parts);
- if(!tri_list) {
+ if (!tri_list) {
freedisplist(&dispbase);
PyErr_SetString(PyExc_RuntimeError,
"failed to make a new list");
@@ -964,7 +964,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
index= 0;
dl_face= dl->index;
- while(index < dl->parts) {
+ 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;
index++;
@@ -989,7 +989,7 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
/* Error checking must already be done */
- if(!PyList_Check(value)) {
+ if (!PyList_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"can only back a list of [x, y, w, h]");
return -1;
@@ -1000,9 +1000,9 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
(*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box");
- for(i= 0; i < len; 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) {
+ if (!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) {
MEM_freeN(*boxarray);
PyErr_SetString(PyExc_TypeError,
"can only pack a list of [x, y, w, h]");
@@ -1040,7 +1040,7 @@ static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
len= PyList_GET_SIZE(value);
- for(i= 0; i < len; i++) {
+ 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));
@@ -1066,7 +1066,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
PyObject *ret;
- if(!PyList_Check(boxlist)) {
+ if (!PyList_Check(boxlist)) {
PyErr_SetString(PyExc_TypeError,
"expected a list of boxes [[x, y, w, h], ... ]");
return NULL;
@@ -1075,7 +1075,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
len= PyList_GET_SIZE(boxlist);
if (len) {
boxPack *boxarray= NULL;
- if(boxPack_FromPyObject(boxlist, &boxarray) == -1) {
+ if (boxPack_FromPyObject(boxlist, &boxarray) == -1) {
return NULL; /* exception set */
}
diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript
index 82735dc96bd..a128ded965c 100644
--- a/source/blender/quicktime/SConscript
+++ b/source/blender/quicktime/SConscript
@@ -35,6 +35,6 @@ defs=['WITH_QUICKTIME']
if env['WITH_GHOST_COCOA']:
defs.append('GHOST_COCOA')
- env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/gcc-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers do not support it fully yet
+ env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/g++-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers do not support it fully yet
else:
env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities)
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 16cba7d6758..07bab06e52f 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -860,7 +860,7 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
RNA_def_property_flag(prop, PROP_HIDDEN);
if(flag & WM_FILESEL_RELPATH)
- RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, "Relative Path", "Select the file relative to the blend file");
+ RNA_def_boolean(ot->srna, "relative_path", TRUE, "Relative Path", "Select the file relative to the blend file");
}
void WM_operator_properties_select_all(wmOperatorType *ot)
@@ -1618,15 +1618,20 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath")) {
return WM_operator_call(C, op);
}
else {
/* XXX TODO solve where to get last linked library from */
- RNA_string_set(op->ptr, "filepath", G.lib);
+ if(G.lib[0] != '\0') {
+ RNA_string_set(op->ptr, "filepath", G.lib);
+ }
+ else if(G.relbase_valid) {
+ char path[FILE_MAX];
+ BLI_strncpy(path, G.main->name, sizeof(G.main->name));
+ BLI_parent_dir(path);
+ RNA_string_set(op->ptr, "filepath", path);
+ }
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 2414fe2ef1c..e4e361d6a68 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -372,6 +372,7 @@ void uiTemplateHistogram(struct uiLayout *layout, struct PointerRNA *ptr, char *
void uiTemplateReportsBanner(struct uiLayout *layout, struct bContext *C, struct wmOperator *op){}
void uiTemplateWaveform(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand){}
void uiTemplateVectorscope(struct uiLayout *_self, struct PointerRNA *data, char* property, int expand){}
+void uiTemplateKeymapItemProperties(struct uiLayout *layout, struct PointerRNA *ptr){}
/* rna render */
struct RenderResult *RE_engine_begin_result(struct RenderEngine *engine, int x, int y, int w, int h){return (struct RenderResult *) NULL;}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index d36bd3cd344..0650a5678b2 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -582,12 +582,12 @@ elseif(WIN32)
FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
DESTINATION ${TARGETDIR}
)
- else()
- install(
- FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
- DESTINATION ${TARGETDIR}
- )
endif()
+
+ install( # x86 builds can run on x64 Windows, so this is required at all times
+ FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
+ DESTINATION ${TARGETDIR}
+ )
elseif(APPLE)
set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h
index e7b8784a076..45737bd41bc 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.h
+++ b/source/gameengine/Converter/BlenderWorldInfo.h
@@ -54,22 +54,22 @@ public:
~BlenderWorldInfo();
bool hasWorld();
- bool hasMist();
- float getBackColorRed();
- float getBackColorGreen();
- float getBackColorBlue();
+ bool hasMist();
+ float getBackColorRed();
+ float getBackColorGreen();
+ float getBackColorBlue();
float getAmbientColorRed();
float getAmbientColorGreen();
float getAmbientColorBlue();
- float getMistStart();
- float getMistDistance();
- float getMistColorRed();
- float getMistColorGreen();
- float getMistColorBlue();
+ float getMistStart();
+ float getMistDistance();
+ float getMistColorRed();
+ float getMistColorGreen();
+ float getMistColorBlue();
- void
+ void
setBackColor(
float r,
float g,
diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp
index b13dbe324f5..4ea77e4349d 100644
--- a/source/gameengine/Converter/KX_IpoConvert.cpp
+++ b/source/gameengine/Converter/KX_IpoConvert.cpp
@@ -102,7 +102,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B
rotmode = "rotation_axis_angle";
drotmode = "delta_rotation_axis_angle";
break;
- case ROT_MODE_QUAT:
+ case ROT_MODE_QUAT: /* XXX, this isnt working, currently only eulers are supported [#28853] */
rotmode = "rotation_quaternion";
drotmode = "delta_rotation_quaternion";
break;
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index d3b2eacbb4d..dd4c9a880fd 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -215,7 +215,7 @@ typedef struct PyObjectPlus_Proxy {
if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \
return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \
}; \
- static const char method_name##_doc[]; \
+ static const char method_name##_doc[]; \
#define KX_PYMETHOD_DOC_VARARGS(class_name, method_name) \
PyObject* Py##method_name(PyObject* args); \
@@ -223,7 +223,7 @@ typedef struct PyObjectPlus_Proxy {
if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \
return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \
}; \
- static const char method_name##_doc[]; \
+ static const char method_name##_doc[]; \
#define KX_PYMETHOD_DOC_O(class_name, method_name) \
PyObject* Py##method_name(PyObject* value); \
@@ -231,7 +231,7 @@ typedef struct PyObjectPlus_Proxy {
if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \
return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \
}; \
- static const char method_name##_doc[]; \
+ static const char method_name##_doc[]; \
#define KX_PYMETHOD_DOC_NOARGS(class_name, method_name) \
PyObject* Py##method_name(); \
@@ -239,7 +239,7 @@ typedef struct PyObjectPlus_Proxy {
if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \
}; \
- static const char method_name##_doc[]; \
+ static const char method_name##_doc[]; \
/* The line above should remain empty */
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
index 7c1824cd4eb..33d7ec5b4fc 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
@@ -134,7 +134,7 @@ PyTypeObject SCA_2DFilterActuator::Type = {
PyMethodDef SCA_2DFilterActuator::Methods[] = {
/* add python functions to deal with m_msg... */
- {NULL,NULL}
+ {NULL,NULL}
};
PyAttributeDef SCA_2DFilterActuator::Attributes[] = {
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h
index 82c82ac3be5..01396839291 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.h
@@ -38,7 +38,7 @@
class SCA_2DFilterActuator : public SCA_IActuator
{
- Py_Header;
+ Py_Header;
private:
vector<STR_String> m_propNames;
diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h
index 844f40f0578..009fb0b92ea 100644
--- a/source/gameengine/Ketsji/KX_Dome.h
+++ b/source/gameengine/Ketsji/KX_Dome.h
@@ -57,22 +57,21 @@ class KX_Dome
{
public:
/// constructor
- KX_Dome (
- RAS_ICanvas* m_canvas,
- /// rasterizer
- RAS_IRasterizer* m_rasterizer,
- /// render tools
- RAS_IRenderTools* m_rendertools,
- /// engine
- KX_KetsjiEngine* m_engine,
-
- short res,
- short mode,
- short angle,
- float resbuf,
- short tilt,
- struct Text* warptext
- );
+ KX_Dome (RAS_ICanvas* m_canvas,
+ /// rasterizer
+ RAS_IRasterizer* m_rasterizer,
+ /// render tools
+ RAS_IRenderTools* m_rendertools,
+ /// engine
+ KX_KetsjiEngine* m_engine,
+
+ short res,
+ short mode,
+ short angle,
+ float resbuf,
+ short tilt,
+ struct Text* warptext
+ );
/// destructor
virtual ~KX_Dome (void);
@@ -180,14 +179,14 @@ protected:
/// rendered scene
KX_Scene * m_scene;
- /// canvas
- RAS_ICanvas* m_canvas;
- /// rasterizer
- RAS_IRasterizer* m_rasterizer;
- /// render tools
- RAS_IRenderTools* m_rendertools;
- /// engine
- KX_KetsjiEngine* m_engine;
+ /// canvas
+ RAS_ICanvas* m_canvas;
+ /// rasterizer
+ RAS_IRasterizer* m_rasterizer;
+ /// render tools
+ RAS_IRenderTools* m_rendertools;
+ /// engine
+ KX_KetsjiEngine* m_engine;
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 853b36b54f7..e5e9c3330e5 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -110,9 +110,9 @@ KX_GameObject::KX_GameObject(
m_pGraphicController(NULL),
m_xray(false),
m_pHitObject(NULL),
+ m_pObstacleSimulation(NULL),
m_actionManager(NULL),
- m_isDeformable(false),
- m_pObstacleSimulation(NULL)
+ m_isDeformable(false)
#ifdef WITH_PYTHON
, m_attr_dict(NULL)
#endif
diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
index 5f78d9a3722..c2b53fb71ba 100644
--- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
+++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
@@ -633,7 +633,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM
const float ivmax = 1.0f / vmax;
- float adir[2], adist;
+ float adir[2] /*, adist */;
vcpy(adir, activeObst->pvel);
if (vlen(adir) > 0.01f)
vnorm(adir);
@@ -641,7 +641,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM
vset(adir,0,0);
float activeObstPos[2];
vset(activeObstPos, activeObst->m_pos.x(), activeObst->m_pos.y());
- adist = vdot(adir, activeObstPos);
+ /* adist = vdot(adir, activeObstPos); */
float minPenalty = FLT_MAX;
diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.h b/source/gameengine/Ketsji/KX_OrientationInterpolator.h
index 2ae7b00cb86..8bbe888f74f 100644
--- a/source/gameengine/Ketsji/KX_OrientationInterpolator.h
+++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.h
@@ -41,12 +41,12 @@ class KX_IScalarInterpolator;
class KX_OrientationInterpolator : public KX_IInterpolator {
public:
- KX_OrientationInterpolator(MT_Matrix3x3& target,
- KX_IScalarInterpolator **ipos)
- : m_target(target)
- {
- m_ipos[0] = ipos[0];
- m_ipos[1] = ipos[1];
+ KX_OrientationInterpolator(MT_Matrix3x3& target,
+ KX_IScalarInterpolator **ipos)
+ : m_target(target)
+ {
+ m_ipos[0] = ipos[0];
+ m_ipos[1] = ipos[1];
m_ipos[2] = ipos[2];
}
diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp
index 1edecdf44d2..f998da18f83 100644
--- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp
@@ -46,38 +46,38 @@
/* ------------------------------------------------------------------------- */
KX_SteeringActuator::KX_SteeringActuator(SCA_IObject *gameobj,
- int mode,
- KX_GameObject *target,
- KX_GameObject *navmesh,
- float distance,
- float velocity,
- float acceleration,
- float turnspeed,
- bool isSelfTerminated,
- int pathUpdatePeriod,
- KX_ObstacleSimulation* simulation,
- short facingmode,
- bool normalup,
- bool enableVisualization) :
- SCA_IActuator(gameobj, KX_ACT_STEERING),
- m_mode(mode),
- m_target(target),
- m_distance(distance),
- m_velocity(velocity),
- m_acceleration(acceleration),
- m_turnspeed(turnspeed),
- m_isSelfTerminated(isSelfTerminated),
- m_pathUpdatePeriod(pathUpdatePeriod),
- m_updateTime(0),
- m_isActive(false),
- m_simulation(simulation),
- m_enableVisualization(enableVisualization),
- m_facingMode(facingmode),
- m_normalUp(normalup),
- m_obstacle(NULL),
- m_pathLen(0),
- m_wayPointIdx(-1),
- m_steerVec(MT_Vector3(0, 0, 0))
+ int mode,
+ KX_GameObject *target,
+ KX_GameObject *navmesh,
+ float distance,
+ float velocity,
+ float acceleration,
+ float turnspeed,
+ bool isSelfTerminated,
+ int pathUpdatePeriod,
+ KX_ObstacleSimulation* simulation,
+ short facingmode,
+ bool normalup,
+ bool enableVisualization)
+ : SCA_IActuator(gameobj, KX_ACT_STEERING),
+ m_target(target),
+ m_mode(mode),
+ m_distance(distance),
+ m_velocity(velocity),
+ m_acceleration(acceleration),
+ m_turnspeed(turnspeed),
+ m_simulation(simulation),
+ m_updateTime(0),
+ m_obstacle(NULL),
+ m_isActive(false),
+ m_isSelfTerminated(isSelfTerminated),
+ m_enableVisualization(enableVisualization),
+ m_facingMode(facingmode),
+ m_normalUp(normalup),
+ m_pathLen(0),
+ m_pathUpdatePeriod(pathUpdatePeriod),
+ m_wayPointIdx(-1),
+ m_steerVec(MT_Vector3(0, 0, 0))
{
m_navmesh = static_cast<KX_NavMeshObject*>(navmesh);
if (m_navmesh)
diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.h b/source/gameengine/Ketsji/KX_SteeringActuator.h
index 4f8303107f7..d337799976b 100644
--- a/source/gameengine/Ketsji/KX_SteeringActuator.h
+++ b/source/gameengine/Ketsji/KX_SteeringActuator.h
@@ -56,12 +56,12 @@ class KX_SteeringActuator : public SCA_IActuator
int m_mode;
float m_distance;
float m_velocity;
- float m_acceleration;
+ float m_acceleration;
float m_turnspeed;
KX_ObstacleSimulation* m_simulation;
- KX_Obstacle* m_obstacle;
double m_updateTime;
+ KX_Obstacle* m_obstacle;
bool m_isActive;
bool m_isSelfTerminated;
bool m_enableVisualization;
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 5589d35f44a..e92351ad110 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -436,10 +436,14 @@ KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex)
: m_vertex(vertex),
m_mesh(mesh)
{
+ /* see bug [#27071] */
+ Py_INCREF(m_mesh->GetProxy());
}
KX_VertexProxy::~KX_VertexProxy()
{
+ /* see bug [#27071] */
+ Py_DECREF(m_mesh->GetProxy());
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index c34a00513bf..1eed0665564 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -66,7 +66,7 @@ protected:
btIDebugDraw* m_debugDrawer;
class btDefaultCollisionConfiguration* m_collisionConfiguration;
- class btBroadphaseInterface* m_broadphase; // broadphase for dynamic world
+ class btBroadphaseInterface* m_broadphase; // broadphase for dynamic world
// for culling only
btOverlappingPairCache* m_cullingCache;
struct btDbvtBroadphase* m_cullingTree; // broadphase for culling
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index 2988aa4effb..478aa0ab03c 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -207,7 +207,7 @@ public:
* @return true if stereo mode is enabled.
*/
virtual bool Stereo()=0;
- virtual StereoMode GetStereoMode()=0;
+ virtual StereoMode GetStereoMode()=0;
virtual bool InterlacedStereo()=0;
/**
* Sets which eye buffer subsequent primitives will be rendered to.
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h
index 422d6dfa1b3..baf3d9c1166 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h
@@ -39,7 +39,7 @@ void main(void)
{
vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114));
- gl_FragColor = vec4(gray, gray, gray, texcolor.a);
+ gl_FragColor = vec4(gray, gray, gray, texcolor.a);
}
);
#endif
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h
index 475f3506c2c..7df271c15e4 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h
@@ -37,9 +37,9 @@ uniform sampler2D bgl_RenderedTexture;
void main(void)
{
- vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
+ vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
gl_FragColor.rgb = 1.0 - texcolor.rgb;
- gl_FragColor.a = texcolor.a;
+ gl_FragColor.a = texcolor.a;
}
);
#endif
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index cbfa49510a5..c28db2fd91c 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -149,7 +149,7 @@ public:
virtual void SetRenderArea();
virtual void SetStereoMode(const StereoMode stereomode);
- virtual RAS_IRasterizer::StereoMode GetStereoMode();
+ virtual RAS_IRasterizer::StereoMode GetStereoMode();
virtual bool Stereo();
virtual bool InterlacedStereo();
virtual void SetEye(const StereoEye eye);
diff --git a/source/gameengine/SceneGraph/SG_DList.h b/source/gameengine/SceneGraph/SG_DList.h
index 9e7e514b27a..3fb4eb7b55b 100644
--- a/source/gameengine/SceneGraph/SG_DList.h
+++ b/source/gameengine/SceneGraph/SG_DList.h
@@ -245,10 +245,10 @@ public:
}
}
virtual ~SG_DListHead() {}
- T* Remove()
- {
+ T* Remove()
+ {
return static_cast<T*>(SG_DList::Remove());
- }
+ }
};
diff --git a/source/gameengine/VideoTexture/ImageRender.h b/source/gameengine/VideoTexture/ImageRender.h
index 1101fbbc2d4..4dfd701ac3d 100644
--- a/source/gameengine/VideoTexture/ImageRender.h
+++ b/source/gameengine/VideoTexture/ImageRender.h
@@ -52,42 +52,42 @@ public:
virtual ~ImageRender (void);
/// get background color
- int getBackground (int idx) { return (idx < 0 || idx > 3) ? 0 : int(m_background[idx]*255.f); }
+ int getBackground (int idx) { return (idx < 0 || idx > 3) ? 0 : int(m_background[idx]*255.f); }
/// set background color
void setBackground (int red, int green, int blue, int alpha);
/// clipping distance
float getClip (void) { return m_clip; }
/// set whole buffer use
- void setClip (float clip) { m_clip = clip; }
+ void setClip (float clip) { m_clip = clip; }
protected:
- /// true if ready to render
- bool m_render;
+ /// true if ready to render
+ bool m_render;
/// rendered scene
KX_Scene * m_scene;
/// camera for render
KX_Camera * m_camera;
- /// do we own the camera?
- bool m_owncamera;
- /// for mirror operation
- KX_GameObject * m_observer;
- KX_GameObject * m_mirror;
+ /// do we own the camera?
+ bool m_owncamera;
+ /// for mirror operation
+ KX_GameObject * m_observer;
+ KX_GameObject * m_mirror;
float m_clip; // clipping distance
- float m_mirrorHalfWidth; // mirror width in mirror space
- float m_mirrorHalfHeight; // mirror height in mirror space
- MT_Point3 m_mirrorPos; // mirror center position in local space
- MT_Vector3 m_mirrorZ; // mirror Z axis in local space
- MT_Vector3 m_mirrorY; // mirror Y axis in local space
- MT_Vector3 m_mirrorX; // mirror X axis in local space
- /// canvas
- RAS_ICanvas* m_canvas;
- /// rasterizer
- RAS_IRasterizer* m_rasterizer;
- /// render tools
- RAS_IRenderTools* m_rendertools;
- /// engine
- KX_KetsjiEngine* m_engine;
+ float m_mirrorHalfWidth; // mirror width in mirror space
+ float m_mirrorHalfHeight; // mirror height in mirror space
+ MT_Point3 m_mirrorPos; // mirror center position in local space
+ MT_Vector3 m_mirrorZ; // mirror Z axis in local space
+ MT_Vector3 m_mirrorY; // mirror Y axis in local space
+ MT_Vector3 m_mirrorX; // mirror X axis in local space
+ /// canvas
+ RAS_ICanvas* m_canvas;
+ /// rasterizer
+ RAS_IRasterizer* m_rasterizer;
+ /// render tools
+ RAS_IRenderTools* m_rendertools;
+ /// engine
+ KX_KetsjiEngine* m_engine;
/// background color
float m_background[4];
diff --git a/source/gameengine/VideoTexture/ImageViewport.h b/source/gameengine/VideoTexture/ImageViewport.h
index 1b415fc58be..70c52b0781c 100644
--- a/source/gameengine/VideoTexture/ImageViewport.h
+++ b/source/gameengine/VideoTexture/ImageViewport.h
@@ -51,7 +51,7 @@ public:
/// is alpha channel used
bool getAlpha (void) { return m_alpha; }
/// set whole buffer use
- void setAlpha (bool alpha) { m_alpha = alpha; }
+ void setAlpha (bool alpha) { m_alpha = alpha; }
/// get capture size in viewport
short * getCaptureSize (void) { return m_capSize; }
@@ -71,8 +71,8 @@ protected:
short m_capSize[2];
/// use whole viewport
bool m_whole;
- /// use alpha channel
- bool m_alpha;
+ /// use alpha channel
+ bool m_alpha;
/// position of capture rectangle in viewport
GLint m_position[2];
diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt
index 3f802642d33..c5a6831a4cb 100644
--- a/source/tests/CMakeLists.txt
+++ b/source/tests/CMakeLists.txt
@@ -138,8 +138,30 @@ add_test(import_ply_small_holes ${TEST_BLENDER_EXE}
--write-blend=${TEST_OUT_DIR}/import_ply_small_holes.blend
)
-# PLY Export tests (TODO)
+# PLY Export
+add_test(export_ply_cube_all_data ${TEST_BLENDER_EXE}
+ ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
+ --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
+ --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_cube_all_data.ply'\)
+ --md5_source=${TEST_OUT_DIR}/export_ply_cube_all_data.ply
+ --md5=6adc3748ceae8298496f99d0e7e76c15 --md5_method=FILE
+)
+add_test(export_ply_suzanne_all_data ${TEST_BLENDER_EXE}
+ ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
+ --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
+ --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply'\)
+ --md5_source=${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply
+ --md5=68ba23f02efd6511bfd093f45f703221 --md5_method=FILE
+)
+
+add_test(export_ply_vertices ${TEST_BLENDER_EXE} # lame, add a better one
+ ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
+ --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
+ --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_vertices.ply'\)
+ --md5_source=${TEST_OUT_DIR}/export_ply_vertices.ply
+ --md5=37faba0aa2014451b27f951afa92f870 --md5_method=FILE
+)
# STL Import tests
@@ -164,8 +186,30 @@ add_test(import_stl_knot_max_simplified ${TEST_BLENDER_EXE}
--write-blend=${TEST_OUT_DIR}/import_stl_knot_max_simplified.blend
)
-# STL Export tests (TODO)
+# STL Export
+add_test(export_stl_cube_all_data ${TEST_BLENDER_EXE}
+ ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
+ --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
+ --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_cube_all_data.stl'\)
+ --md5_source=${TEST_OUT_DIR}/export_stl_cube_all_data.stl
+ --md5=64cb97c0cabb015e1c3f76369835075a --md5_method=FILE
+)
+add_test(export_stl_suzanne_all_data ${TEST_BLENDER_EXE}
+ ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
+ --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
+ --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl'\)
+ --md5_source=${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl
+ --md5=e9b23c97c139ad64961c635105bb9192 --md5_method=FILE
+)
+
+add_test(export_stl_vertices ${TEST_BLENDER_EXE} # lame, add a better one
+ ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
+ --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
+ --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_vertices.stl'\)
+ --md5_source=${TEST_OUT_DIR}/export_stl_vertices.stl
+ --md5=3fd3c877e573beeebc782532cc005820 --md5_method=FILE
+)
# X3D Import
@@ -196,7 +240,7 @@ add_test(export_x3d_cube ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_cube.x3d',use_selection=False\)
--md5_source=${TEST_OUT_DIR}/export_x3d_cube.x3d
- --md5=2621d8cc2cc1d34f6711c54519907dac --md5_method=FILE
+ --md5=05312d278fe41da33560fdfb9bdb268f --md5_method=FILE
)
add_test(export_x3d_nurbs ${TEST_BLENDER_EXE}
@@ -204,7 +248,7 @@ add_test(export_x3d_nurbs ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_nurbs.x3d',use_selection=False\)
--md5_source=${TEST_OUT_DIR}/export_x3d_nurbs.x3d
- --md5=d56b3736bab063d101d42079bd276f01 --md5_method=FILE
+ --md5=4286d4a2aa507ef78b22ddcbdcc88481 --md5_method=FILE
)
add_test(export_x3d_all_objects ${TEST_BLENDER_EXE}
@@ -212,7 +256,7 @@ add_test(export_x3d_all_objects ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_all_objects.x3d',use_selection=False\)
--md5_source=${TEST_OUT_DIR}/export_x3d_all_objects.x3d
- --md5=0914c9a7fcdbfc5741c1269497e9068b --md5_method=FILE
+ --md5=f5f9fa4c5619a0eeab66685aafd2f7f0 --md5_method=FILE
)
@@ -245,7 +289,7 @@ add_test(export_3ds_cube ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_cube.3ds',use_selection=False\)
--md5_source=${TEST_OUT_DIR}/export_3ds_cube.3ds
- --md5=0df6cfb130052d01e31ef77d391d4cc0 --md5_method=FILE
+ --md5=a31f5071b6c6dc7445b9099cdc7f63b3 --md5_method=FILE
)
add_test(export_3ds_nurbs ${TEST_BLENDER_EXE}
@@ -253,7 +297,7 @@ add_test(export_3ds_nurbs ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_nurbs.3ds',use_selection=False\)
--md5_source=${TEST_OUT_DIR}/export_3ds_nurbs.3ds
- --md5=ba1a6d43346fee3bcadc7e30e3c95935 --md5_method=FILE
+ --md5=5bdd21be3c80d814fbc83cb25edb08c2 --md5_method=FILE
)
add_test(export_3ds_all_objects ${TEST_BLENDER_EXE}
@@ -261,7 +305,7 @@ add_test(export_3ds_all_objects ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_all_objects.3ds',use_selection=False\)
--md5_source=${TEST_OUT_DIR}/export_3ds_all_objects.3ds
- --md5=0940ea889498cd437d503670738639ae --md5_method=FILE
+ --md5=68447761ab0ca38e1e22e7c177ed48a8 --md5_method=FILE
)
@@ -273,7 +317,7 @@ add_test(export_fbx_cube ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_cube.fbx',use_selection=False,use_metadata=False\)
--md5_source=${TEST_OUT_DIR}/export_fbx_cube.fbx
- --md5=86da2495dffd7c270e682f599be6b3d1 --md5_method=FILE
+ --md5=59a35577462f95f9a0b4e6035226ce9b --md5_method=FILE
)
add_test(export_fbx_nurbs ${TEST_BLENDER_EXE}
@@ -281,7 +325,7 @@ add_test(export_fbx_nurbs ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_nurbs.fbx',use_selection=False,use_metadata=False\)
--md5_source=${TEST_OUT_DIR}/export_fbx_nurbs.fbx
- --md5=88a263ddb5181e6522dc214debb92ced --md5_method=FILE
+ --md5=d31875f18f613fa0c3b16e978f87f6f8 --md5_method=FILE
)
add_test(export_fbx_all_objects ${TEST_BLENDER_EXE}
@@ -289,5 +333,5 @@ add_test(export_fbx_all_objects ${TEST_BLENDER_EXE}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\)
--md5_source=${TEST_OUT_DIR}/export_fbx_all_objects.fbx
- --md5=e6f75fe7de9aa366896456e13eafc76a --md5_method=FILE
+ --md5=b35eb2a9d0e73762ecae2278c25a38ac --md5_method=FILE
)